Log in

View Full Version : Timer issue


Traul
09-10-2014, 09:47 PM
Hi there, I'm trying to create a template to allow a change in how my named spawns work. I want the nameds to be guaranteed to spawn every, say, hour whether or not the spawngroup is being killed or not. I was trying to get it to work for the ghoul executioner in Lower Guk with no luck. Here's what I got:



sub EVENT_DEATH {
quest::enable_spawn2(1622);
quest::settimer("a_ghoul_executioner", 3600);
}

sub EVENT_TIMER {

if($timer eq "a_ghoul_executioner") {
quest::disable_spawn2(1622);
quest::spawn2(66146,0,0,-890,622,-203,53.5);
}

}



So upon death, the timer starts, and an hour later whatever is spawned will depop and the ghoul executioner will spawn in its place. That spawngroup then turns off until the ghoul executioner is killed again. But my code doesn't work at all. Does the timer only work if the NPC is alive?

The idea is so nameds will spawn guaranteed every hour but can still be camped for extra chances to spawn in between.

joligario
09-10-2014, 11:09 PM
First, you should use EVENT_DEATH_COMPLETE. After that sub runs, the system destroys the NPC, so the timer won't run anyways. Looking at what you have, maybe you want a controller NPC to use the timer or set the respawn timer instead.

Traul
09-13-2014, 03:40 PM
First, you should use EVENT_DEATH_COMPLETE. After that sub runs, the system destroys the NPC, so the timer won't run anyways. Looking at what you have, maybe you want a controller NPC to use the timer or set the respawn timer instead.

Thanks for the tip. So I tried doing it this way and I've got some weird stuff going on. Here's my two .pl files:

a_ghoul_executioner.pl

sub EVENT_DEATH_COMPLETE {
quest::enable_spawn2(9968);
quest::signalwith(66179,1);
}


controller.pl

sub EVENT_SIGNAL {
if($signal==1) {
quest::settimer("exec",60);
}
}

sub EVENT_TIMER {

if($timer eq "exec") {
quest::disable_spawn2(9968);
quest::spawn2(66092,0,0,-890,622,-203,53.5);
}

}


What happens is this:

-kill ghoul_executioner when it spawns naturally (timer starts)
-spawncycle continues normally
-once timer finishes, whatever was spawned depops and replaced by a ghoul_executioner
-kill executioner (timer started)
-spawncycle doesn't continue as normal, enable_spawn doesn't seem to have worked
-timer finishes, executioner spawns, zone crashes

So the zone crashes for some crazy reason, with the logs showing this:

