Alright, so I have a WIP version that is satisfactory enough for me to share:
http://www.mediafire.com/download/x7hha5sa3x3p7c1/RespawningEnemiesWIP.zip

I have removed the experience points upon killing respawned NPCs for now, which means that respawned NPCs will not give any additional exp upon death. I think I have an idea on how to implement experience points correctly, but I have to try implementing it first.

Full story code for this WIP version is here:

INIT section:
Code
DB_RespawnEnabled(1);


KB Section:
Code
IF
CharacterDied(_Character)
AND
DB_RespawnEnabled(1)
AND
NOT _Character.isPlayer()
AND
Time(_,_,_TH)
THEN
DB_DeadCharacters(_Character, _TH);

IF
CharacterEnteredRegion(_Character,_)
AND
_Character.isPlayer()
THEN
ProcResurrectCharacters();

PROC
ProcResurrectCharacters()
AND
Time(_,_,_TH)
AND
DB_DeadCharacters(_Character, _deadTime)
AND
IntegerSubtract(_TH, _deadTime, _delta)
AND
_delta >= 1
THEN
CharacterResurrect(_Character);
NOT DB_DeadCharacters(_Character, _deadTime);
ProcResurrectCharacters();

IF
CharacterCreationFinished(CHARACTER_NULL)
AND
CurrentLevel(_Lvl)
AND
DB_CharacterCreationLevels(_Lvl)
THEN
CharacterAddSkill(CHARACTER_Player1, "Shout_RespawnEnable");
CharacterAddSkill(CHARACTER_Player1, "Shout_RespawnDisable");
CharacterAddSkill(CHARACTER_Player2, "Shout_RespawnEnable");
CharacterAddSkill(CHARACTER_Player2, "Shout_RespawnDisable");


IF
CharacterUsedSkill(_Char, "Shout_RespawnEnable", _)
AND
DB_RespawnEnabled(0)
THEN
NOT DB_RespawnEnabled(0);
DB_RespawnEnabled(1);

IF
CharacterUsedSkill(_Char, "Shout_RespawnDisable", _)
AND
DB_RespawnEnabled(1)
THEN
NOT DB_RespawnEnabled(1);
DB_RespawnEnabled(0);



Enemies will respawn upon changing maps if Respawn is Enabled, and only if it has been at least 1-2 min. since they last died (this time limit is prob. unnecessary, but it's there in case CharacterEnteredRegion doesn't work the way I think it does). Respawn is enabled at the start of the game, and can be switched on/off with the use of the two skills given to the main characters at the start.

I have already encountered some sort of bug. When I Rift traveled to Cyseal from the Homestead, the skeleton group by the tutorial dungeon (who at that point was on their third life) did not show up in the combat order bar at the top even though they were clearly in combat and were taking turns in order.

Edit:
Well, my attempt at making dummy NPC/scripts that spawn/kill characters for exp failed to do anything. I tried modifying a character on one of the test levels with a charScript that does stuff when characters die (in tandem with a Story script).

Last edited by Rhidian; 01/09/14 02:25 AM.