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.
Code:
#Each NPC in Spawn Cycle including Named
sub EVENT_DEATH {
#Replace with NPCID of Controller
quest::signalwith(npcid, 1);
}
Code:
#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,npcid),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,npcid),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.