---------------------------------------------
[09.11. - 15:21:58] Starting Log: logs/crash_zone_6556.log
[09.11. - 15:21:58] EXCEPTION_ACCESS_VIOLATION
[09.11. - 15:21:58] SymInit: Symbol-SearchPath: '.;C:\EQ\EQEmuServer;C:\EQ\EQEmuServer;C:\WINDOWS; C:\WINDOWS\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 530, UserName: '----'
[09.11. - 15:21:58] OS-Version: 6.2.9200 () 0x100-0x1
[09.11. - 15:21:58] C:\EQ\EQEmuServer\zone.exe:zone.exe (00E50000), size: 28884992 (result: 0), SymType: 'PDB', PDB: 'C:\EQ\EQEmuServer\zone.exe'
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\ntdll.dll:ntdll.dll (77380000), size: 1404928 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\ntdll.dll', fileVersion: 6.2.9200.16912
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\KERNEL32.DLL:KERNEL32.DLL (74BC0000), size: 1245184 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\KERNEL32.DLL', fileVersion: 6.2.9200.16859
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\KERNELBASE.dll:KERNELBASE.dll (76930000), size: 684032 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\KERNELBASE.dll', fileVersion: 6.2.9200.16864
[09.11. - 15:21:58] C:\WINDOWS\system32\apphelp.dll:apphelp.dll (66990000), size: 684032 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\apphelp.dll', fileVersion: 6.2.9200.16420
[09.11. - 15:21:58] C:\WINDOWS\AppPatch\AcLayers.DLL:AcLayers.DLL (726B0000), size: 2555904 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\AppPatch\AcLayers.DLL', fileVersion: 6.2.9200.16420
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\msvcrt.dll:msvcrt.dll (76850000), size: 724992 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\msvcrt.dll', fileVersion: 7.0.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\USER32.dll:USER32.dll (74AA0000), size: 1138688 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\USER32.dll', fileVersion: 6.2.9200.16420
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\GDI32.dll:GDI32.dll (76DD0000), size: 1036288 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\GDI32.dll', fileVersion: 6.2.9200.17053
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\SHELL32.dll:SHELL32.dll (75780000), size: 17588224 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\SHELL32.dll', fileVersion: 6.2.9200.16882
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\SHLWAPI.dll:SHLWAPI.dll (770F0000), size: 262144 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\SHLWAPI.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\OLEAUT32.dll:OLEAUT32.dll (77130000), size: 569344 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\OLEAUT32.dll', fileVersion: 6.2.9200.16726
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\MPR.dll:MPR.dll (72940000), size: 77824 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\MPR.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\SETUPAPI.dll:SETUPAPI.dll (75440000), size: 1765376 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\SETUPAPI.dll', fileVersion: 6.2.9200.16496
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\sfc.dll:sfc.dll (72690000), size: 12288 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\sfc.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\WINSPOOL.DRV:WINSPOOL.DRV (74890000), size: 393216 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\WINSPOOL.DRV', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\RPCRT4.dll:RPCRT4.dll (77210000), size: 704512 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\RPCRT4.dll', fileVersion: 6.2.9200.17037
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\combase.dll:combase.dll (76C70000), size: 1269760 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\combase.dll', fileVersion: 6.2.9200.16420
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\CFGMGR32.dll:CFGMGR32.dll (74A30000), size: 286720 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\CFGMGR32.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\DEVOBJ.dll:DEVOBJ.dll (74FA0000), size: 122880 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\DEVOBJ.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\SspiCli.dll:SspiCli.dll (74970000), size: 118784 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\SspiCli.dll', fileVersion: 6.2.9200.16864
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\sfc_os.DLL:sfc_os.DLL (726A0000), size: 57344 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\sfc_os.DLL', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\CRYPTBASE.dll:CRYPTBASE.dll (74960000), size: 36864 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\CRYPTBASE.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\sechost.dll:sechost.dll (74990000), size: 212992 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\sechost.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\bcryptPrimitives.dll:bcryptPri mitives.dll (74900000), size: 331776 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\bcryptPrimitives.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\system32\IMM32.DLL:IMM32.DLL (74FC0000), size: 131072 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\IMM32.DLL', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\MSCTF.dll:MSCTF.dll (75100000), size: 909312 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\MSCTF.dll', fileVersion: 6.2.9200.16578
[09.11. - 15:21:58] C:\Perl\bin\perl512.dll:perl512.dll (28000000), size: 1273856 (result: 0), SymType: '-exported-', PDB: 'C:\Perl\bin\perl512.dll', fileVersion: 5.12.3.1204
[09.11. - 15:21:58] C:\Program Files (x86)\Lua\5.1\lua51.dll:lua51.dll (10000000), size: 24576 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Lua\5.1\lua51.dll', fileVersion: 5.1.4.0
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\WS2_32.dll:WS2_32.dll (771C0000), size: 327680 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\WS2_32.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\VERSION.dll:VERSION.dll (748F0000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\VERSION.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\ADVAPI32.dll:ADVAPI32.dll (751E0000), size: 712704 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\ADVAPI32.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9200.16658_none_bf1 359a245f1cd12\COMCTL32.dll:COMCTL32.dll (730C0000), size: 552960 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.9200.16658_none_bf1 359a245f1cd12\COMCTL32.dll', fileVersion: 5.82.9200.16657
[09.11. - 15:21:58] C:\EQ\EQEmuServer\lua5.1.dll:lua5.1.dll (00D40000), size: 167936 (result: 0), SymType: '-exported-', PDB: 'C:\EQ\EQEmuServer\lua5.1.dll', fileVersion: 5.1.4.0
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\NSI.dll:NSI.dll (75290000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\NSI.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a 1e18e3b_8.0.50727.6910_none_d089c358442de345\MSVCR 80.dll:MSVCR80.dll (744A0000), size: 634880 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9 a1e18e3b_8.0.50727.6910_none_d089c358442de345\MSVC R80.dll', fileVersion: 8.0.50727.6910
[09.11. - 15:21:58] C:\WINDOWS\system32\napinsp.dll:napinsp.dll (73230000), size: 65536 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\napinsp.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\system32\pnrpnsp.dll:pnrpnsp.dll (731F0000), size: 81920 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\pnrpnsp.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\WINDOWS\system32\NLAapi.dll:NLAapi.dll (731D0000), size: 65536 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\system32\NLAapi.dll', fileVersion: 6.2.9200.16518
[09.11. - 15:21:58] C:\WINDOWS\System32\mswsock.dll:mswsock.dll (74650000), size: 303104 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\mswsock.dll', fileVersion: 6.2.9200.16433
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\DNSAPI.dll:DNSAPI.dll (73910000), size: 479232 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\DNSAPI.dll', fileVersion: 6.2.9200.16420
[09.11. - 15:21:58] C:\WINDOWS\System32\winrnr.dll:winrnr.dll (73190000), size: 36864 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\winrnr.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\Program Files (x86)\Bonjour\mdnsNSP.dll:mdnsNSP.dll (73290000), size: 135168 (result: 0), SymType: '-exported-', PDB: 'C:\Program Files (x86)\Bonjour\mdnsNSP.dll', fileVersion: 3.0.0.10
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\Iphlpapi.DLL:Iphlpapi.DLL (735B0000), size: 131072 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\Iphlpapi.DLL', fileVersion: 6.2.9200.16420
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\WINNSI.DLL:WINNSI.DLL (733F0000), size: 32768 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\WINNSI.DLL', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\Windows\System32\rasadhlp.dll:rasadhlp.dll (73280000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Windows\System32\rasadhlp.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] C:\Perl\lib\auto\Cwd\Cwd.dll:Cwd.dll (02A90000), size: 20480 (result: 0), SymType: '-exported-', PDB: 'C:\Perl\lib\auto\Cwd\Cwd.dll'
[09.11. - 15:21:58] C:\Perl\lib\auto\DBI\DBI.dll:DBI.dll (02AA0000), size: 98304 (result: 0), SymType: '-exported-', PDB: 'C:\Perl\lib\auto\DBI\DBI.dll'
[09.11. - 15:21:58] C:\Perl\lib\auto\List\Util\Util.dll:Util.dll (02AC0000), size: 28672 (result: 0), SymType: '-exported-', PDB: 'C:\Perl\lib\auto\List\Util\Util.dll'
[09.11. - 15:21:58] C:\Perl\lib\auto\Filter\Util\Call\Call.dll:Call.dl l (04500000), size: 20480 (result: 0), SymType: '-exported-', PDB: 'C:\Perl\lib\auto\Filter\Util\Call\Call.dll'
[09.11. - 15:21:58] C:\Perl\lib\auto\IO\IO.dll:IO.dll (04510000), size: 24576 (result: 0), SymType: '-exported-', PDB: 'C:\Perl\lib\auto\IO\IO.dll'
[09.11. - 15:21:58] C:\WINDOWS\System32\fwpuclnt.dll:fwpuclnt.dll (73240000), size: 258048 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\fwpuclnt.dll', fileVersion: 6.2.9200.16634
[09.11. - 15:21:58] C:\WINDOWS\SYSTEM32\dbghelp.dll:dbghelp.dll (71640000), size: 1216512 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\dbghelp.dll', fileVersion: 6.2.9200.16384
[09.11. - 15:21:58] c:\eq\source\zone\spawn2.cpp (248): Spawn2::Disable
[09.11. - 15:21:58] c:\eq\source\zone\worldserver.cpp (1530): WorldServer::Process
[09.11. - 15:21:58] c:\eq\source\zone\net.cpp (350): main
[09.11. - 15:21:58] f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (278): __tmainCRTStartup
[09.11. - 15:21:58] f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (189): mainCRTStartup
[09.11. - 15:21:58] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 74BE86E3)
[09.11. - 15:21:58] 74BE86E3 (KERNEL32): (filename not available): BaseThreadInitThunk
[09.11. - 15:21:58] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 773DBE99)
[09.11. - 15:21:58] 773DBE99 (ntdll): (filename not available): RtlInitializeExceptionChain
[09.11. - 15:21:58] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 773DBE6C)
[09.11. - 15:21:58] 773DBE6C (ntdll): (filename not available): RtlInitializeExceptionChain


