All pastes #266933 Raw Edit

Anonymous

public lua v1 · immutable
·published 2006-12-04 14:37 UTC
rendered paste body
-- ChooseZombie = For randomly choosing a zombie type function ChooseZombie(zombie)	-- Calculate spawning chance tables	local spawnchance = {}	------* Normal/Alien zombie chance	--  Are we adept?	if (zombie:skill_find(150) == true) then		spawnchance[1] = { 5, 100 }		spawnchance[2] = { 5, 103 }	else		spawnchance[1] = { 50, 100 }		spawnchance[2] = { 25, 103 }	end	------* Flesh Zombie	spawnchance[3] = { 20, 102 }	------* Assassin Zombie	spawnchance[4] = { 8, 101 }		------* Devourer Zombie	spawnchance[5] = { 15, 105 }	------* Wraith	--  Wrath?	if (zombie:skill_find(85) == true) then		spawnchance[6] = { 15, 110 }	else		spawnchance[6] = { 8, 110 }	end	------* Portal Spawn	spawnchance[7] = { 4, 112 }	------* Queen Zombie	spawnchance[8] = { 4, 104 }		------------------------------------------------	-- Get the total	local total = 0		for index,value in ipairs(spawnchance) do 		total = total + value[1]	end	print(total)		-- Roll the dice	local vehicleid = 0	local arbchance = math.random(0, total)	total = 0	print(arbchance)	for index,value in ipairs(spawnchance) do 		total = total + value[1]		if (total > arbchance) and (vehicleid == 0) then			vehicleid = value[2]		end	end		------------------------------------------------	-- Handle special clauses	print(vehicleid)	-- Wraith?	if (vehicleid == 110) then		-- Are we a devious wraith?		if (zombie:skill_find(84) == true) then			zombie:inventory_modify("Portal", 1)		end		-- Wrath?		if (zombie:skill_find(85) == true) then			vehicleid = 114			zombie:inventory_modify("Crystals", 140)		else			zombie:inventory_modify("Crystals", 100)		end	-- Queen zombie	elseif (vehicleid == 104) then		-- Tell arena! Queen zombie!		g_arena:message(zombie.m_name .. " has spawned as a Queen-zombie!")		-- Random chance for them to have a portal		local rand = math.random(1, 100)		if (rand > 70) then			zombie:inventory_modify("Portal", 1)		end	end	-- Set the vehicleid	zombie:setVehicle(vehicleid)end