[SOLVED] [QUESTION] Duplicatiing Interiors / Instacing

I was wondering if anyone knows a way I can generate a interior multiple times within a function because I would like it for a house script so that I do not have the normal issues with instancing like the VOIP, game sounds etc.

I am not sure if this is possible and I have always wondered. Hope you understand what I mean!

Thanks.

1 Like

maybe whit codewalker? havent tried yet

I could just make like multiple of the iterior like that but it would mean having a bunch of custom map stuff which will not be the best and also I just want them, when I need them e.g. When someone enters there house it then makes a new interior. It would take a while and alot of resource power but after it was made it would be fine and I am sure there is a way I will be able to do this.

I am researching further and if I find a solution then I will post it here for others if they need it.

You can build the interior using CreateObject and call it whenever it’s needed. I’m not sure if this is ideal solution though.

There is a simple solution to do that. When someone enters an apartment remove the collision and set invisible every other players except for those who are in the same apartment as your local player.

Thank you for your reply but I would like to tell you about the fact that I did state I dislike “instacing” becase of VOIP and lots of other bugs that come with it. There will be most likely a time where there will be more than 1 person in the same interior and thats why I think yours is not quite what I am looking for.

Thanks for the help though :slight_smile:

Yes this is pretty much exactly what I want. It is not the best but will work. I just need to find a example function out there that generates the interor based on coords so I can have a list of coords of where to make them when the function is called if that makes sense.

I’m confused I read your message to fast.

You could still avoid the VOIP issue by changing the voice channel and I believe that disabling the collisions will avoid noises.

You will also need to deal with weapons, I personally just disable everything while someone is in an instance.

That’s the way Rockstar deals with instances I believe.

Here is an example of someone who made the interior of the prison entirely in lua lol.

Hope this helps.

all done in codewalker

Lol… Except he said he DIDN’T want a bunch of buildings around… lol Reading comprehension…

Well if ya know how ymaps worked, these load in at a distance. So when you get near them then they load in.

I’m well aware how the work. But if you were aware of what he was asking you wouldn’t have posted that because he obviously said he didn’t want to do that.

I do it with having physical instances (like in your screenshot) but that is still limiting though as you cannot have more then a certain amount of props loaded in the same area at the same time regardless if they’re multiple ymap files with each their own distances.

The solution I provided seems to be exactly what he was looking for as you cannot load/unload ymaps whenever without causing issues. Whereas if you’re doing a CreateObject, you can always DeleteObject as well.

And like I said it’s probably not “ideal” to do it that way, but it does give him the ability to add/remove stuff on the fly. Albeit WAYYYY MORE labor intensive to make.

Well responding to his first post which he asked how to generate multiple interiors, I responded with my post saying its all done in code walker. So I don’t understand your snarky childish comments.

Excuse me, you assumed I didn’t know how ymaps worked to begin with. I expected you to have read the whole thread… lol.

So to just follow up on this, been stuck on this for … a while and finally ended up looking into what it would take for spawning them as objects. At least for the first house I looked at the overall shell of it was a single object but by default it has no collision. Ended up figuring out a way to actually get the collision embeded into the model in 3DS Max and got it imported into the game and spawning … and beyond me derping position of the collision stuff to the model … seems to work?

Honestly not sure if there’s a better way to achieve this that doesn’t require modifying the models, and not even sure if modifying models is going to be realistic for larger ones. Looking at only the ones that use the v_int_16 interior file and while they all appear to have a shell object … not hopeful that every interior would have it setup the same way.

Going to be looking into this more this weekend, if this ends up being the way I go … I’ll post the modded models with colission somewhere for folks to use.