Any idea what could be going on here??? :confused:

rencro
09-14-2014, 01:51 PM
Looks like the ghoul_executioner is activating on death an already running spawn2 condition, perhaps this is gumming up the works.

Possible solution is to make a copy of the a_ghoul_executioner npc of 66092, which would become I assume on your server perhaps 66180 since your controller npc is 66179, then use that in your controller script as the spawned npc. Rename the a_ghoul_executioner.pl to 66180.pl, but remove the signalling of the controller npc part. Also create a 66092.pl (the original a ghoul executioner) and set an event based on death as before to signal the controller mob, but to NOT modify the spawn conditions.

When the original a_ghoul_executioner(66092) is killed, the controller mob is signaled, but the existing spawn2 conditions are not modified, then when the new a_ghoul_executioner spawns, it is the 66180 version, and on death, will re-enable the original spawn2 condition that the controller npc turned off after the timer expired.

Would look like this:

66092.pl (original npc id of executioner)

sub EVENT_DEATH_COMPLETE {
quest::signalwith(66179,1);
}


66180.pl (or whatever the new npc id of the copied executioner is)

sub EVENT_DEATH_COMPLETE {
quest::enable_spawn2(9968);
}


controller.pl

sub EVENT_SIGNAL {
if($signal==1) {
quest::settimer("exec",60);
}
}

