All pastes #481548 Raw Edit

Stuff

public text v1 · immutable
·published 2007-05-10 21:39 UTC
rendered paste body
-- This is so the script can be reloaded without destroying the g_arena variable
if g_arena == nil then
--- [[ Globals ]] --------

g_state = nil		-- The global GameState class
g_arena = nil		-- The global arena class, to avoid having to pass it around functions
g_bGameRunning = false	-- Is the game running?

dofile("../sharedlua/utility.lua")
dofile("../sharedlua/Modstuff.lua")
dofile("../sharedlua/Survey.lua")
dofile("../sharedlua/LcStuff.lua")

g_accessfile = "../Conquest_Resources/ScriptAccess.txt"

end

function Arena_OnCreate(arena)
	-- Set our global value
	g_arena = arena

	-- Initialize random
	math.randomseed(os.time())
end

-- Begin modifications
function Msg_OnCommand(player, command, payload, recipient, msg_type)
	local cmd = string.lower(command)
	if(cmd == "?coord" or cmd == "?coords" ) then
		local pos = player:coords()
		player:message("Your coordinates are x= " .. pos.x .. ", y= " .. pos.y .. ", z= " .. pos.z .. ", rotation= " ..pos.rotation)
	else
		survey(player, command, payload, recipient, msg_type)
		LcStuff(player, command, payload, recipient, msg_type)
		ModStuff(player, command, payload, recipient, msg_type)
	end
	if isonmodlist(player.m_name) then
		if(cmd == "?hello") then
			logcmd(g_arena.m_name, player, command, payload, recipient, msg_type)
			g_arena:message("Hello world")
		end
	end
end

-- end modifications

-- Begin modifications
function Item_OnPickUp(looter, loot, loot_type, amounttopickup)
    local vid = looter:getVehicle():vehicletypeid()  
	
	--Collective
	if (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (looter:inventory_find("Equip Agile Combat Suit") > 0)   
	and (loot_type.m_name == "Agile Combat Suit Change"))   
	then   
	   looter:setVehicle(103)
	 
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (looter:inventory_find("Equip Assault Combat Suit") > 0)   
	and (loot_type.m_name == "Assault Combat Suit Change"))   
	then   
	   looter:setVehicle(100)
	 
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (looter:inventory_find("Equip Camoflage Combat Suit") > 0)   
	and (loot_type.m_name == "Camoflage Combat Suit Change"))   
	then   
	   looter:setVehicle(109)
	 
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (looter:inventory_find("Equip Infilitration Combat Suit") > 0)   
	and (loot_type.m_name == "Infil. Combat Suit Change"))   
	then   
	   looter:setVehicle(107)
	 
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (looter:inventory_find("Equip Reinforced Combat Suit") > 0)   
	and (loot_type.m_name == "Agile Reinforced Suit Change"))   
	then   
	   looter:setVehicle(106)
	 
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (looter:inventory_find("Equip Standard Combat Suit") > 0)   
	and (loot_type.m_name == "Standard Combat Suit Change"))   
	then   
	   looter:setVehicle(105)
	 
	--Titan
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (looter:inventory_find("Equip Agile Combat Suit") > 0)   
	and (loot_type.m_name == "Agile Combat Suit Change"))   
	then   
	   looter:setVehicle(113)
	  
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12))   
	and (looter:inventory_find("Equip Assault Combat Suit") > 0)   
	and (loot_type.m_name == "Assault Combat Suit Change"))   
	then   
	   looter:setVehicle(112)
	 
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12))  
	and (looter:inventory_find("Equip Camoflage Combat Suit") > 0)   
	and (loot_type.m_name == "Camoflage Combat Suit Change"))   
	then   
	   looter:setVehicle(116)
	 	 
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12))   
	and (looter:inventory_find("Equip Infilitration Combat Suit") > 0)   
	and (loot_type.m_name == "Infil. Combat Suit Change"))   
	then   
	   looter:setVehicle(117)
	 
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12))  
	and (looter:inventory_find("Equip Reinforced Combat Suit") > 0)   
	and (loot_type.m_name == "Agile Reinforced Suit Change"))   
	then   
	   looter:setVehicle(115)
	  
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (looter:inventory_find("Equip Standard Combat Suit") > 0)   
	and (loot_type.m_name == "Standard Combat Suit Change"))   
	then   
	   looter:setVehicle(12)
	   
	end
	
	return true
