As you know, the default for the official campaign is that companions do not actually die when they fall to the ground during combat at zero hitpoints. Instead, after a battle, if any of your characters are still alive, they get up and can simply be healed to be up and ready to go again. This is not how I want the Althéa Campaign to play, and I have been reworking the scripts to ensure that any PC who drops below 1 HP, dies.
This may sound simple on the surface of things, but the problem was complicated by the introduction of the new Life Essence system. Not only that, but I wanted to ensure the game remained playable and yet give the player a recognition that dying would still cost something within the game.
During my testing, however, it soon became evident that the OnDeath script on a companion (that was being possessed/controlled by a player at the time) was not executing the same way as if the companion was not being possessed/controlled by the player at the time of its death. This led to the companion repeatedly coming back to life after a battle even though my script was saying something different.
In the end, after much searching and help from Man_From_Geldar on the Bioware forums (who sent me a copy of his mod to test), I was able to ascertain that the OnDeath script has special requirements that were necessary under certain conditions. Furthermore, as I looked through the OnDeath script, it became obvious when I read these lines:
// Check for additional death script. (For adding extra actions and events.)I had read them a few times as I was writing the script, but I did not pay them much heed at the time. It was only when I discovered that certain lines of my code were being ignored that I decided to write a separate script and attach it to the companion to fire when these lines were met instead. As soon as I did that, everything started to fall into place.
string sDeathScript = GetLocalString(oCompanion, "DeathScript");
if (sDeathScript != ""){ExecuteScript(sDeathScript, oCompanion);}
So, for anybody else struggling with companion OnDeath scripts (while being possessed by the player), you now have my experiences to learn from. :)
No comments:
Post a Comment