Log in

View Full Version : Npc Casting


Digitala
01-18-2010, 05:18 PM
Hey guys!

I just have a question regarding npc channeling.
I have been writing this perl port quests for an npc.

Player tells npc something and i want this npc to cast a portspell.
The thing is that the npc casts it instant. There is no casting time for some reason.
What should i do to force the npc to channel the spell instead of an insta translocation.

{quest::selfcast("####"); }

Any info is appreciated
Thx

Derision
01-18-2010, 05:40 PM
The only way I can think of right now that uses the cast time is $npc->CastSpell, however you really need to use this with a Translocate target spell which pops up a confirmation box that the player must accept.

E.g. the following will cast translocate Nexus after the spell cast time is over:

sub EVENT_SAY
{
if ($text=~/Nexus/i) {
$npc->CastSpell(2943, $client->GetID());
}
}

Digitala
01-18-2010, 05:57 PM
Thx Derision!

Been thinking.
Is there a way to maybe hold the cast for awhile?
Like /pause in a macro. So that wen the player asks for the port
the npc will que the cast for, lets say 30 sec?

Just trying to figgur something out.

nilbog
01-18-2010, 06:09 PM
castspell should retain the casting time of the spell, but for other uses you can add timers

this should wait 10 seconds before starting the casting time of the translocate

sub EVENT_SAY {
if ($text=~/whatever/i) {
quest::stoptimer("port");
quest::settimer("port",10);
}
}

sub_EVENT_TIMER {
if($timer eq "port") {
quest::stoptimer("port");
$npc->CastSpell(2943, $client->GetID());
}
}

Digitala
01-18-2010, 06:15 PM
Awsome nilbog

Gonna try that one out =)
Thx!