You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug NPC_Respawn doesn't call OnNPCSpawn and thus also doesn't set NPC_IsDead to false, so, many cases in NPC scripts become broken because of this fact (and also comparing to FCNPC, where same was working good on it). A truly interesting code piece was initially provided by the other guy from ru community who actively uses NPCs, and after adding some debug prints I'm sharing it below.
You need to connect, spawn and either kill the NPC which is near you manually, or type "/killhim" command. The NPC will die, a log line "NPC was killed..." will appear and then, after 7 seconds, he'll start recursively spawned every 200 ms. That's because the main check in Dead_Spawner still passes. No OnNPCSpawn callback log will be seen as well, only constant flood of "NPC is being respawned!".
Checking NPC events, NPC_Respawn has also its own callback, OnNPCRespawn...
It would be possible to redirect that call to the OnNPCSpawn callback, while also pushing some bool value to tell if its being spawned for the first time or is it being respawned, but that would be kind of a drastic change to the current scheme.
However, NPC_Respawn did lack the death state variable resetting, so that caused it to keep respawning, as the script thinks the NPC is still dead. That should be taken care of in #1184.
Sure, I completely forgot about OnNPCRespawn callback, gonna tell that guy who has initial issue to ensure he uses the right one for non-initial spawns. Also thanks for PR fixing actual issue with resetting NPC_IsDead, that seems to be the only bug it has now.
Activity
stley commentedon Jan 9, 2026
Checking NPC events, NPC_Respawn has also its own callback,
OnNPCRespawn...It would be possible to redirect that call to the
OnNPCSpawncallback, while also pushing some bool value to tell if its being spawned for the first time or is it being respawned, but that would be kind of a drastic change to the current scheme.However, NPC_Respawn did lack the death state variable resetting, so that caused it to keep respawning, as the script thinks the NPC is still dead. That should be taken care of in #1184.
NexiusTailer commentedon Jan 9, 2026
Sure, I completely forgot about
OnNPCRespawncallback, gonna tell that guy who has initial issue to ensure he uses the right one for non-initial spawns. Also thanks for PR fixing actual issue with resettingNPC_IsDead, that seems to be the only bug it has now.[-]NPC_Respawn doesn't call OnNPCSpawn (and it's critical)[/-][+]NPC_Respawn doesn't call NPC_IsDead (and it's critical)[/+][-]NPC_Respawn doesn't call NPC_IsDead (and it's critical)[/-][+]NPC_Respawn doesn't affect NPC_IsDead (and it's critical)[/+]NexiusTailer commentedon Jan 17, 2026
Solved in #1184