Adding props to interiors

TaazR

I have discovered 3 natives in the interior section that relate to props inside interiors. These props are what are added/removed from the player safehouses as the player progresses through the story in GTA V. They are also used for other things. However as some of you know, when you load the GTA Online map in single player, the props from the player safehouses disappear. These natives can fix that.

Remember to put the ID of the interior that actually contains the prop or the game might crash. You MUST use INTERIOR::REFRESH_INTERIOR after you add/remove the props, or else they won't appear.

I have already fixed the prop issue regarding the safehouses when the Online map is enabled in Open All Interiors v4, but this might be useful for anyone who might want to manipulate the props or test out the beta ones for the apartments. This may also get us closer to figuring out how to get the GTA Online apartments bong/drinks/bed to work in single player.

sjaak327

The trouble is, those objects are made interactive by a script. They are not interactive out of themselves. The telescope for instance, works in SP, probably because the script that makes it interactive runs in SP. As there are some telescopes in SP that need to work.

For instance the bathroom has a script, but it only runs in MP. I tried running it in SP, which in fact it did, but nothing at all happened after requesting the script. probably because it checks if player is in an MP session, and it would only actually execute code if the player is in an MP session, executing nothing when the player is not.

Also, this method of 'restoring' save houses is dead simple, each time the game starts or loads a save, you ask the game which sets of objects are enabled, and which sets are disabled. You can than act upon that information. In my case, I run the restoration once, when the player actually enters the interior.

For most of the stuff you talk off, more code would be needed. And it would have to run constantly.

TaazR

The trouble is, those objects are made interactive by a script. They are not interactive out of themselves. The telescope for instance, works in SP, probably because the script that makes it interactive runs in SP. As there are some telescopes in SP that need to work.

For instance the bathroom has a script, but it only runs in MP. I tried running it in SP, which in fact it did, but nothing at all happened after requesting the script. probably because it checks if player is in an MP session, and it would only actually execute code if the player is in an MP session, executing nothing when the player is not.

Also, this method of 'restoring' save houses is dead simple, each time the game starts or loads a save, you ask the game which sets of objects are enabled, and which sets are disabled. You can than act upon that information. In my case, I run the restoration once, when the player actually enters the interior.

For most of the stuff you talk off, more code would be needed. And it would have to run constantly.

I have a feeling that the BRAIN namespace may have a function that can enable the interactive props in SP. Have a look at standard_global_init.c4

TaazR

I was hoping to get away with reading the state of objects once every game load, then setting the missing ones once until the next game save.

this works fine, unless you do missions in between, as you guessed it, the game resets everything back and the missing objects become missing again.

I assume the majority of the people who use my mod have completed the game, so I just load all the props that should be loaded after the game is completed every time my mod starts. But if you wanted to specifically check for each prop that is there for each user; then maybe whenever a player starts a mission, you could save their current props for each safehouse to the .ini file, and then after they complete the mission, load them up again.

sjaak327

I was hoping to get away with reading the state of objects once every game load, then setting the missing ones once until the next game save.

this works fine, unless you do missions in between, as you guessed it, the game resets everything back and the missing objects become missing again.

I assume the majority of the people who use my mod have completed the game, so I just load all the props that should be loaded after the game is completed every time my mod starts. But if you wanted to specifically check for each prop that is there for each user; then maybe whenever a player starts a mission, you could save their current props for each safehouse to the .ini file, and then after they complete the mission, load them up again.

Yeah, I now run the check in tick once MPmaps=disabled, but not sure if I get around the mission problem this way. At least after the change, I didn't have missing objects after doing a few missions. Will have to see what happens. in any case, disabling and re-enabling mp maps will bring them back.

It does work correctly at game start (as I enable MP maps at the end) so the detection works, stores stuff in an array and based upon that array re-enables or removes objects that were detected as enabled / disabled.

On save load it also works, even to a point where an older save brings in different objects. The trouble is once mp maps is enabled, it also messes up the detection. I suppose once you start a mission, finish it, the game does stuff, but since MP maps is enables it sets everything to disabled. Hence no way to re-enable it again.

Maybe when I detect a mission I would save it to a different array and use that to re-enable the objects.

To get the IDs. The coords are the coords of the interior you want (so if it's an IPL - the IPL coords you use to teleport there etc). The coords don't seem to matter, as long as the coords are inside the room - it'll work.