View Single Post
  #1  
Old 07-15-2009, 04:24 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default Trouble with NPC casting

I am trying to make an npc cast the spell flurry every 25% which is supposed to just make him attack, but it just says "Khabahn's casting has been interrupted" everytime I fight him. Also the whole timer thing doesn't seem to be working at all

Code:
sub EVENT_COMBAT{
 if ($combat_state == 1){
 quest::settimer("knockback", 15);
 quest::setnexthpevent(75);
 }
 }
 sub EVENT_TIMER{
 if ($timer eq "knockback"){
  $target = $npc->GetTarget();
 $npc->CastSpell($target, 904);
 $client->Message(4,"A blow from Khabahn sends you flying.");
 quest::stoptimer("knockback");
 quest::settimer("knockback", 15);
 }
}
sub EVENT_HP{
 if ($hpevent == 75){
 $target = $npc->GetTarget();
  quest::shout("This is over!");
  $npc->CastSpell($target, 4607);
  $npc->CastSpell($target, 4607);
  $npc->CastSpell($target, 4607);
  $npc->CastSpell($target, 4607);
  $npc->CastSpell($target, 4607);
  $npc->CastSpell($target, 4607);
  quest::setnexthpevent(50);
 }
 if ($hpevent == 50){
  $target = $npc->GetTarget();
 quest::shout("Prepare yourself!");
  $npc->CastSpell(4607, $target);
  $npc->CastSpell(4607, $target);
  $npc->CastSpell(4607, $target);
  $npc->CastSpell(4607, $target);
  $npc->CastSpell(4607, $target);
  $npc->CastSpell(4607, $target);
  quest::setnexthpevent(25);
  }
 if ($hpevent == 25){
  $target = $npc->GetTarget();
 quest::shout("Take this!");
 $npc->CastSpell(470, $target);
 }
}
 sub EVENT_DEATH{
  quest::setglobal("arena", 8, 5, "F");
  quest::shout("No, how did this happen?!?");
  quest::setglobal("khabahn", 1, 5, "F");
  quest::signalwith(1370,3,1);
  quest::spawn(1371,0,0,-19, 106, 6.4);
}
Reply With Quote