All pastes #745306 Raw Edit

Unnamed

public lua v1 · immutable
·published 2007-10-22 08:41 UTC
rendered paste body
--Global Variablesg_arena = nilg_player = nilg_bGameRunning = falsefunction Arena_OnCreate(arena)	-- Set our global value	g_arena = arena		local cfg = GameSettings()       cfg.minplayers = 2       cfg.gamedelay = 15               cfg.str_pregame = "Game starting in "       cfg.str_noplayers = "Not Enough Players"        cfg.bDesertedGameEnd = false        --cfg.bIngameTicker = true       --cfg.tckrUpdateSpacing = 1000        g_state = g_arena:Takeover_State(cfg)   	-- Initialize random	math.randomseed(os.time())endfunction Player_OnDeath(killer, victim) -- player, player 	local humansAlive = false		if (killer:getTeam().m_name == "Beast") then --QLOOS: Please make sure this is the BEAST team name		victim:changeTeam('Spider', 'Spider') --QLOOS: Please make sure this is the correct team name and password for the spider		victim:setVehicle(101)	end	--QLOOS: Another feature I thought you might want is to find out if there are any humans left, so I'm going to go ahead and check for that and end the game if the last human was killed.	for i=1, g_arena:numPlaying() do			local player = g_arena:getPlayer(i)			if (player ~= nil) then				if (player:getTeam().m_name == "Human") then --QLOOS: This should be the name of the humans team					humansAlive = true				end			end		end		if (humansAlive == false) then		g_arena:message('The Beast has won by killing all humans, the last human alive was '..victim.m_name..'.')		g_state:Endgame()	end	endfunction Arena_OnGameStart() 		for i=1, g_arena:numPlaying() do		local player = g_arena:getPlayer(i)		if (player ~= nil) then			player:setVehicle(111)		end	end		g_bGameRunning = true	g_arena:message("Let the Hunt Begin!")	local randomplayer = math.random(1, g_arena:numPlaying())	randomplayer = g_arena:getPlayer(randomplayer)	randomplayer:changeTeam('Beast', 'Beast') -- QLOOS: Please make sure the name of the beast team is correct		if (g_arena:numPlaying() >= 9) then		randomplayer:setVehicle(204)	elseif (g_arena:numPlaying() >= 5) then		randomplayer:setVehicle(203)	else		randomplayer:setVehicle(100)	end	event_create(endGame, 600000, g_arena) -- QLOOS: please make sure the timer is correct I forgot off the top of my head.endfunction Arena_OnGameEnd()	 g_bGameRunning = false	 event_flush()endfunction endGame()		local humansAlive = false		local livinghumans = { }			--Find out if there are any humans left		for i=1, g_arena:numPlaying() do			local player = g_arena:getPlayer(i)			if (player ~= nil) then				if (player:getTeam().m_name == "Human") then --QLOOS: This should be the name of the humans team					humansAlive = true					table.insert(livinghumans, player.m_name)				end			end		end				if (humansAlive == true) then			g_arena:message('Humans are the winners, the following humans survived.')			--QLOOS: this will go down the list of every human who is still alive and display their names in the chat			for i=1, table.getn(livinghumans) do				g_arena:message(livinghumans[i])			end		else			g_arena:message('The Beast has won.')		end		g_state:Endgame()end--*Game Start* ---everyone randomly spawns on map as humans. ---1 player is randomly chosen to be the Beast. ---10 minute timer until game ends, if there are any living humans at game end, victory for humans. ---When a Beast kills a human he goes to the Spider team. --^thats all the LUA I need, game should already automaticly randomly warp the players around. Not sure if LUA is required for timer.--Weak Beast Vehicle ID: 100 --Medium Beast Vehicle ID: 203 --Weak Beast Vehicle ID: 204 ----And just so you have as much info as possible. ----Human Vehicle ID: 111 --Spider Vehicle ID: 101 ----Beast team is team 0 --Human team is team 1 --Spider team is team 2--Oh, I also forgot to mention, the team ratio is 1 beast and 1-12 humans at one time. So for balancing purposes can you have it so a weak beast spawns with 1-4 humans, medium 5-8 and strong 9-12 humans.