EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Time limit on zone (https://www.eqemulator.org/forums/showthread.php?t=27931)

Randymarsh9 04-17-2009 11:41 AM

Time limit on zone
 
How would I make a quest that did this: I want a timer to start when the person zones in, and then 10 minutes later kick them back to Pok. I don't know where I would put that quest if I wrote it.

cavedude 04-17-2009 12:19 PM

Easily done. You'd use player.pl, and set a 10 minute timer under sub EVENT_ENTERZONE. Then, under sub EVENT_TIMER when it expires, move them to PoK. The timer would be on the individual player, so you will have multiple timers going at once for multiple players.

Randymarsh9 04-17-2009 12:35 PM

So, basically would it be something like this:
Code:

sub EVENT_ENTERZONE{
quest::settimer("zonekick",30);
}
sub EVENT_TIMER{
if ($timer eq "zonekick"){
 quest::stoptimer("zonekick");
 quest::movepc(202, -107,-190.-156);
 }
}

I have never used timers in any quests before, so I'm not sure what I'm doing

cavedude 04-17-2009 12:47 PM

Yep, that's exactly it, except that timer is for 30 seconds.

Randymarsh9 04-17-2009 12:50 PM

Haha, yeah because I was planning on testing it and didn't want to wait 10 minutes to see if it ported me.

cavedude 04-17-2009 01:06 PM

Yeah I do the same. :)

Randymarsh9 04-17-2009 01:53 PM

Another quick question, if I wanted a monster to spawn based on the person's class that enters the zone, would I just do something like if
Code:

if ($class eq "Warrior"){
quest::spawn(ID,0,0,x,y,z)
}

in the sub event_enterzone and repeat that for other classes using elsif?

cavedude 04-17-2009 02:57 PM

I see no reason why that wouldn't work.

Randymarsh9 04-17-2009 07:25 PM

Alright, I don't think my timers are working. In the player.pl I made it like this
Code:

sub EVENT_ENTERZONE{
quest::settimer("zonekick",10);
quest::ze("You have 10 minutes to finish.");
if ($class eq "Warrior"){
 quest::spawn(1207, 0, 0, 0, 0, 0.50);
}
elsif ($class eq "Ranger"){
 quest::spawn(1214, 0, 0, 0, 0, 0.50);
}
}
sub EVENT_TIMER{
if ($timer eq "zonekick"){
 quest::stoptimer("zonekick");
 quest::movepc(202, -107,-190.-156);
 }
}
sub EVENT_DEATH{
quest::depopzone(1);
}

The correct monsters are spawning based on the class, which is good, but the zone-wide emote doesn't show and the timer doesn't seem to work either. I lowered it to 10 seconds just so I could test it. I have this is another quest and the timer doesn't work here either.
Code:

EVENT_SPAWN{
 quest::attack($name);
}
sub EVENT_DEATH{
 quest::summonitem(20488);
 quest::summonitem(20487);
 quest::emote("collapses to the ground.");
 quest::settimer("peaceout",5);
}
sub EVENT_TIMER{
 if ($timer eq "peaceout"){
 quest::stoptimer("peaceout");
 quest::movepc(202, -107,-190.-156);
}
}


joligario 04-17-2009 09:17 PM

Are you sure the timer isn't working? Or could it be the period instead of a comma in the movepc() commands?

joligario 04-17-2009 09:23 PM

quest::ze ?

Randymarsh9 04-17-2009 09:36 PM

I fixed the commas thing, but its still not working. Now the monsters arent even spawning when I zone in.

joligario 04-17-2009 09:40 PM

Hopefully you didn't change the periods in the spawn() statements. Only the movepc() statements.

Did you change anything else or is it still the same script as above?

Randymarsh9 04-17-2009 09:51 PM

Same, just changed the commas in the timers.

joligario 04-18-2009 08:59 AM

Is the zone static? I am not sure if once it triggers, it will allow it to trigger again if the zone is still up. I've never tried.

Randymarsh9 04-18-2009 09:00 AM

No, it's not static.

covou 04-18-2009 02:17 PM

Quote:

Originally Posted by Randymarsh9 (Post 167819)
Alright, I don't think my timers are working. In the player.pl I made it like this
Code:

sub EVENT_ENTERZONE{
quest::settimer("zonekick",10);
quest::ze("You have 10 minutes to finish.");
if ($class eq "Warrior"){
 quest::spawn(1207, 0, 0, 0, 0, 0.50);
}
elsif ($class eq "Ranger"){
 quest::spawn(1214, 0, 0, 0, 0, 0.50);
}
}
sub EVENT_TIMER{
if ($timer eq "zonekick"){
 quest::stoptimer("zonekick");
 quest::movepc(202, -107,-190.-156);
 }
}
sub EVENT_DEATH{
quest::depopzone(1);
}

The correct monsters are spawning based on the class, which is good, but the zone-wide emote doesn't show and the timer doesn't seem to work either. I lowered it to 10 seconds just so I could test it. I have this is another quest and the timer doesn't work here either.
Code:

EVENT_SPAWN{
 quest::attack($name);
}
sub EVENT_DEATH{
 quest::summonitem(20488);
 quest::summonitem(20487);
 quest::emote("collapses to the ground.");
 quest::settimer("peaceout",5);
}
sub EVENT_TIMER{
 if ($timer eq "peaceout"){
 quest::stoptimer("peaceout");
 quest::movepc(202, -107,-190.-156);
}
}


The timer in your monster code won't work because an npc will not set, and persist a timer if it is dead.

as for your player code... try this.

Code:

sub EVENT_ENTERZONE
{
quest::settimer("zonekick",10);
quest::ze("You have 10 minutes to finish.");
  if ($class eq "Warrior")
      {
      quest::spawn(1207, 0, 0, 0, 0, 0.50);
      }
  elsif ($class eq "Ranger")
      {
      quest::spawn(1214, 0, 0, 0, 0, 0.50);
      }
}
sub EVENT_TIMER{
if ($timer eq "zonekick"){
 quest::stoptimer("zonekick");
 quest::movepc(202, -107, -190, -156);
 }
}
sub EVENT_DEATH{
quest::stoptimer("zonekick");
quest::depopzone();
}

If it continues not to work. Can you post Error Logs?

BWStripes 04-22-2009 06:46 PM

Just a minor thing error with the quest documentation I discovered I was digging in questmgr.cpp - quest::ze needs to be in the format:
quest::ze(#colourid, "Message");

Then it works, same with quest::we (world emote). 15 is yellow text, FYI, so
quest::we(15, "You hear wispers on the wind, that becon you to the Karanas");

Will print exactly that on all clients connected to world in yellow. It uses the same function as the GM command: #emote <name|world|zone> <#colourid> <message>

cavedude 04-22-2009 08:15 PM

Quote:

Originally Posted by BWStripes (Post 168100)
Just a minor thing error with the quest documentation I discovered I was digging in questmgr.cpp - quest::ze needs to be in the format:
quest::ze(#colourid, "Message");

Then it works, same with quest::we (world emote). 15 is yellow text, FYI, so
quest::we(15, "You hear wispers on the wind, that becon you to the Karanas");

Will print exactly that on all clients connected to world in yellow. It uses the same function as the GM command: #emote <name|world|zone> <#colourid> <message>

I'll add that to the wiki, good catch!


All times are GMT -4. The time now is 07:11 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.