sub EVENT_TIMER {

if($timer eq "exec") {
quest::disable_spawn2(9968);
quest::spawn2(66180,0,0,-890,622,-203,53.5);
}

}


This keeps the spirit of your original idea instead of just changing the spawn timer for that spawn group.

I have not tried this myself to verify though, but if I see no response I will build in on my test rig and test it either tomorrow or the next day..

Traul
09-14-2014, 02:49 PM
Looks like the ghoul_executioner is activating on death an already running spawn2 condition, perhaps this is gumming up the works.

Possible solution is to make a copy of the a_ghoul_executioner npc of 66092, which would become I assume on your server perhaps 66180 since your controller npc is 66179, then use that in your controller script as the spawned npc. Rename the a_ghoul_executioner.pl to 66180.pl, but remove the signalling of the controller npc part. Also create a 66092.pl (the original a ghoul executioner) and set an event based on death as before to signal the controller mob, but to NOT modify the spawn conditions.

When the original a_ghoul_executioner(66092) is killed, the controller mob is signaled, but the existing spawn2 conditions are not modified, then when the new a_ghoul_executioner spawns, it is the 66180 version, and on death, will re-enable the original spawn2 condition that the controller npc turned off after the timer expired.

Would look like this:

66092.pl (original npc id of executioner)

sub EVENT_DEATH_COMPLETE {
quest::signalwith(66179,1);
}


66180.pl (or whatever the new npc id of the copied executioner is)

sub EVENT_DEATH_COMPLETE {
quest::enable_spawn2(9968);
}


controller.pl

sub EVENT_SIGNAL {
if($signal==1) {
quest::settimer("exec",60);
}
}

sub EVENT_TIMER {

if($timer eq "exec") {
quest::disable_spawn2(9968);
quest::spawn2(66180,0,0,-890,622,-203,53.5);
}

}


This keeps the spirit of your original idea instead of just changing the spawn timer for that spawn group.

I have not tried this myself to verify though, but if I see no response I will build in on my test rig and test it either tomorrow or the next day..

That's awesome, that almost fixed everything. I had to add a stoptimer function to the controller. The only issue now though is the spawncycle is activated but it won't start popping until I do a #repop.

