Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 10-18-2009, 06:51 AM   #1
WattaTweest
Trimpin' ain't easy.
 
Join Date: Sep 2009
Location: California
Class/Position: O Demoman
Gametype: Control Points
Posts Rated Helpful 0 Times
Send a message via AIM to WattaTweest Send a message via MSN to WattaTweest
Simply changing skins, or remembering the last team you were on.

Working on a game mode similar to Push, but I'd like the ball carrier to switch to a different team once they pick the ball up, so either team could attack them, and once they're killed, or drop the ball, they revert back to their original team. I'm no good at LUA, so any assistance would be greatly appreciated!
WattaTweest is offline   Reply With Quote


Old 10-18-2009, 08:23 PM   #2
MonoXideAtWork
Pub Allstar!
Beta Tester
 
Join Date: Aug 2008
Class/Position: under en kvinna
Gametype: Capture the Flag
Affiliations: Eternal Order, Must be h4x, Mono's happy funtime.
Posts Rated Helpful 0 Times
murderball?
MonoXideAtWork is offline   Reply With Quote


Old 10-19-2009, 12:42 AM   #3
theqwert125
 
Join Date: Oct 2007
Posts Rated Helpful 0 Times
Sounds more like he wants to make a Tag gamemode, where the ball makes you it.
theqwert125 is offline   Reply With Quote


Old 10-19-2009, 12:46 AM   #4
WattaTweest
Trimpin' ain't easy.
 
Join Date: Sep 2009
Location: California
Class/Position: O Demoman
Gametype: Control Points
Posts Rated Helpful 0 Times
Send a message via AIM to WattaTweest Send a message via MSN to WattaTweest
Similar to murderball, but there are still capture points rather then the whole hold onto the ball as long as you can. The reason I want the team to change is I want teammates and enemies be able to push them with rockets/concs/pipes because once they pick up the ball, they lose all their grenades/ammo and their walk speed is reduced. It's gonna be a mainly soldier/demo/scout map.
WattaTweest is offline   Reply With Quote


Old 10-19-2009, 02:51 AM   #5
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
It's possible. I'll try to write the code for it in a bit.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 10-19-2009, 04:05 AM   #6
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Wait, what?

The point of changing the ball carrier's team is so that people can push him? People can push him no matter what team he's on.

A little more explanation of exactly what you want the lua to do would help.

EDIT: If you're good enough to write the lua to change someones speed/remove weapons when they get the ball, then here are the functions you need to do what you want:

Code:
-- to keep track of the old team, store the value of this somewhere
player:GetTeamId()

-- to change a players team without them respawning
ApplyToPlayer( player, { AT.kChangeTeamYellow } )
You'll have to use if then checks for each possible team when switching back to the old team.

If I read into your last post incorrectly and you need help with most/all of the lua, I can help you, but I do need some sort of clarification of what it is you want.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington

Last edited by squeek.; 10-19-2009 at 04:10 AM.
squeek. is offline   Reply With Quote


Old 10-19-2009, 07:37 AM   #7
WattaTweest
Trimpin' ain't easy.
 
Join Date: Sep 2009
Location: California
Class/Position: O Demoman
Gametype: Control Points
Posts Rated Helpful 0 Times
Send a message via AIM to WattaTweest Send a message via MSN to WattaTweest
I know 0 LUA I've read over some of the includes, and it looks like I might be able to get SOME of the basics down, but framework would be really helpful.

The basic rules, 2 teams on either side of a giant box have to run to a ball in the middle. The person who picks up the ball I'd like to change teams so they can be "pushed" so to speak by concs/grenades/rockets, but STILL take damage from them. If possible, I want them to be slowed down, but also have the damage they take from attacks reduced by about 75% (or whatever works best after playtesting)

At both sides of the box, there are capture points for opposing teams. The main objective is to push the carrier into the enemies side of the box and get them to the capture point. The reason I'd also like it to be a different team is because if you're defending, I want it to be possible to push an enemy carrier back into enemy territory.

Probably gonna get hated on a bit for this, but I basically took the idea from Red vs. Blue. They refer to it as Grifball.
WattaTweest is offline   Reply With Quote


