Spawning Indoors(and underground), have invisible Peds (NPCs)

Hi,
Something I noticed is when I spawn NPC peds inside say Humane Labs and other indoor locations, that very often they will be invisible. Weapons as well, except for the weapon smoke and tracers. When I spawn anywhere else (basically always outside), this never happens. I tried changing ped type, also set their alpha and visibility to make sure that isnt it, but nothing works. It seems to be a sync problem. When I hit them with a bullet, they will finally come into view.

Any ideas what is going on, and how to fix? BTW, this is with a single client, no other clients involved.

Ok, its usually when they spawn inside/underground and are more than around 50m away from the player. I even tried spawning them outside, like z=1000 and moving them to the indoor location, but that did not work either.
I ended up redoing some of the spawn code, to dynamically check if the player is around 30m or less away and spawn the NPCs in dynamically. Its a pain, since I need to call the server to tell all other clients that that spawn location has been used, but it seems to work so far that way. I noticed when I moved this check to be around 50m, the NPCs would begin to ‘phase out’ a bit. There definitely seems to be something with GTA/GTAO/Fivem (?) that causes desync with Peds spawning indoors/underground, rather than outside.
Its very weird.

2 Likes