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

07-15-2009, 04:24 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
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);
}
|
 |
|
 |

07-15-2009, 05:06 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
usage:
Mob::CastSpell(spell_id, target_id, slot= 10, casttime= -1, mana_cost= -1)
so:
$npc->CastSpell(4607, $target->GetID());
|

07-15-2009, 05:16 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
So will that first one make them do it with no delay? And with that can I get rid of the $target = $npc->GetTarget()?
|
 |
|
 |

07-15-2009, 05:41 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
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
|
 |
|
 |

07-15-2009, 07:00 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
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.
|

07-15-2009, 07:28 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
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.
|

07-15-2009, 07:56 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
hm ok I'll try putting it back to like that
|

07-15-2009, 08:17 PM
|
Dragon
|
|
Join Date: Dec 2007
Posts: 658
|
|
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!
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:15 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |