public void SpawnOneAtTier(CLRScriptBase s) { string Area = s.GetTag(s.GetArea(s.OBJECT_SELF)); int Tier = InfestedAreaLevels[Area]; if (Tier == MaxArea) { if (!RecentBossSpawn) { if (s.d20(1) == 1) { RecentBossSpawn = true; s.DelayCommand(s.HoursToSeconds(12), delegate { RecentBossSpawn = false; }); if (BossTemplate != String.Empty) { uint spawn = Spawn.SpawnCreature(BossTemplate, s); s.SetLocalString(spawn, InfestNameVar, this.InfestationName); s.SetLocalInt(spawn, InfestBossVar, 1); } } } else if (!RecentMiniBossSpawn) { if (s.d10(1) == 1) { RecentMiniBossSpawn = true; s.DelayCommand(s.HoursToSeconds(4), delegate { RecentMiniBossSpawn = false; }); if (MiniBoss.Count > 0) { int spawnNumber = new Random().Next(0, MiniBoss.Count); uint spawn = Spawn.SpawnCreature(MiniBoss[spawnNumber], s); s.SetLocalString(spawn, InfestNameVar, this.InfestationName); s.SetLocalInt(spawn, InfestBossVar, 1); } } } } int spawnNum = 1; int spawnTier = Tier; if (Tier == 2) { if (s.d2(1) == 1) { spawnNum = s.d3(1); spawnTier = 1; } } else if (Tier > 2) { switch (s.d3(1)) { case 1: spawnNum = s.d3(1); spawnTier--; break; case 2: spawnNum = s.d4(1) + 1; spawnTier -= 2; break; } } while (spawnNum > 0) { string rand = GetRandomSpawnAtTier(spawnTier); if (rand != "") { uint spawn = Spawn.SpawnCreature(rand, s); s.SetLocalString(spawn, InfestNameVar, this.InfestationName); } spawnNum -= 1; } }