PDA

View Full Version : Updating task during timer tick


provocating
09-10-2012, 04:31 PM
I am getting stuck on the very end of this task. Basically an ooze spawns from a different script, grows in size and then is supposed to despawn. After the despawn I need to manually update the task. If you look in my script I also have a death event. If I manually kill the ooze then the task does indeed update. How come I cannot update from the timer event ? Everything works except the task never updates unless I kill the ooze myself.

## Provocating - Dragons of Mist
## a_hungry_ooze_bud.pl

my $current_size=7;

sub EVENT_SPAWN {
quest::settimer("increase_size", 3);
}

sub EVENT_TIMER {
if($timer eq "increase_size") {
if ($current_size<25)
{
$current_size=$current_size+4;
quest::npcsize($current_size);
quest::say("The hungry ooze grows bigger and bigger as it continues to eat the bixie's jum jum silo!");
} else {
quest::say("The hungry ooze explodes as it devours all the jum jum in the silo!");
quest::updatetaskactivity(248, 3); # Bixie Menace: The Silo (#3)
quest::depop();
}
}
}

sub EVENT_DEATH{
quest::updatetaskactivity(248, 3); # Bixie Menace: The Silo (#3)
}

sorvani
09-10-2012, 05:57 PM
first thing that comes to mind is there is not active $client information in the EVENT_TIMER sub routine. How would the quest function know which client to update?

trevius
09-11-2012, 05:22 AM
Sorvani is exactly right. Since the timer event itself is triggered by a timer and not by a client, there is no way for it to know which client to update. Your best bet is probably to have the NPC send a signal to player.pl and then update your task from there for anyone that has it.

Basically, you would remove the line that updates the task activity and insteal put the line below:

$npc->SignalAllClients(1);

That will send a signal of 1 to all clients in the zone. Then, you would make a player.pl file and add the following sub:

player.pl
sub EVENT_SIGNAL {

if ($signal == 1)
{
my $IsTaskActive = quest::istaskactivityactive(248, 2);

if ($IsTaskActive == 1) {
quest::updatetaskactivity(248, 3);
}
}
}

I think that should do what you are wanting, but I didn't test it so you may need to work with it a little.

provocating
09-11-2012, 01:47 PM
Nothing seems to be working past the line that is now changed to...

$npc->SignalAllClients(1);

I am guessing there is something wrong there.

Here is what I have, if I leave it like this the mob never despawns. If I remark the new line out, he does despawn.

## Provocating - Dragons of Mist
## a_hungry_ooze_bud.pl

my $current_size=7;

sub EVENT_SPAWN {
quest::settimer("increase_size", 3);
}

sub EVENT_TIMER {
if($timer eq "increase_size") {
if ($current_size<25)
{
$current_size=$current_size+4;
quest::npcsize($current_size);
quest::say("The hungry ooze grows bigger and bigger as it continues to eat the bixie's jum jum silo!");
} else {
quest::say("The hungry ooze explodes as it devours all the jum jum in the silo!");
$npc->SignalAllClients(1);
quest::depop();
}
}
}

lerxst2112
09-11-2012, 05:23 PM
Should be $entity_list->SignalAllClients(1) from what I can tell.

provocating
09-11-2012, 09:13 PM
Woo hoo ! Worked like a champ, and I learned something new !