end

-- end modifications


function Vehicle_OnProduce(user, menuitem)
local vid = user:getVehicle():vehicletypeid()

	-- Standard Combat Suit
	---   Europa
	if (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (menuitem == 1)
	and (user:inventory_find("SCS MT-Robots") > 0))   
	then   
	   user:setVehicle(105)
	--- Titan
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (menuitem == 1)
	and (user:inventory_find("SCS MT-Robots") > 0))     
	then   
	   user:setVehicle(12)
	   
	   -- Assault Combat Suit
	---   Europa
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (menuitem == 3)
	and (user:inventory_find("ATCS MT-Robots") > 0))   
	then   
	   user:setVehicle(100)
	   --- Titan
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (menuitem == 3)
	and (user:inventory_find("ATCS MT-Robots") > 0))     
	then   
	   user:setVehicle(112)
	      
	   --  Camoflage Combat Suit
	---   Europa
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (menuitem == 5)
	and (user:inventory_find("CCS MT-Robots") > 0))   
	then   
	   user:setVehicle(109)
	   --- Titan
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (menuitem == 5)
	and (user:inventory_find("CCS MT-Robots") > 0))     
	then   
	   user:setVehicle(116)
	      
	   -- Infilitration Combat Suit
	---   Europa
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (menuitem == 7)
	and (user:inventory_find("ICS MT-Robots") > 0))   
	then   
	   user:setVehicle(107)
	   --- Titan
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (menuitem == 7)
	and (user:inventory_find("ICS MT-Robots") > 0))     
	then   
	   user:setVehicle(117)
	      
	   -- Agile Combat Suit
	---   Europa
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (menuitem == 9)
	and (user:inventory_find("AECS MT-Robots") > 0))   
	then   
	   user:setVehicle(103)
	   --- Titan
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (menuitem == 9)
	and (user:inventory_find("AECS MT-Robots") > 0))     
	then   
	   user:setVehicle(113)
	      
	   -- Reinforced Combat Suit
	---   Europa
	elseif (((vid == 103)  
	or (vid == 100)   
	or (vid == 109)   
	or (vid == 107)   
	or (vid == 106)   
	or (vid == 105))  
	and (menuitem == 11)
	and (user:inventory_find("RCS MT-Robots") > 0))   
	then   
	   user:setVehicle(106)
	   --- Titan
	elseif (((vid == 113)  
	or (vid == 112)   
	or (vid == 116)   
	or (vid == 117)   
	or (vid == 115)   
	or (vid == 12)) 
	and (menuitem == 11)
	and (user:inventory_find("RCS MT-Robots") > 0))     
	then   
	   user:setVehicle(115)
	end

	return true
end
-- resurrection script
function Vehicle_OnDeath(victim, killer, itemid)
local vid = victim:getVehicle():vehicletypeid()
local c = victim:coords()
local s = victim:getStat()
local kid = killer:getVehicle():vehicletypeid()

	if (vid == 103) then victim:setstat(1,103)
	elseif (vid == 100) then victim:setstat(1,100)
	elseif (vid == 109) then victim:setstat(1,109)
	elseif (vid == 107) then victim:setstat(1,107)
	elseif (vid == 106) then victim:setstat(1,106)
	elseif (vid == 105) then victim:setstat(1,105)
	elseif (vid == 113) then victim:setstat(1,113)
	elseif (vid == 112) then victim:setstat(1,112)
	elseif (vid == 116) then victim:setstat(1,116)
	elseif (vid == 117) then victim:setstat(1,117)
	elseif (vid == 115) then victim:setstat(1,115)
	elseif (vid == 12) then victim:setstat(1,12)

