Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 07-15-2009, 05:06 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

usage:
Mob::CastSpell(spell_id, target_id, slot= 10, casttime= -1, mana_cost= -1)
so:
$npc->CastSpell(4607, $target->GetID());
Reply With Quote
  #3  
Old 07-15-2009, 05:16 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

So will that first one make them do it with no delay? And with that can I get rid of the $target = $npc->GetTarget()?
Reply With Quote
  #4  
Old 07-15-2009, 05:41 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

Ok I changed it to be like this
Code:
sub EVENT_COMBAT{
 if ($combat_state == 1){
 quest::settimer("knockback", 8);
 quest::setnexthpevent(75);
 }
 }
 sub EVENT_TIMER{
 if ($timer eq "knockback"){
  $target = $npc->GetTarget();
 $npc->CastSpell(904, $target->GetID());
 $client->Message(4,"A blow from Khabahn sends you flying.");
 quest::stoptimer("knockback");
 quest::settimer("knockback", 8);
 }
}
sub EVENT_HP{
 if ($hpevent == 75){
 $target = $npc->GetTarget();
  quest::shout("This is over!");
  $npc->CastSpell(2802, $target->GetID());
  $npc->CastSpell(2802, $target->GetID());
  $npc->CastSpell(2802, $target->GetID());
  $npc->CastSpell(2802, $target->GetID());
  $npc->CastSpell(2802, $target->GetID());
  $npc->CastSpell(2802, $target->GetID());
  quest::setnexthpevent(50);
 }
 if ($hpevent == 50){
  $target = $npc->GetTarget();
 quest::shout("Prepare yourself!");
  Mob::CastSpell(2802, $target->GetID(), slot= 10, casttime= -1, mana_cost= -1)
  Mob::CastSpell(2802, $target->GetID(), slot= 10, casttime= -1, mana_cost= -1)
  Mob::CastSpell(2802, $target->GetID(), slot= 10, casttime= -1, mana_cost= -1)
  Mob::CastSpell(2802, $target->GetID(), slot= 10, casttime= -1, mana_cost= -1)
  Mob::CastSpell(2802, $target->GetID(), slot= 10, casttime= -1, mana_cost= -1)
  Mob::CastSpell(2802, $target->GetID(), slot= 10, casttime= -1, mana_cost= -1)
  quest::setnexthpevent(25);
  }
 if ($hpevent == 25){
  $target = $npc->GetTarget();
 quest::shout("Take this!");
 Mob::CastSpell(470, $target->GetID(), slot= 10, casttime= -1, mana_cost= -1)
 }
}
 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);
}
The knockback part of the timer works, but none of the other casts do anything
Reply With Quote
  #5  
Old 07-15-2009, 07:00 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

can anyone just rewrite that in a way they know will work? I've been working on it all day and can't get the thing to work with any spell.
Reply With Quote
  #6  
Old 07-15-2009, 07:28 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Your problem with that is that sub EVENT_HP is probably not compiling because of Mob::CastSpell instead of $npc->CastSpell() in the final two if statements.
Reply With Quote
  #7  
Old 07-15-2009, 07:56 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

hm ok I'll try putting it back to like that
Reply With Quote
  #8  
Old 07-15-2009, 08:17 PM
Randymarsh9
Dragon
 
Join Date: Dec 2007
Posts: 658
Default

I finally got it working. I just changed the multiple casts for one cast of a powerful spell and changed the mob::quest thing. Thanks for the help KLS!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:38 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3