PDA

View Full Version : Caster delay, I need help!


Angelox
01-06-2007, 11:36 AM
Can someone post an example of how to make a delay before quest::selfcast with quest::settimer or something else?
I've been stuck with this all day and nothing works for me :(

John Adams
01-06-2007, 04:11 PM
I did a search through the PLs for settimer, which I am sure you looked through as well. Below is the Dark Elf Corruptor script, showing his spawning as setting a 600 second countdown to despawn. Once the 600 seconds expires, EVENT_TIMER pops and removes the timer and the NPC.

# dark elf corruptor shouts before attacking
#

sub EVENT_SPAWN {
quest::shout("We come for you, fools. Your reign of weakness over the powers of the land comes to an end now!");
quest::settimer("despawn",600);
}

sub EVENT_TIMER {
quest::stoptimer("despawn");
quest::depop();
}

sub EVENT_DEATH {
quest::stoptimer("despawn");
}

# EOF zone: eastkarana ID: 15153 NPC: Dark_Elf_Corruptor

Can you set the settimer("castdelay",10) and then use the EVENT_TIMER to kill the timer, then cast the spell?

stoptimer("castdelay")
castspell($userid,spellid)

JrFaust
01-06-2007, 06:21 PM
This is what I came up with.
The subroutine HEALING is the only way I got a pause.
For what ever reason nesting quest::selfcast(spellid); and castspell($userid,spellid); in the sub EVENT_TIMER or even in a sub EVENT_SIGNAL it doesn't cast the spell.

#Test for pausing a selfcast script.
#This can be added to any spawn in any zone.
#This script shows several way we should be able to pause the quest::selfcast();

sub EVENT_SAY {
if ($text=~ /Hail/i) {
quest::say("Why hello there, $name! I can heal you.");
quest::settimer("healme",5); #This is a five second pause then the event timer call.
}
if ($text=~ /Hurt/i) {
quest::say("Why hello there, $name! Stand still for a few seconds this won't hurt much.");
quest::pause(30); #This should be a 30 second pause (but there isn't) then a heal.
quest::say("There sould be a pause then a heal."); #This is just a statement to see if the script is running.
quest::selfcast(6110);
}
if ($text =~ /Heal/i) {
$h = 0;
HEALING();
}
}

sub HEALING { #This works to get about a 10 second pause and it appears not to lag the server.
while ($h <= 30000000) {
#quest::say("$h");
$h ++;
}
quest::say("Direct sub call to heal."); #This is just a statement to see if the script is running.
quest::selfcast(6110);
}

sub EVENT_TIMER { #This is the event timer call but the selfcast won't work nested here for what ever reason.
if ($timername == "healme") {
quest::say("Timer call to heal."); #This is just a statement to see if the script is running.
quest::stoptimer("healme");
quest::selfcast(6110);
}
}

Cripp
01-07-2007, 05:24 AM
try theeees :D
sub EVENT_SAY
{
if ($text=~/Hail/i)
{
quest::say("Hail, $name");
}
if ($text=~/timeheal/i)
{
quest::settimer("theal1",15);
quest::say("poop init heal");
}
}

sub EVENT_TIMER
{
if ($timer eq "theal1")
{
quest::stoptimer("theal1");
$npc->CastSpell(6110,$client->CharacterID());
quest::say("healing you weee");
}
}

untested.. should work if not than just change the $client-> part probably....

JrFaust
01-07-2007, 05:39 AM
I got that to work with a change. Thanks Cripp!

What does -> do or what is it?

sub EVENT_SAY
{
if ($text=~/Hail/i)
{
quest::say("Hail, $name");
}
if ($text=~/timeheal/i)
{
quest::settimer("theal1",15);
quest::say("poop init heal");
}
}

sub EVENT_TIMER
{
if ($timer eq "theal1")
{
quest::stoptimer("theal1");
$npc->CastSpell(6110,$userid);
quest::say("healing you weee");
}
}

Angelox
01-07-2007, 09:08 AM
Thanks for the help you all, it's working fine for me now :)

markusdabrave
04-16-2015, 09:28 PM
Please remove this post. I was replying to another and didn't realize which tab I was in.