--Shockpad Eurpa
	if ((itemid == 1025)
	and ((kid == 103)  
	or (kid == 100)   
	or (kid == 109)   
	or (kid == 107)   
	or (kid == 106)   
	or (kid == 105))
	and (vid == 118))  
		then 
		if (victim:getstat(1) == 103)
			then victim:setVehicle(103)
			victim:clearStats()
		elseif (victim:getstat(1) == 100)
			then victim:setVehicle(100)  
				victim:clearStats()
		elseif (victim:getstat(1) == 109)
			then victim:setVehicle(109)
				victim:clearStats()
		elseif (victim:getstat(1) == 107)
			then victim:setVehicle(107)
				victim:clearStats()
		elseif (victim:getstat(1) == 106)
			then victim:setVehicle(106)
				victim:clearStats()
		elseif (victim:getstat(1) == 105)
			then victim:setVehicle(105)
				victim:clearStats()
-- Shockpad Titan
	elseif ((itemid == 1025)
	and ((kid == 113)  
	or (kid == 112)   
	or (kid == 116)   
	or (kid == 117)   
	or (kid == 115)   
	or (kid == 12))
	and (vid == 118))  
		then 
		if (victim:getstat(1) == 113)
			then victim:setVehicle(113)
				victim:clearStats()
		elseif (victim:getstat(1) == 112)
			then victim:setVehicle(112) 
				victim:clearStats()
		elseif (victim:getstat(1) == 116)
			then victim:setVehicle(116)
				victim:clearStats()
		elseif (victim:getstat(1) == 117)
			then victim:setVehicle(117)
				victim:clearStats()
		elseif (victim:getstat(1) == 115)
			then victim:setVehicle(115)
				victim:clearStats()
		elseif (victim:getstat(1) == 12)
			then victim:setVehicle(12)
				victim:clearStats()
				
	
	---death timer respawn
	elseif (itemid == 1026)
		then
			if (victim:getstat(1) == 113)
				then victim:warp(6000, 2448, 50) 
				victim:setVehicle(113)	
				victim:clearStats()
			elseif (victim:getstat(1) == 112)
				then victim:warp(6000, 2448, 50)
				victim:setVehicle(112)	
				victim:clearStats()
			elseif (victim:getstat(1) == 116)
				then victim:warp(6000, 2448, 50) 
				victim:setVehicle(116)	
				victim:clearStats()
			elseif (victim:getstat(1) == 117)
				then victim:warp(6000, 2448, 50) 
				victim:setVehicle(117)	 
				victim:clearStats()
			elseif (victim:getstat(1) == 115)
				then victim:warp(6000, 2448, 50) 
				victim:setVehicle(115)	
				victim:clearStats()
			elseif (victim:getstat(1) == 12)
				then victim:warp(5000, 2448, 50)
				victim:setVehicle(12)	
				victim:clearStats()
	-- death timer respawn
	elseif (itemid == 1026)
		then 
			if (victim:getstat(1) == 103)
				then victim:warp(14976, 2448, 50) 
				victim:setVehicle(103)	
				victim:clearStats()
			elseif (victim:getstat(1) == 100)
				then victim:warp(14976, 2448, 50)
				victim:setVehicle(100)	
				victim:clearStats()
			elseif (victim:getstat(1) == 109)
				then victim:warp(14976, 2448, 50) 
				victim:setVehicle(109)	
				victim:clearStats()
			elseif (victim:getstat(1) == 107)
				then victim:warp(14976, 2448, 50)
				victim:setVehicle(107)	
				victim:clearStats()
			elseif (victim:getstat(1) == 106)
				then victim:warp(14976, 2448, 50) 
				victim:setVehicle(106)	
				victim:clearStats()
			elseif (victim:getstat(1) == 105)
				then victim:warp(14976, 2448, 50)
				victim:setVehicle(105)	
				victim:clearStats()
	-- if player dies and not corpse vehicle
	elseif ((vid == 113)  
		or (vid == 112)   
		or (vid == 116)   
		or (vid == 117)   
		or (vid == 115)   
		or (vid == 12)
		or (vid == 103)  
		or (vid == 100)   
		or (vid == 109)   
		or (vid == 107)   
		or (vid == 106)   
		or (vid == 105)) 
			then victim:warp(c.x, c.y, 0)
				victim:setVehicle(118)
				arena:explosion_create("Corpse detector", c.x, c.y, 0) 
	end