Ultimately, think to achieve this there is going to be some amount of modding stuff required. But there’s no way the servers that aren’t using terrible instancing are going through an placing 93182470913 different ipl’s under the map. (Namely NoPixel ofc, and with proximity chat still working when someone enters their house you’d think it’s something like this that he’s just spawning just under where the player under the map.

EDIT: FML, spoke too soon I guess. For whatever reason the colission in the bedroom just … doesn’t function? Looks fine in 3ds but in-game if you go in more than halfway you just fall through. WTB Someone that isn’t a potato at 3ds :joy:

I have the issue with the shell having no collision when it is generated. I generate it used this function a friend sent me but I seem to just fall straight through it. Not sure how fixable this is and if it is easy or not but it would be great if it is so I can stop having to mess with instacing which is so BAD!

local building = CreateObject(GetHashKey("v_49_motelmp_shell"),generator.x,generator.y,generator.z,false,false,false)

FreezeEntityPosition(building,true)
Citizen.Wait(100)

CreateObject(GetHashKey("v_49_motelmp_stuff"),generator.x,generator.y,generator.z,false,false,false)
CreateObject(GetHashKey("v_49_motelmp_bed"),generator.x+1.4,generator.y-0.55,generator.z,false,false,false)
CreateObject(GetHashKey("v_49_motelmp_clothes"),generator.x-2.0,generator.y+2.0,generator.z+0.15,false,false,false)
CreateObject(GetHashKey("v_49_motelmp_winframe"),generator.x+0.74,generator.y-4.26,generator.z+1.11,false,false,false)
CreateObject(GetHashKey("v_49_motelmp_glass"),generator.x+0.74,generator.y-4.26,generator.z+1.13,false,false,false)
CreateObject(GetHashKey("v_49_motelmp_curtains"),generator.x+0.74,generator.y-4.15,generator.z+0.9,false,false,false)

CreateObject(GetHashKey("v_49_motelmp_screen"),generator.x-2.21,generator.y-0.6,generator.z+0.79,false,false,false)

CreateObject(GetHashKey("v_res_fa_trainer02r"),generator.x-1.9,generator.y+3.0,generator.z+0.38,false,false,false)
CreateObject(GetHashKey("v_res_fa_trainer02l"),generator.x-2.1,generator.y+2.95,generator.z+0.38,false,false,false)

local sink = CreateObject(GetHashKey("prop_sink_06"),generator.x+1.1,generator.y+4.0,generator.z,false,false,false)
local chair1 = CreateObject(GetHashKey("prop_chair_04a"),generator.x+2.1,generator.y-2.4,generator.z,false,false,false)
local chair2 = CreateObject(GetHashKey("prop_chair_04a"),generator.x+0.7,generator.y-3.5,generator.z,false,false,false)
local kettle = CreateObject(GetHashKey("prop_kettle"),generator.x-2.3,generator.y+0.6,generator.z+0.9,false,false,false)
local tvCabinet = CreateObject(GetHashKey("Prop_TV_Cabinet_03"),generator.x-2.3,generator.y-0.6,generator.z,false,false,false)
local tv = CreateObject(GetHashKey("prop_tv_06"),generator.x-2.3,generator.y-0.6,generator.z+0.7,false,false,false)
local toilet = CreateObject(GetHashKey("Prop_LD_Toilet_01"),generator.x+2.1,generator.y+2.9,generator.z,false,false,false)
local clock = CreateObject(GetHashKey("Prop_Game_Clock_02"),generator.x-2.55,generator.y-0.6,generator.z+2.0,false,false,false)
local phone = CreateObject(GetHashKey("v_res_j_phone"),generator.x+2.4,generator.y-1.9,generator.z+0.64,false,false,false)
local ironBoard = CreateObject(GetHashKey("v_ret_fh_ironbrd"),generator.x-1.7,generator.y+3.5,generator.z+0.15,false,false,false)
local iron = CreateObject(GetHashKey("prop_iron_01"),generator.x-1.9,generator.y+2.85,generator.z+0.63,false,false,false)
local mug1 = CreateObject(GetHashKey("V_Ret_TA_Mug"),generator.x-2.3,generator.y+0.95,generator.z+0.9,false,false,false)
local mug2 = CreateObject(GetHashKey("V_Ret_TA_Mug"),generator.x-2.2,generator.y+0.9,generator.z+0.9,false,false,false)
CreateObject(GetHashKey("v_res_binder"),generator.x-2.2,generator.y+1.3,generator.z+0.87,false,false,false)

FreezeEntityPosition(sink,true)
FreezeEntityPosition(chair1,true)	
FreezeEntityPosition(chair2,true)
FreezeEntityPosition(tvCabinet,true)	
FreezeEntityPosition(tv,true)		
SetEntityHeading(chair1,GetEntityHeading(chair1)+270)
SetEntityHeading(chair2,GetEntityHeading(chair2)+180)
SetEntityHeading(kettle,GetEntityHeading(kettle)+90)
SetEntityHeading(tvCabinet,GetEntityHeading(tvCabinet)+90)
SetEntityHeading(tv,GetEntityHeading(tv)+90)
SetEntityHeading(toilet,GetEntityHeading(toilet)+270)
SetEntityHeading(clock,GetEntityHeading(clock)+90)
SetEntityHeading(phone,GetEntityHeading(phone)+220)
SetEntityHeading(ironBoard,GetEntityHeading(ironBoard)+90)
SetEntityHeading(iron,GetEntityHeading(iron)+230)
SetEntityHeading(mug1,GetEntityHeading(mug1)+20)
SetEntityHeading(mug2,GetEntityHeading(mug2)+230)

I will continue to look around but I have no experience with 3DMax or any model editing at all so I will do my best and I appreciate the help!

Yeah, it’s because the model itself doesn’t have colission. That’s handled through a .ybn for the interior.

You can embed it into the model fairly easily in 3ds max (Literally just export the model & the .ybn from OpenIV, then use GIMS Evo to import them … drag the colission onto the model object and do any realign needed and then export it. Ideally I’d love to get the physics dictionary to work just adding it through a ytyp file but doesn’t seem to work and have to go the route of embedding it.

If you want to modify the colission (Will need to be done if you want to have just an empty shell with no objects for player housing), need to just make sure the groups in the colission stuff aren’t empty or you’ll get an error about a mesh not having a mesh and that colission won’t work… as I found out last night

Ok thank you I am very confused but I will do some research on that and give it a go. Thanks again.

Yeah, when done correct it works… decently? Lighting is awful though and there’s some visual issues when walking around

EDIT : So the camera issues are related to something with not being far enough under the map (Guessing something with models clipping through that you can’t see?) but even putting them down under around the same z-level as other interiors … lighting is still affected by the global lighting and if it rains it floods. If anyone knows how to address these issues, I’d love to talk :stuck_out_tongue: