I wasn’t sure if this is intended behaviour or a bug but if you kill a script created entity there is a delay if you are not the owner of the entity you just killed.
Reproduction steps:
Create a ped on either the client or server, same results with both.
Whoever is not the owner of the ped shoots the ped in the head.
The ped will remain as if nothing happened for a noticeable amount of time and then finally “register” it was shot and die.
Expected result:
Ped dies as soon as it’s shot in the head without the delay. Ambient spawned traffic peds don’t appear to do this, seems to just be script created entities.
A “meh” workaround is to use NetworkRequestControlOfEntity every frame while aiming at the ped but even then if multiple players are doing this the delay can still happen and this “solution” is very tacky.
Yeah I had to use the “meh” method as well, it’s currently the only workaround I can think of. But the delay is probably to do with desync and latency of the entity owner.
Could try to reproduce at different pings to see if it affects it’s delay at all and take notes. Might be surprised by the results.
Unpopular suggestion: Hopefully one of these days there could be a solution to improve script owned entities syncing, but I am doubtful of it due to GTA limitations.
A “meh” workaround is to use NetworkRequestControlOfEntity every frame while aiming at the ped but even then if multiple players are doing this the delay can still happen and this “solution” is very tacky.
This is a very bad workaround that can potentially lead to even more problems.
There will always be a slight delay I would assume.
Can’t you use “entityDamaged” or “CEventNetworkEntityDamage” locally to “simulate” the death of an entity, or are these called too late?
You could use statebags whenever a ped is killed to signal to others, that the ped died and then do whatever you have to do with it on the client to “fake” said death.
I’ve noticed that statebags are much faster than the default networking, atleast in some cases.
I don’t have any more ideas and the void is where all things go here usually.
Unfortunately not, tried many methods and there is still a delay with each one. Hopefully this can eventually be improved on, would be nice if it could be synced like on GTA Online.