Lightfoot8 wrote...
#include "nw_i0_generic"
#include "nw_i0_plot"
#include "X0_I0_HENCHMAN"
void ResHenchman(object oPC,string sLiner = "", object oHenchman =OBJECT_SELF)
{
if ( GetIsInCombat (oPC) || !GetIsObjectValid(oPC))
{
DelayCommand(30.0,ResHenchman(oPC,sLiner,oHenchman));
return;
}
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oHenchman);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(GetMaxHitPoints(oHenchman)), oHenchman);
//DelayCommand(30.75, SetIsDestroyable(TRUE, TRUE, TRUE));
DelayCommand(1.0, SpeakString(sLiner));
SetDidDie(FALSE);
if (GetArea(oPC) == GetArea(oHenchman))
{
DelayCommand(1.5, AddHenchman(oPC, oHenchman));
//Re-set the variable to get rid of annoying dialogueif the henchie has successfully re-joined
DeleteLocalInt(oPC, GetResRef(oHenchman) + "erno_dead");
//Set up the proper conditions for henchman as defined by the X2 script
SetAssociateState(NW_ASC_IS_BUSY, FALSE,oHenchman);
//SetAssociateListenPatterns();
SetLocalInt(oHenchman, "NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);
SetLocalInt(oHenchman, "NW_COM_MODE_MOVEMENT", ASSOCIATE_COMMAND_FOLLOWMASTER);
SetAssociateState(NW_ASC_IS_BUSY, FALSE,oHenchman);
}
}
void main()
{
//Define the former master
object oMaster=GetLastMaster();
//Define the henchman
object oMe =OBJECT_SELF;
//Set the HCH erno_dead variable, just in case the script goes wrong.
//This means that you see a special bit of dialogue when you speak to the hench post-death, but only if something goes wrong, i.e. the PC moves areas
SetLocalInt(oMaster, GetResRef(OBJECT_SELF) + "erno_dead", 1);
//Double-hit thing to stop the body from getting destroyed or anything
if (GetDidDie()) return;
else SetDidDie();
//Choose a random dialogue string
string sRevive;
int iRandom = d8();
switch(iRandom)
{
case 1: sRevive = "Better luck next time, eh?"; break;
case 2: sRevive = "Thank all the Gods that we pulled through that..."; break;
case 3: sRevive = "That was... unpleasant, to say the least."; break;
case 4: sRevive = "Oh my... how long was I out for?"; break;
case 5: sRevive = "Well, there's one for the journal."; break;
case 6: sRevive = "Argh, I can barely feel my legs!"; break;
case 7: sRevive = "That was strangely invigorating!"; break;
case 8: sRevive = "For the love of all things holy, let's be more careful next time!"; break;
}
//Resurrect and remove effects, then add back the henchman
DelayCommand(0.1, RemoveEffects(OBJECT_SELF));
DelayCommand( 30.0,ResHenchman(oMaster,sRevive) );
}