I'm trying to make a raid type encounter, and the creature will do certain things during points of its health, but only once at each stage. It works great for one stage, but never get's to stage2 as I'm using a 'return', but don't know a way around it. Any suggestions is welcome... Here's what I've got now.
apparently I don't know the secret to posting code without it jumbling up.
int step1 = GetLocalInt (OBJECT_SELF, "step1");
int step2 = GetLocalInt (OBJECT_SELF, "step2");int step3 = GetLocalInt (OBJECT_SELF, "step3");
int step4 = GetLocalInt (OBJECT_SELF, "step4");
int nMaxHP = GetMaxHitPoints(); // OBJECT_SELF (the caller) is default
int nCurHP = GetCurrentHitPoints(); // OBJECT_SELF (the caller) is default
//Step1
if (step1 == 1){return;}//Another option besides return to get to step2?
if (nCurHP < (nMaxHP / 2))
{
// stop whatever the creature is doing
ClearAllActions();
ActionSpeakString("I'm at 50%!");
SetLocalInt(OBJECT_SELF,"step1",1);//so step1 only happens once.
}
//Step2
if (step2 == 1){return;}
if (nCurHP < (nMaxHP / 4))
{
// stop whatever the creature is doing
ClearAllActions();
ActionSpeakString("I'm at 20%!");
SetLocalInt(OBJECT_SELF,"step2",1);//so step2 only happens once.
}
Modifié par Buddywarrior, 25 juillet 2012 - 01:50 .