Old 10-19-2009, 07:42 AM   #8
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Do you want them to go to different teams based on what team they are originally?

Example: All red players, when they pick up the ball, change to green while all blue players, when they pick up the ball, change to yellow.

That might make it a bit more clear as to which team "has" the ball (assuming that the ball carrier will still want to go for the enemy's cap point).
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington

Last edited by squeek.; 10-19-2009 at 07:43 AM.
squeek. is offline   Reply With Quote


Old 10-19-2009, 09:49 AM   #9
WattaTweest
Trimpin' ain't easy.
 
Join Date: Sep 2009
Location: California
Class/Position: O Demoman
Gametype: Control Points
Posts Rated Helpful 0 Times
Send a message via AIM to WattaTweest Send a message via MSN to WattaTweest
Actually that would work better. Let's go with that
WattaTweest is offline   Reply With Quote


Old 10-19-2009, 10:06 PM   #10
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Here we go. It turned out to be quite long.

Create one info_ff_script and name it ball
Create two trigger_ff_scripts and name them blue_cap and red_cap

The cap points should be where you want that team to score. Example: The red_cap is where the red team's ball carrier goes to cap. The blue_cap is where the blue team's ball carrier goes to cap.

All the variables in CAPS at the top are for you to change however you wish. Anything that you want to change other than those things might be a bit tricky. I set the classlimits to only allow soli/demo/scout. Those limits are defined in startup() and are easy/straightforward to change if you want to change them.

Hopefully it all works.

Code:
----------------------------------------------------------------------
-- Includes
----------------------------------------------------------------------

IncludeScript("base_push")

----------------------------------------------------------------------
-- Definitions
----------------------------------------------------------------------

BALL_THROW_SPEED = 512
BALL_RETURN_TIME = 60

POINTS_PER_CAPTURE = 10
FORTPOINTS_PER_CAPTURE = 1000

FORT_POINTS_PER_BALL_CARRIER_KILLED = 100
TEAM_POINTS_PER_BALL_CARRIER_KILLED = 0

BALL_CARRIER_SPEED = .75
BALL_CARRIER_DAMAGESCALE = .25
BALL_CARRIER_REMOVEWEAPONS = true
BALL_CARRIER_REMOVEGRENADES = true

TEAM1 = Team.kBlue
TEAM2 = Team.kRed
TEAM1_CARRIER = Team.kYellow
TEAM2_CARRIER = Team.kGreen

TEAM1_NAME = "Team 1"
TEAM2_NAME = "Team 2"
TEAM1_CARRIER_NAME = "Team 1 Ball Carrier"
TEAM2_CARRIER_NAME = "Team 2 Ball Carrier"

----------------------------------------------------------------------
-- Startup
----------------------------------------------------------------------

function startup()

	SetTeamName(TEAM1, TEAM1_NAME)
	SetTeamName(TEAM2, TEAM2_NAME)
	SetTeamName(TEAM1_CARRIER, TEAM1_CARRIER_NAME)
	SetTeamName(TEAM2_CARRIER, TEAM2_CARRIER_NAME)
	
	SetPlayerLimit(TEAM1, 0)
	SetPlayerLimit(TEAM2, 0)
	SetPlayerLimit(TEAM1_CARRIER, -1)
	SetPlayerLimit(TEAM2_CARRIER, -1)

	local team = GetTeam(TEAM1)
	team:SetClassLimit( Player.kScout, 0 )
	team:SetClassLimit( Player.kHwguy, -1 )
	team:SetClassLimit( Player.kSpy, -1 )
	team:SetClassLimit( Player.kCivilian, -1 )
	team:SetClassLimit( Player.kSniper, -1 )
	team:SetClassLimit( Player.kMedic, -1 )
	team:SetClassLimit( Player.kSoldier, 0 )
	team:SetClassLimit( Player.kDemoman, 0 )
	team:SetClassLimit( Player.kPyro, -1 )
	team:SetClassLimit( Player.kEngineer, -1 )
	
	team = GetTeam(TEAM2)
	team:SetClassLimit( Player.kScout, 0 )
	team:SetClassLimit( Player.kHwguy, -1 )
	team:SetClassLimit( Player.kSpy, -1 )
	team:SetClassLimit( Player.kCivilian, -1 )
	team:SetClassLimit( Player.kSniper, -1 )
	team:SetClassLimit( Player.kMedic, -1 )
	team:SetClassLimit( Player.kSoldier, 0 )
	team:SetClassLimit( Player.kDemoman, 0 )
	team:SetClassLimit( Player.kPyro, -1 )
	team:SetClassLimit( Player.kEngineer, -1 )
	
	team = GetTeam(TEAM1_CARRIER)
	team:SetClassLimit( Player.kScout, 0 )
	team:SetClassLimit( Player.kHwguy, -1 )
	team:SetClassLimit( Player.kSpy, -1 )
	team:SetClassLimit( Player.kCivilian, -1 )
	team:SetClassLimit( Player.kSniper, -1 )
	team:SetClassLimit( Player.kMedic, -1 )
	team:SetClassLimit( Player.kSoldier, 0 )
	team:SetClassLimit( Player.kDemoman, 0 )
	team:SetClassLimit( Player.kPyro, -1 )
	team:SetClassLimit( Player.kEngineer, -1 )
	
	team = GetTeam(TEAM2_CARRIER)
	team:SetClassLimit( Player.kScout, 0 )
	team:SetClassLimit( Player.kHwguy, -1 )
	team:SetClassLimit( Player.kSpy, -1 )
	team:SetClassLimit( Player.kCivilian, -1 )
	team:SetClassLimit( Player.kSniper, -1 )
	team:SetClassLimit( Player.kMedic, -1 )
	team:SetClassLimit( Player.kSoldier, 0 )
	team:SetClassLimit( Player.kDemoman, 0 )
	team:SetClassLimit( Player.kPyro, -1 )
	team:SetClassLimit( Player.kEngineer, -1 )
	
end

-- Give everyone a full resupply
function player_spawn( player_entity )
	local player = CastToPlayer( player_entity )

	player:AddHealth( 100 )
	player:AddArmor( 300 )

	player:AddAmmo( Ammo.kNails, 400 )
	player:AddAmmo( Ammo.kShells, 400 )
	player:AddAmmo( Ammo.kRockets, 400 )
	player:AddAmmo( Ammo.kCells, 400 )
	player:AddAmmo( Ammo.kDetpack, 1 )
	player:AddAmmo( Ammo.kManCannon, 1 )
	
	player:RemoveEffect( EF.kSpeedlua1 )
	
	local team = player:GetTeamId()
	
	if team ~= TEAM1 and team ~= TEAM2 then
		ApplyToPlayer( player, { GetChangeFlag( team ) } )
	end
	
	UpdateObjectiveIcon( player, GetEntityByName( "ball" ) )
end

-- On ball carrier killed, give appropriate points
function player_killed( killed_player, damageinfo )

	if IsPlayer(killed_player) then
		local player = CastToPlayer(killed_player)
		if player:HasItem( "ball" ) then
			  -- Entity that is attacking
			  local attacker = damageinfo:GetAttacker()

			  -- If no attacker do nothing
			  if not attacker then
				return
			  end

			  -- If attacker not a player do nothing
			  if not IsPlayer(attacker) then
				return
			  end
			  
			  local player_attacker = CastToPlayer(attacker)
			  
			  -- If player is damaging self or damaged by own team do nothing
			  if (player:GetId() == playerAttacker:GetId()) or (player:GetTeamId() == playerAttacker:GetTeamId()) then
				return 
			  end
			  
			local team = player_attacker:GetTeam()
			
			-- Add points
			team:AddScore( TEAM_POINTS_PER_BALL_CARRIER_KILLED )
			player_attacker:AddFortPoints( PLAYER_POINTS_PER_BALL_CARRIER_KILLED, "Killed Ball Carrier" )
		end
	end
	
end

-- On ball carrier killed, give appropriate points
function player_ondamage( damaged_player, damageinfo )

	if IsPlayer(damaged_player) then
		local player = CastToPlayer(damaged_player)
		if player:HasItem( "ball" ) then
			damageinfo:ScaleDamage( BALL_CARRIER_DAMAGESCALE )
		end
	end
	
end

-----------------------------------------------------------------------------
-- base_ball
-----------------------------------------------------------------------------
base_ball = info_ff_script:new({
	name = "base ball",
	team = Team.kUnassigned,
	model = "models/items/ball/ball.mdl",
	modelskin = 0,
	tosssound = "Flag.Toss",
	dropnotouchtime = 2,
	capnotouchtime = 2,	
	hudicon = "hud_ball",
	hudx = 5,
	hudy = 210,
	hudwidth = 48,
	hudheight = 48,
	hudalign = 1, 
	hudstatusiconbluex = 60,
	hudstatusiconbluey = 5,
	hudstatusiconredx = 60,
	hudstatusiconredy = 5,
	hudstatusiconblue = "hud_ball.vtf",
	hudstatusiconred = "hud_ball.vtf",
	hudstatusiconw = 15,
	hudstatusiconh = 15,
	hudstatusiconbluealign = 2,
	hudstatusiconredalign = 3,

	touchflags = {AllowFlags.kOnlyPlayers, AllowFlags.kBlue, AllowFlags.kRed, AllowFlags.kYellow, AllowFlags.kGreen},
	botgoaltype = Bot.kFlag
})

function base_ball:hasanimation() return true end

-- For when this object is carried, these offsets are used to place
-- the info_ff_script relative to the players feet
function base_ball:attachoffset()
	-- x = forward/backward
	-- y = left/right
	-- z = up/down
	local offset = Vector( 32, 0, 0 )
	return offset
end

function base_ball:precache()
	PrecacheSound(self.tosssound)
	PrecacheSound("yourteam.flagstolen")
	PrecacheSound("otherteam.flagstolen")
	PrecacheSound("yourteam.drop")
	PrecacheSound("otherteam.drop")
	PrecacheSound("yourteam.flagreturn")
	PrecacheSound("otherteam.flagreturn")
	PrecacheSound("yourteam.flagcap")
	PrecacheSound("otherteam.flagcap")
	info_ff_script.precache(self)
end

function base_ball:spawn()
	self.notouch = { }
	info_ff_script.spawn(self)
end

function base_ball:addnotouch(player_id, duration)
	self.notouch[player_id] = duration
	AddSchedule(self.name .. "-" .. player_id, duration, self.removenotouch, self, player_id)	
end

function base_ball.removenotouch(self, player_id)
	self.notouch[player_id] = nil
end

function base_ball:touch( touch_entity )
	if IsPlayer( touch_entity ) then
		local player = CastToPlayer( touch_entity )
		-- pickup if they can
		if self.notouch[player:GetId()] then return; end
	
		if player:GetTeamId() ~= self.team then
			-- let the teams know that the ball was picked up
			SmartSound(player, "yourteam.flagstolen", "yourteam.flagstolen", "otherteam.flagstolen")
			SmartSpeak(player, "CTF_YOUHAVEBALL", "CTF_TEAMHASBALL", "CTF_ENEMYHASBALL")
			SmartMessage(player, "#FF_YOUHAVEBALL", "#FF_TEAMHASBALL", "#FF_ENEMYHASBALL", Color.kGreen, Color.kGreen, Color.kRed)
			
			-- if the player is a spy, then force him to lose his disguise
			player:SetDisguisable( false )
			-- if the player is a spy, then force him to lose his cloak
			player:SetCloakable( false )
			
			-- note: this seems a bit backwards (Pickup verb fits Player better)
			local ball = CastToInfoScript(entity)
			ball:Pickup(player)
			AddHudIcon( player, self.hudicon, ball:GetName(), self.hudx, self.hudy, self.hudwidth, self.hudheight, self.hudalign )

			RemoveHudItemFromAll( "ball-icon-dropped" )
			local team = player:GetTeamId()
			if (team == Team.kBlue) then
				AddHudIconToAll( self.hudstatusiconblue, "ball-icon-blue", self.hudstatusiconbluex, self.hudstatusiconbluey, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconbluealign )
			elseif (team == Team.kRed) then
				AddHudIconToAll( self.hudstatusiconred, "ball-icon-red", self.hudstatusiconredx, self.hudstatusiconredy, self.hudstatusiconw, self.hudstatusiconh, self.hudstatusiconredalign )
			end
			
			local changeflag = GetChangeFlag( team )
			ApplyToPlayer( player, { changeflag } )
			
			if BALL_CARRIER_REMOVEWEAPONS then
				player:RemoveAllWeapons()
				if player:GetClass() == Player.kMedic then
					player:GiveWeapon( "ff_weapon_medkit", true )
				elseif player:GetClass() == Player.kSpy then
					player:GiveWeapon( "ff_weapon_knife", true )
				elseif player:GetClass() == Player.kEngineer then
					player:GiveWeapon( "ff_weapon_spanner", true )
				else
					player:GiveWeapon( "ff_weapon_crowbar", true )
				end
				ApplyToPlayer( player, { AT.kRemoveProjectiles } )
			end
			
			if BALL_CARRIER_REMOVEGRENADES then
				player:RemoveAmmo( Ammo.kGren1, 4 )
				player:RemoveAmmo( Ammo.kGren2, 4 )
				ApplyToPlayer( player, { AT.kStopPrimedGrens } )
			end
			
			player:AddEffect( EF.kSpeedlua1, -1, 0, BALL_CARRIER_SPEED )
			
			UpdateObjectiveIcon( player, GetCap( team ) )

		end
	end
end

function base_ball:onownerdie( owner_entity )
	-- drop the ball
	local ball = CastToInfoScript(entity)
	ball:Drop(BALL_RETURN_TIME, 0.0)
	if IsPlayer( owner_entity ) then
		local player = CastToPlayer( owner_entity )
		RemoveHudItem( player, ball:GetName() )

		local team = player:GetTeamId()
		if (team == Team.kBlue) then
			RemoveHudItemFromAll( "ball-icon-blue" )
		elseif (team == Team.kRed) then
			RemoveHudItemFromAll( "ball-icon-red" )
		end
	end
end
function base_ball:ownerfeign( owner_entity )
	-- drop the ball
	local ball = CastToInfoScript(entity)
	ball:Drop(BALL_RETURN_TIME, 0.0)
	if IsPlayer( owner_entity ) then
		local player = CastToPlayer( owner_entity )
		RemoveHudItem( player, ball:GetName() )
		local team = player:GetTeamId()
		if (team == Team.kBlue) then
			RemoveHudItemFromAll( "ball-icon-blue" )
		elseif (team == Team.kRed) then
			RemoveHudItemFromAll( "ball-icon-red" )
		end
	end
end
function base_ball:dropitemcmd( owner_entity )
	-- throw the ball
	local ball = CastToInfoScript(entity)
	ball:Drop(BALL_RETURN_TIME, BALL_THROW_SPEED)
	if IsPlayer( owner_entity ) then
		local player = CastToPlayer( owner_entity )
		RemoveHudItem( player, ball:GetName() )
		local team = player:GetTeamId()
		if (team == Team.kBlue) then
			RemoveHudItemFromAll( "ball-icon-blue" )
		elseif (team == Team.kRed) then
			RemoveHudItemFromAll( "ball-icon-red" )
		end
	end
end	

function base_ball:ondrop( owner_entity )
	if IsPlayer( owner_entity ) then
		local player = CastToPlayer( owner_entity )
		-- let the teams know that the flag was dropped
		SmartSound(player, "yourteam.drop", "yourteam.drop", "otherteam.drop")
		SmartMessage(player, "#FF_YOUBALLDROP", "#FF_TEAMBALLDROP", "#FF_ENEMYBALLDROP", Color.kYellow, Color.kYellow, Color.kYellow)
	end
	
	local ball = CastToInfoScript(entity)
	ball:EmitSound(self.tosssound)
end

function base_ball:onloseitem( owner_entity )
	if IsPlayer( owner_entity ) then
		-- let the player that lost the ball put on a disguise
		local player = CastToPlayer( owner_entity )
		player:SetDisguisable(true)
		player:SetCloakable( true )
	
		self:addnotouch(player:GetId(), self.capnotouchtime)
		
		local changeflag = GetChangeFlag( player:GetTeamId() )
		ApplyToPlayer( player, { changeflag } )
		
		player:RemoveEffect( EF.kSpeedlua1 )
		
		if BALL_CARRIER_REMOVEWEAPONS then
			GiveBackWeapons( player )

			player:AddAmmo( Ammo.kNails, 400 )
			player:AddAmmo( Ammo.kShells, 400 )
			player:AddAmmo( Ammo.kRockets, 400 )
			player:AddAmmo( Ammo.kCells, 400 )
			player:AddAmmo( Ammo.kDetpack, 1 )
			player:AddAmmo( Ammo.kManCannon, 1 )
		end
		
		UpdateObjectiveIcon( player, GetEntityByName( "ball" ) )
	end
end

function base_ball:onreturn( )
	-- let the teams know that the ball was returned
	BroadCastMessage("#FF_BALLRETURN", Color.kYellow)
	BroadCastSound ( "yourteam.flagreturn" )
	SpeakAll( "CTF_BALLRETURN" )
end

-- Define the ball
ball = base_ball:new({})

----------------------------------------------------------------------
-- Cap points
----------------------------------------------------------------------

function pushcap:ontrigger( trigger_entity )
	if IsPlayer( trigger_entity ) then
		local player = CastToPlayer( trigger_entity )
			
		-- check if the player is carrying the ball
		if player:HasItem( self.item ) then
			
			-- reward player for goal
			player:AddFortPoints(FORTPOINTS_PER_CAPTURE, "#FF_FORTPOINTS_GOAL")

			-- reward player's team for capture
			local team = player:GetTeam()
			team:AddScore(POINTS_PER_CAPTURE)
			local alliedteam = GetTeam( GetAlliedTeam( player:GetTeamId() ) )
			alliedteam:AddScore(POINTS_PER_CAPTURE)

			local ball = GetInfoScriptByName( "ball" )
			
			-- return the ball
			ball:Return()
				
			-- Remove any hud icons
			RemoveHudItem( player, ball:GetName() )
		local team = player:GetTeamId()
			if (team == Team.kBlue) then
				RemoveHudItemFromAll( "ball-icon-blue" )
			elseif (team == Team.kRed) then
				RemoveHudItemFromAll( "ball-icon-red" )
			end
	
			-- let the teams know that a capture occured
			SmartSound(player, "yourteam.flagcap", "yourteam.flagcap", "otherteam.flagcap")
			SmartSpeak(player, "CTF_YOUSCORE", "CTF_TEAMSCORE", "CTF_THEYSCORE")
			SmartMessage(player, "#FF_YOUSCORE", "#FF_TEAMSCORE", "#FF_ENEMYSCORE", Color.kGreen, Color.kGreen, Color.kRed)

			ApplyToAll({ AT.kRemovePacks, AT.kRemoveProjectiles, AT.kRespawnPlayers, AT.kRemoveBuildables, AT.kRemoveRagdolls, AT.kStopPrimedGrens, AT.kReloadClips })
		end
	end
end


-- declare the elements
if TEAM1 == Team.kRed then
	red_cap = pushcap:new({ team = TEAM2_CARRIER, item = "ball" })
	team1_cap = red_cap
elseif TEAM1 == Team.kBlue then
	blue_cap = pushcap:new({ team = TEAM2_CARRIER, item = "ball" })
	team1_cap = blue_cap
elseif TEAM1 == Team.kGreen then
	green_cap = pushcap:new({ team = TEAM2_CARRIER, item = "ball" })
	team1_cap = green_cap
elseif TEAM1 == Team.kYellow then
	yellow_cap = pushcap:new({ team = TEAM2_CARRIER, item = "ball" })
	team1_cap = yellow_cap
end

if TEAM2 == Team.kRed then
	red_cap = pushcap:new({ team = TEAM1_CARRIER, item = "ball" })
	team2_cap = red_cap
elseif TEAM2 == Team.kBlue then
	blue_cap = pushcap:new({ team = TEAM1_CARRIER, item = "ball" })
	team2_cap = blue_cap
elseif TEAM2 == Team.kGreen then
	green_cap = pushcap:new({ team = TEAM1_CARRIER, item = "ball" })
	team2_cap = green_cap
elseif TEAM2 == Team.kYellow then
	yellow_cap = pushcap:new({ team = TEAM1_CARRIER, item = "ball" })
	team2_cap = yellow_cap
end

----------------------------------------------------------------------
-- Get the team change flag
----------------------------------------------------------------------

function GetChangeFlag( team )
	if team == TEAM1 then
		if TEAM1_CARRIER == Team.kRed then
			return AT.kChangeTeamRed
		elseif TEAM1_CARRIER == Team.kBlue then
			return AT.kChangeTeamBlue
		elseif TEAM1_CARRIER == Team.kGreen then
			return AT.kChangeTeamGreen
		elseif TEAM1_CARRIER == Team.kYellow then
			return AT.kChangeTeamYellow
		else
			return AT.kChangeTeamSpectator
		end
	elseif team == TEAM2 then
		if TEAM2_CARRIER == Team.kRed then
			return AT.kChangeTeamRed
		elseif TEAM2_CARRIER == Team.kBlue then
			return AT.kChangeTeamBlue
		elseif TEAM2_CARRIER == Team.kGreen then
			return AT.kChangeTeamGreen
		elseif TEAM2_CARRIER == Team.kYellow then
			return AT.kChangeTeamYellow
		else
			return AT.kChangeTeamSpectator
		end
	elseif team == TEAM1_CARRIER then
		if TEAM1 == Team.kRed then
			return AT.kChangeTeamRed
		elseif TEAM1 == Team.kBlue then
			return AT.kChangeTeamBlue
		elseif TEAM1 == Team.kGreen then
			return AT.kChangeTeamGreen
		elseif TEAM1 == Team.kYellow then
			return AT.kChangeTeamYellow
		else
			return AT.kChangeTeamSpectator
		end
	elseif team == TEAM2_CARRIER then
		if TEAM2 == Team.kRed then
			return AT.kChangeTeamRed
		elseif TEAM2 == Team.kBlue then
			return AT.kChangeTeamBlue
		elseif TEAM2 == Team.kGreen then
			return AT.kChangeTeamGreen
		elseif TEAM2 == Team.kYellow then
			return AT.kChangeTeamYellow
		else
			return AT.kChangeTeamSpectator
		end
	else
		return AT.kChangeTeamSpectator
	end
end

function GetAlliedTeam( team )
	if team == TEAM1 then
		return TEAM1_CARRIER
	elseif team == TEAM2 then
		return TEAM2_CARRIER
	elseif team == TEAM1_CARRIER then
		return TEAM1
	elseif team == TEAM2_CARRIER then
		return TEAM2
	else
		return Team.kSpectator
	end
end

function GiveBackWeapons( player )
	if IsPlayer( player ) then
		if player:GetClass() == Player.kScout then
			player:GiveWeapon( "ff_weapon_shotgun", true )
			player:GiveWeapon( "ff_weapon_nailgun", true )
		end
		
		if player:GetClass() == Player.kSoldier then
			player:GiveWeapon( "ff_weapon_shotgun", true )
			player:GiveWeapon( "ff_weapon_supershotgun", true )
			player:GiveWeapon( "ff_weapon_rpg", true )
		end
		
		if player:GetClass() == Player.kDemoman then
			player:GiveWeapon( "ff_weapon_shotgun", true )
			player:GiveWeapon( "ff_weapon_grenadelauncher", true )
			player:GiveWeapon( "ff_weapon_pipelauncher", true )
		end
		
		if player:GetClass() == Player.kHwguy then
			player:GiveWeapon( "ff_weapon_shotgun", true )
			player:GiveWeapon( "ff_weapon_supershotgun", true )
			player:GiveWeapon( "ff_weapon_assaultcannon", true )
		end
		
		if player:GetClass() == Player.kPyro then
			player:GiveWeapon( "ff_weapon_shotgun", true )
			player:GiveWeapon( "ff_weapon_flamethrower", true )
			player:GiveWeapon( "ff_weapon_ic", true )
		end
		
		if player:GetClass() == Player.kMedic then
			player:GiveWeapon( "ff_weapon_shotgun", true )
			player:GiveWeapon( "ff_weapon_supershotgun", true )
			player:GiveWeapon( "ff_weapon_supernailgun", true )
		end
		
		if player:GetClass() == Player.kSpy then
			player:GiveWeapon( "ff_weapon_tranq", true )
			player:GiveWeapon( "ff_weapon_supershotgun", true )
			player:GiveWeapon( "ff_weapon_nailgun", true )
		end
		
		if player:GetClass() == Player.kSniper then
			player:GiveWeapon( "ff_weapon_nailgun", true )
			player:GiveWeapon( "ff_weapon_autorifle", true )
			player:GiveWeapon( "ff_weapon_sniperrifle", true )
		end
		
		if player:GetClass() == Player.kEngineer then
			player:GiveWeapon( "ff_weapon_railgun", true )
			player:GiveWeapon( "ff_weapon_supershotgun", true )
		end
	end
end

function GetCap( team )
	if GetEntityByName( "team1_cap" ) then return GetEntityByName( "team1_cap" ) end
	if GetEntityByName( "team2_cap" ) then return GetEntityByName( "team2_cap" ) end
	
	if TEAM1 == Team.kRed then
		if GetEntityByName( "red_cap" ) then return GetEntityByName( "red_cap" ) end
	elseif TEAM1 == Team.kBlue then
		if GetEntityByName( "blue_cap" ) then return GetEntityByName( "blue_cap" ) end
	elseif TEAM1 == Team.kGreen then
		if GetEntityByName( "green_cap" ) then return GetEntityByName( "green_cap" ) end
	elseif TEAM1 == Team.kYellow then
		if GetEntityByName( "yellow_cap" ) then return GetEntityByName( "yellow_cap" ) end
	end
	
	if TEAM2 == Team.kRed then
		if GetEntityByName( "red_cap" ) then return GetEntityByName( "red_cap" ) end
	elseif TEAM2 == Team.kBlue then
		if GetEntityByName( "blue_cap" ) then return GetEntityByName( "blue_cap" ) end
	elseif TEAM2 == Team.kGreen then
		if GetEntityByName( "green_cap" ) then return GetEntityByName( "green_cap" ) end
	elseif TEAM2 == Team.kYellow then
		if GetEntityByName( "yellow_cap" ) then return GetEntityByName( "yellow_cap" ) end
	end

end
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington

Last edited by squeek.; 10-19-2009 at 10:07 PM.
squeek. is offline   Reply With Quote


Old 10-20-2009, 01:55 AM   #11
WattaTweest
Trimpin' ain't easy.
 
Join Date: Sep 2009
Location: California
Class/Position: O Demoman
Gametype: Control Points
Posts Rated Helpful 0 Times
Send a message via AIM to WattaTweest Send a message via MSN to WattaTweest
Thank you SO much, squeek! The map is starting to come to life! The only issue I see at the moment, LUA-wise is when you're blue and switch to yellow, the objective waypoint points to what should be the Red/Green teams cap. I'm gonna see if I can't sort it out myself. Thank you again! You truely are a LUA god!!!
WattaTweest is offline   Reply With Quote


Old 10-20-2009, 03:52 AM   #12
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
You sure you have it set up like this?
Quote:
Originally Posted by squeek. View Post
The cap points should be where you want that team to score. Example: The red_cap is where the red team's ball carrier goes to cap. The blue_cap is where the blue team's ball carrier goes to cap.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 10-20-2009, 08:53 PM   #13
WattaTweest
Trimpin' ain't easy.
 
Join Date: Sep 2009
Location: California
Class/Position: O Demoman
Gametype: Control Points
Posts Rated Helpful 0 Times
Send a message via AIM to WattaTweest Send a message via MSN to WattaTweest
Yeah, they're named red_cap and blue_cap, but both teams point to red's.

Edit: The yellow/blue points to the right cap, but you can only capture on red/green's.

Last edited by WattaTweest; 10-20-2009 at 08:59 PM.
WattaTweest is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:58 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.