If your NPC has a PersistentDestructible, it will be destroyed when you load a saved game in which it's been killed. More...
If your NPC has a PersistentDestructible, it will be destroyed when you load a saved game in which it's been killed.
Add this script to make it gracefully unregister from RFPS's NPC Registry and NPC Spawner when being destroyed.
You must also edit the RFPS CharacterDamage.cs script in two places.
On line 7 (after "public class CharacterDamage : MonoBehaviour {") add:
public UnityEngine.Events.UnityEvent onDie;
On line ~180, change this section of the ApplyDamage method from:
//Kill NPC if (hitPoints /= 0.0f){ AIComponent.vocalFx.Stop();
to:
//Kill NPC if (hitPoints /= 0.0f){ onDie.Invoke(); // ADD THIS LINE! AIComponent.vocalFx.Stop();
This will add an OnDie() event. Add PersistentDestructible.OnDestroy to the event.