View Full Version : Zone Repop script
Aonelyn
05-19-2008, 11:47 AM
Okay, another quest.
Once an npc is hailed, the entire zone will repop 45 minutes later.
is that even possible?
Cripp
05-19-2008, 11:56 AM
im not sure if there is any quest function that repops or depops the whole zone..
but it would go something like this..
sub EVENT_SAY
{
if ($text=~/hail/i)
{
quest::say("Hail $name!");
if (!defined($qglobals{$zonerepop}))
{
quest::say("zone will depop in 45 mins!");
quest::settimer("zrepop",823421);
quest::setglobal("zonerepop",1,0,M45);
}
}
}
sub EVENT_TIMER
{
if ($timer eq "zrepop")
{
quest::ZONE_REPOP_COMMAND();
quest::delglobal("zonerepop");
}
}
note.. used the global var so the timer can only be triggered once while its timing.. not sure if it would be required but would be how i would have done it :)
AndMetal
05-19-2008, 04:45 PM
Depoping & repoping of the zone was added in one of the more recent versions of the Emu. From the Wiki (http://www.eqemulator.net/wiki/wikka.php?wakka=QuestTutorial):
quest::depopall(npcid) - Depops every instance of the npc in the zone (quest::depop(npcid)) only will do one NPC at a time.)
quest::depopzone(1 or 0) - Depops every npc in the zone. 0 disables the NPCs' spawn timers so they will not repop on their own. 1 allows them to spawn as normal once their timers are up. This argument is required!
quest::repopzone() - Repops the zone, in the same way the command #repop does. It will also re-enable spawn timers if disabled.
So just replace quest::ZONE_REPOP_COMMAND() with quest::repopzone() and you'll be good to go. The big thing to keep in mind, though (depending on what you're really trying to do) is the respawn timers for individual NPCs. For example, if a mob has a 3 day respawn timer & you repop the zone, it still won't respawn until after the 3 days is up.
On a side note, I went through and updated that Wiki entry about a week ago with all of the commands & descriptions from the 1108 source, so it should be fairly complete, especially compared to the somewhat outdated Lexicon (http://www.eqemulator.net/forums/showthread.php?t=18208) (which I used to use).
cavedude
05-19-2008, 05:10 PM
Actually, you don't need to worry about spawn timers with quest::repopzone(). That command doesn't touch timers at all, so any NPC that was up before the command was used will appear after. This is useful for stat changes, or to reset every NPC to their default positions. quest::depopzone(1) will reset all NPCs to an unspawned state, and in that case you'll have to wait for their timers to expire before they pop back up.
AndMetal
05-19-2008, 05:27 PM
Actually, you don't need to worry about spawn timers with quest::repopzone(). That command doesn't touch timers at all, so any NPC that was up before the command was used will appear after. This is useful for stat changes, or to reset every NPC to their default positions. quest::depopzone(1) will reset all NPCs to an unspawned state, and in that case you'll have to wait for their timers to expire before they pop back up.
I think what I said may have been a little confusing. Let me rephrase...
Example 1 (what I was thinking):
Zone into the sleeper. Kill a regular mob, which has a 4 hour (14400 second) respawn as defined in spawn2 (http://www.eqemulator.net/wiki/wikka.php?wakka=EQEmuDBSchemaspawn2) -> respawntime. Repop the zone, that mob won't respawn until the 4 hours is up (which is stored in spawn2 (http://www.eqemulator.net/wiki/wikka.php?wakka=EQEmuDBSchemaspawn2) -> timeleft).
Example 2 (what you're describing):
Zone into fearplane. Wait ~3.25 days (281232 seconds) +- ~9 hours for Cazic Thule to spawn. Repop the zone, he'll still be up.
So, you are correct, it doesn't touch spawn timers, but it also doesn't touch respawn timers, which is the only problem I've had. I'm not sure if there's a way in-game to avoid example 1, so what I did as a workaround (while testing quests) is run this query against my database to clear the timers:
UPDATE spawn2 SET timeleft = 0 WHERE spawngroupID IN (???, ???, ???)
of course replacing the ???'s with the applicable spawngroup ID.
Hopefully that made more sense.
Aonelyn
05-20-2008, 01:52 AM
thanks for the help guys, so how exactly would i write this to make it basically #repop the zone, after 45 mins of hailing the npc?
Cripp
05-20-2008, 10:09 AM
sub EVENT_SAY
{
if ($text=~/hail/i)
{
quest::say("Hail $name!");
if (!defined($qglobals{$zonerepop}))
{
quest::say("zone will depop in 45 mins!");
quest::settimer("zrepop",888888);
quest::setglobal("zonerepop",1,0,M45);
}
}
}
sub EVENT_TIMER
{
if ($timer eq "zrepop")
{
quest::repopzone();
quest::delglobal("zonerepop");
}
}
just change the 8888888 to whatever 45 minutes would be..
Aonelyn
05-20-2008, 11:08 AM
Thanks for all the help!
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.