I'm trying to do an optional respawn version, but I'm running into some issues.
First, the code:

Character Script code (under DefaultCharacter)
Code
INIT
INT:%canRespawn=0


EVENT Respawn
VARS
CHARACTERTEMPLATE:_myTemplate
FLOAT3:_myPos
ON
OnInit()
ACTIONS
IF "c1&c2&c3&c4"
IsEqual(%canRespawn, 1)
CharacterIsDead(__Me)
GetPosition(__Me, _myPos)
CharacterGetTemplate(__Me, _myTemplate)
THEN
SpawnCharacter(_, _myTemplate, _myPos, 1)
Set(%canRespawn, 0)
CharacterSetOffStage()
CharacterDestroy(__Me)
ENDIF


Story (always on for now, can change to be conditional later)
Code
IF
CharacterDied(_Char)
THEN
CharacterSetVarInteger(_Char, "canRespawn", 1);



The problem seems to be that the spawned characters are not leaving corpses that persist through a save game/load, meaning that they don't spawn upon loading.

1. I kill the original enemies on the map.
2. I save and then load
3. The original enemies have spawned Generation 1, which have the appropriate stats and such
4. I kill Generation 1, and then save and load
5. No Generation 2 is created, and the corpses of Generation 1 are nowhere to be seen.

My guess is that the newly spawned characters are either not triggering the CharacterDied event or they aren't saving for some reason.

By the way, does anyone know what the difference between playSpawn=1 and playSpawn=0 for the CharacterSpawn command is?

Edit:
Alright, after some debugging it seems that spawned characters do not trigger the CharacterDied event. I suppose the game is treating them like summons.

Last edited by Rhidian; 01/09/14 06:40 PM.