I use this script to simulate a random spawn time for invisible spawners in the same spawngroup. This way I didn't have to make 5 different NPCs and 5 different scripts all with different timers. Even then each invisible spawner will be a set time causing each spot to always spawn its npcs the same time every respawn.
So I make 1 invisible npc to be the spawner and add multiples to the spawn group and they will all random the spawn times.
Imagine it could be used in many ways.
Code:
#Spawn Sequence
#Set timer
#When Timer hits
#Choose random timer
#When random timer hits
#Choose random spawn
#
sub EVENT_SPAWN {
quest::settimer(1, 40);
}
sub EVENT_TIMER {
my $Rndtime = quest::ChooseRandom(1,2,3);
my $Spawn = quest::ChooseRandom(1,2,3,4,5,6);
if($timer == 1) {
if($Rndtime == 1){
quest::settimer(2, 5);
}
if($Rndtime == 2){
quest::settimer(3, 15);
}
if($Rndtime == 3){
quest::settimer(4, 25);
}
}
if($timer == 2) {
if($Spawn == 1) {
quest::spawn2(1000300,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 2) {
quest::spawn2(1000305,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 3) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 4) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 5) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 6) {
quest::spawn2(1000300,0,0,$x,$y,$z,0);
#object
}
quest::stoptimer(2);
}
if($timer == 3) {
if($Spawn == 1) {
quest::spawn2(1000300,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 2) {
quest::spawn2(1000305,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 3) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 4) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 5) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 6) {
quest::spawn2(1000300,0,0,$x,$y,$z,0);
#object
}
quest::stoptimer(3);
}
if($timer == 4) {
if($Spawn == 1) {
quest::spawn2(1000300,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 2) {
quest::spawn2(1000305,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 3) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 4) {
quest::spawn2(1000306,0,0,$x,$y,$z,0);
#object
}
elsif($Spawn == 5) {
#object
}
elsif($Spawn == 6) {
quest::spawn2(1000300,0,0,$x,$y,$z,0);
#object
}
quest::stoptimer(4);
}
}