-- based off of NVZRR code, specifically mutant randomization -- thanx to sickie for providing the formula and chances local MutantTable = { -- T1 {"Crawler", 1}, {"Puncher", 3}, {"Twohead", 5}, {"Spitter", 8}, -- T2 {"Exploder", 10}, {"Mindflayer", 12}, {"Imitator", 14}, {"Armzooka", 19}, {"Plague", 20}, -- T3 {"Stalker", 50}, {"Abominable", 80}, {"Freak", 90}, {"Demolisher", 100}, {"Puker", 110}, {"Crusher", 120}, {"Spewer", 140}, -- T4 {"Nest", 200}, {"Sprayer", 250}, {"Juggernaut", 400}, -- T5 / Mold {"Mold", 500}, -- mold is 800 on maps w/o dedicated spawns } -- added for simplicity local VictimAlive = true local VictimIsPlayer = true local VictimMaxHealth = 100 local VictimAttacking = false local PlayerRank = 25 function CheckRoll(RollValue) -- formula as stated on the nvzrr wiki if VictimAlive == true then RollValue = RollValue * 0.75 end if VictimIsPlayer == true then RollValue = RollValue * (1 - (PlayerRank * 0.008)) end RollValue = RollValue * math.clamp(((1500 - VictimMaxHealth) * 0.008), 0.35, 1) if VictimIsPlayer == false and VictimAlive == true and VictimAttacking == false then RollValue = RollValue * 1.1 end if VictimIsPlayer == false then RollValue = RollValue * 1.15 end return RollValue end function RandomizeValues() -- ignore this i'm lazy local Randomizer = math.random(1,2) if Randomizer == 2 then VictimAlive = true else VictimAlive = false end Randomizer = math.random(1,2) if Randomizer == 2 then VictimIsPlayer = true else VictimIsPlayer = false end Randomizer = math.random(1,2) if Randomizer == 2 then VictimIsPlayer = true else VictimIsPlayer = false end Randomizer = math.random(1, 25) PlayerRank = Randomizer if VictimIsPlayer == false then PlayerRank = 1 end Randomizer = math.random(1,2) if Randomizer == 2 then VictimAttacking = true else VictimAttacking = false end Randomizer = math.random(1,1500) VictimMaxHealth = Randomizer end for count = 1, 250 do for i, MutantRoll in pairs(MutantTable) do RandomizeValues() local DiceRoll = CheckRoll(math.random(1, MutantRoll[2]) * MutantRoll[2]) if DiceRoll <= MutantRoll[2] then print("Spawning in " .. MutantRoll[1] .. " mutant of rarity " .. MutantRoll[2]) break end end task.wait() end -- works in roblox studio