Closed DurtyFree closed 4 years ago
Checked it while ago and it seems that it works when dynamic
parameter is set to true
.
Please confirm @DurtyFree if it works for you after that.
I tested spawning objects with dynamic set to true fixes this issue. It seems to be related to how doors are handled in GTA V, they must be spawned as dynamic otherwise they are invisible / not working.
Thx @Lhoerion
After some investigation it seems like it working with dynamic = true is just a weird effect. There seems to be a bug related to door / gate models.
Normally you should be able to spawn them (visibly) with dynamic = false. Only this way its working to add / register them as real doors in GTA V using the door natives. With the dynamic = true workaround you have to freeze the object, which results in the doors just not working at all.
Snippet how it should work (but door is invisible due to this bug) (ofc make sure model is loaded inb4):
game.createObjectNoOffset(3426294393, position.x, position.y, position.z, false, false, false);
let doorHash = game.getHashKey("testdoor");
game.addDoorToSystem(doorHash, 3426294393, position.x, position.y, position.z, false, false, false);
game.doorControl(doorHash, 3426294393, position.y, position.z, false, 0, 0, 0);
fixed in latest dev build.
For some reason any objects spawned that have the door / gate archetype flags set, are invisible in game. This is very weird as it only seem to happen to almost all door / gate model. Yes the model is correctly loaded and yes the ytyp is loaded. I tried creating the object with createObject & createObjectNoOffset, no difference. Both seem to return a valid handle tho.
Expected behavior The object should be visible. For example look like this:
Current behavior The object is created (valid handle is returned) but its invisible. See this gif: https://gyazo.com/b29774096e2863a7db621fb97a4231fc
Steps to reproduce Try creating the object v_ilev_gasdoor for example. Or basically any moving door / gate.
Context (environment) I want to add custom doors to the game. Without this its basically impossible to script custom doors during runtime.
Possible implementation Not sure if this could be related to the same issue this mod fixes: (Objects unlocker) https://www.gta5-mods.com/scripts/object-spawn-unlocker