All pastes #254220 Raw Edit

Untitled

public lua v1 · immutable
#254220 ·published 2006-11-21 17:07 UTC
rendered paste body
#Global Hooks$Simulation:[----------------------------MISSION INITIALIZATION----------------------------if missionInit == nil then	RedFlagBearer = nil	GreenFlagBearer = nil	RedScore = 0	GreenScore = 0	RedBase = mn.getShipByName("Red Base")		--These ships MUST be in the game in order for this to work!	GreenBase = mn.getShipByName("Green Base")	RedFlag = mn.getShipByName("Red Flag")	GreenFlag = mn.getShipByName("Green Flag")	missionInit = 42	RedDrop = 0	GreenDrop = 0	nullvec = ma.newVector(0,0,0)endRedFlag.Velocity = nullvecGreenFlag.Velocity = nullvec--------------------CARRY RED FLAG--------------------if RedFlagBearer ~= nil then	RedFlag.Position = RedFlagBearer.Position		---------------------	--GREEN TEAM SCORES--	---------------------	if (RedFlagBearer.Position:getDistance(GreenBase.Position) < 10) and (GreenFlagBearer == nil) and (GreenDrop == 0) then		RedFlagBearer = nil		RedFlag.Position = RedBase.Position		GreenScore = GreenScore + 1	end	endif RedFlagBearer ~= nil then	-----------------	--DROP RED FLAG--	-----------------		if RedFlagBearer.HitpointsLeft < 1 then		RedFlagBearer = nil		RedDrop = 1	end	end---------------------PICKUP RED FLAG---------------------if (RedFlagBearer == nil) then --if RedFlag isn't being carried	for i = 1, mn.getNumShips() do --run though all ships		thisShip = mn.getShipByIndex(i)		if thisShip.Position:getDistance(RedFlag.Position) < 10 then --if one of those ships is touched the flag					if thisShip.Team ~= RedFlag.Team then --filter out one team				RedFlagBearer = thisShip -- he's the flagbearer!			else						--recovering a dropped flag				if RedDrop == 1 then					RedDrop = 0					RedFlag.Position = RedBase.Position					RedFlagBearer = nil				end			end		end	endend----------------------CARRY GREEN FLAG----------------------if GreenFlagBearer ~= nil then						--If the flag is being carried...	GreenFlag.Position = GreenFlagBearer.Position	--Make the Flag be carried			-------------------	--RED TEAM SCORES--	-------------------							--if the enemy flag is at your base, and the RedFlag is at your base...		if (GreenFlagBearer.Position:getDistance(RedBase.Position) < 10) and (RedFlagBearer == nil) and (RedDrop == 0) then		GreenFlagBearer = nil						--No more flagbearer		GreenFlag.Position = GreenBase.Position		--Flag goes back to the base		RedScore = RedScore + 1						--And you get a point	end		endif GreenFlagBearer ~= nil then		-------------------	--DROP GREEN FLAG--	-------------------		if GreenFlagBearer.HitpointsLeft < 1 then		--If the flagbearer DIES		GreenFlagBearer = nil						--No flagbearer!		GreenDrop = 1								--Dropped Flag flag (hehe)	end	end-----------------------PICKUP GREEN FLAG-----------------------if (GreenFlagBearer == nil) then --if GreenFlag isn't being carried	for i = 1, mn.getNumShips() do --run though all ships		thisShip = mn.getShipByIndex(i)		if thisShip.Position:getDistance(GreenFlag.Position) < 10 then --if one of those ships is touched the flag					if thisShip.Team ~= GreenFlag.Team then --filter out one team				GreenFlagBearer = thisShip -- he's the flagbearer!			else						--recovering a dropped flag				if GreenDrop == 1 then					GreenDrop = 0					GreenFlag.Position = GreenBase.Position					GreenFlagBearer = nil				end			end		end	endend]$HUD:[swidth = gr.getScreenWidth()sheight = gr.getScreenHeight()halfwidth = swidth*0.5halfheight = sheight*0.5redX = swidth*0.6greenX  = swidth*0.4teamX = sheight*0.1scoreX = sheight*0.12rednoticeY = sheight*0.15greennoticeY = sheight*0.17gr.setColor(192,0,0)gr.drawString("Red", redX, teamX)gr.drawString(RedScore, redX, scoreX)gr.setColor(0,128,0)gr.drawString("Green", greenX, teamX)gr.drawString(GreenScore, greenX, scoreX)if RedFlagBearer ~= nil then	gr.setColor(192,0,0)	gr.drawString("The Red Flag has been taken!", greenX, rednoticeY)endif GreenFlagBearer ~= nil then	gr.setColor(0,128,0)	gr.drawString("The Green Flag has been taken!", greenX, greennoticeY)end	]#End