Thanks for the help so far!

chrsschb
09-14-2014, 03:16 PM
Why don't you just handle the entire spawn cycle with the controller?

You're already basically doing it. Have the timer setup so that it runs through a timer chain:


timer1 18 mins, spawns random mob, signals controller, starts timer 2
timer2 18 mins, spawns random mob, signals controller, starts timer 3
timer3 18 mins, guaranteed executioner, starts timer 1

The caveat is that if an executioner spawns in timer1 or timer2 it signals the controller to stop the current timer and restart at timer 1.

Don't have time to write out the code but you get the idea. This would be easy to copy and paste for multiple NPCs / controllers.

Traul
09-14-2014, 04:50 PM
Why don't you just handle the entire spawn cycle with the controller?

You're already basically doing it. Have the timer setup so that it runs through a timer chain:


timer1 18 mins, spawns random mob, signals controller, starts timer 2
timer2 18 mins, spawns random mob, signals controller, starts timer 3
timer3 18 mins, guaranteed executioner, starts timer 1

The caveat is that if an executioner spawns in timer1 or timer2 it signals the controller to stop the current timer and restart at timer 1.

Don't have time to write out the code but you get the idea. This would be easy to copy and paste for multiple NPCs / controllers.

I like this idea, but wouldn't I have to have separate mobs for each chain firing off the timers? Otherwise you'd have multiple spawns on the same point if they aren't being killed. Or maybe I'm misunderstanding here

chrsschb
09-14-2014, 09:11 PM
Eh ignore my post earlier, I was rushing. I'll get something up if no one beats me to it.

chrsschb
09-14-2014, 09:47 PM
K, so in order for this to work each NPC in the spawn cycle needs to be unique to that spawn cycle. Other wise random NPCs in the zone will signal the controller and mess up the cycle.

Cycle assumes a 10 minute respawn timer and will spawn a named on the 6th spawn guaranteed.


#Each NPC in Spawn Cycle including Named

sub EVENT_DEATH {
#Replace with NPCID of Controller
quest::signalwith(npcid, 1);
}



#Controller
#Script assumes spawn cycle is 10 minutes
#Script assumes controller is the physical location of the spawned npc

sub EVENT_SPAWN {
$counter == 0;
#Replace with NPCIDs of Place Holders AND Named NPC
quest::spawn2(quest::ChooseRandom(npcid,npcid,npci d),0,0,$x,$y,$z,$h);
}

sub EVENT_TIMER {
if($timer eq "NPCID_SpawnCycle"); {
#Replace with NPCIDs of Place Holders AND Named NPC
quest::spawn2(quest::ChooseRandom(npcid,npcid,npci d),0,0,$x,$y,$z,$h);
quest::stoptimer("NPCID_SpawnCycle");
}
elsif($timer eq "NPCID_Spawned"); {
#Replace with NPCID of Named NPC
quest::spawn2(npcid,0,0,$x,$y,$z,$h);
quest::stoptimer("NPCID_Spawned");
}
}

sub EVENT_SIGNAL {
my $globalname = "NPCID_Controller";
if ($signal == 1) {
$counter +=1;
if (!defined $qglobals($globalname) && ($counter <= 5)) {
quest::starttimer("NPCID_SpawnCycle",600);
}
elsif (!defined $qglobals($globalname) && ($counter == 6)) {
quest::starttimer("NPCID_Spawned",600);
$counter == 0;
}
}
}



In the chooserandom to make the named more rare, put more placeholder ids in there. So for a 10% spawn chance you'd need 10 ids in the parenthesis.

This also assumes people are actively killing the spawn. IE this replicates a regular spawn cycle except with a guaranteed named at least once per hour.

Traul
09-18-2014, 09:14 AM
Thanks for the solution chrsschb, wow to decide if doing this for every single named spawn is going to be worth the work :)

chrsschb
09-18-2014, 10:52 AM
Thanks for the solution chrsschb, wow to decide if doing this for every single named spawn is going to be worth the work :)

I'm sure our much more talented developers could come up with a better solution, but it's a start at least. I make my people sit and wait so never really put much thought into it lol.