View Full Version : Quest timers
Andrew80k
04-03-2008, 11:08 PM
I'm looking for a good example of a quest that has an NPC shout something periodically. Can someone suggest one to look at?
Thanks.
AndMetal
04-04-2008, 12:26 AM
This is a pretty basic example:
sub EVENT_SPAWN {
quest::settimer("repeat", 60); // First trigger after 60 seconds
}
sub EVENT_TIMER {
if ($timer eq "repeat") {
quest::stoptimer("repeat");
quest::shout("I fart in your general direction! Your mother was a hamster and your father smelt of elderberries!");
quest::settimer("repeat", 60); // Keep repeating every 60 seconds
}
}
Zone Reset Quest on a Timer (http://www.eqemulator.net/forums/showthread.php?t=24485) can be useful as a general reference, but the idea is to clear the timer & restart it. You could also use quest::ChooseRandom to make the repeated text a little more random (90 seconds vs 60, etc):
quest::settimer("repeat", quest::ChooseRandom(60, 60, 90));
That would give a little better odds for it to take 60 seconds, but sometimes take 90 seconds.
Another cool thing is that you can change quest::shout to quest::shout2, and it will shout across ALL zones.
Hope this does what you're looking for.
trevius
04-04-2008, 05:58 AM
You can find examples of this and many other quest examples in GeorgeS' quest tool from his website.
http://66.159.225.58/eqemu/eq.html
So_1337
04-04-2008, 09:43 AM
Just a quick note... If you don't stop the timer when it triggers, you don't have to reset it. So the code for that can be even shorter:
sub EVENT_SPAWN {
quest::settimer("repeat", 60); // First trigger after 60 seconds, and every 60 seconds after
}
sub EVENT_TIMER {
if ($timer eq "repeat") {
quest::shout("I fart in your general direction! Your mother was a hamster and your father smelt of elderberries!");
}
}
Andrew80k
04-04-2008, 09:58 AM
Just a quick note... If you don't stop the timer when it triggers, you don't have to reset it. So the code for that can be even shorter:
sub EVENT_SPAWN {
quest::settimer("repeat", 60); // First trigger after 60 seconds, and every 60 seconds after
}
sub EVENT_TIMER {
if ($timer eq "repeat") {
quest::shout("I fart in your general direction! Your mother was a hamster and your father smelt of elderberries!");
}
}
Awesome this will help me finish up Corun in Surefall.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.