View Single Post
Old 02-16-2013, 11:36 AM   #95
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.
Code:
-- save all the functions in a table
-- so we don't accidentally overwrite any saved functions in other files
local saved_functions = {}

-- save the function in the table
saved_functions.basecap = {}
saved_functions.basecap.ontrigger = basecap.ontrigger

function basecap:ontrigger( trigger_entity )
	-- save last points per capture
	local last_points_per_cap = POINTS_PER_CAPTURE
	local last_fortpoints_per_cap = FORTPOINTS_PER_CAPTURE

	-- set points per capture to this cap points settings if they are defined
	if self.teampoints ~= nil then POINTS_PER_CAPTURE = self.teampoints end
	if self.fortpoints ~= nil then FORTPOINTS_PER_CAPTURE = self.fortpoints end
	
	if type(saved_functions.basecap.ontrigger) == "function" then
		-- call the saved function
		saved_functions.basecap.ontrigger( self, trigger_entity )
	end
	
	-- reset points per cap to what it was
	POINTS_PER_CAPTURE = last_points_per_cap
	FORTPOINTS_PER_CAPTURE = last_fortpoints_per_cap
end

-- cap points that give 20 points instead of 10
blue_cap_bonus = blue_cap:new({teampoints = 20, fortpoints = 2000})
red_cap_bonus = red_cap:new({teampoints = 20, fortpoints = 2000})
yellow_cap_bonus = yellow_cap:new({teampoints = 20, fortpoints = 2000})
green_cap_bonus = green_cap:new({teampoints = 20, fortpoints = 2000})

--------------------------------------------------------------------------
-- Yard Lift with push based on the triggering class's speed
-- Push is multiplied by the class's speed / 400 (scout speed) to the power of speedbias
-- Higher speedbias = slow classes get pushed a lot less and vice versa
--------------------------------------------------------------------------
base_angle_jump = trigger_ff_script:new( {pushz=0, pushx=0, pushy=0, speedbias=0} )

function base_angle_jump:ontouch( trigger_entity )
	if IsPlayer(trigger_entity) then
		local player = CastToPlayer(trigger_entity)
		local playerVel = player:GetVelocity()
		local speedRatio = (player:MaxSpeed() / 400) ^ self.speedbias;
		if self.pushz ~= 0 then playerVel.z = self.pushz * speedRatio end
		if self.pushx ~= 0 then playerVel.x = self.pushx * speedRatio end
		if self.pushy ~= 0 then playerVel.y = self.pushy * speedRatio end
		player:SetVelocity( playerVel )
	end
end

yardvent_red = base_angle_jump:new( {pushz=760, pushx=-0, pushy=1800, speedbias = 1} )
yardvent_blue = base_angle_jump:new( {pushz=760, pushx=-0, pushy=-1800, speedbias = 1} )
fr_vent_red2 = base_angle_jump:new( {pushy=-1600} )
fr_vent_blue2 = base_angle_jump:new( {pushy=1600} )
Totally untested. If you ever run into the 4 teams of death, open the console and look for [SCRIPT] errors. It usually tells you what broke.

The cap point stuff had to be done in a dumb way because the base Lua's were written in a dumb way. It wouldn't be hard to add proper support for points set per cap point. I'll edit base_teamplay for the next patch.
__________________
#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.; 02-18-2013 at 01:17 AM.
squeek. is offline   Reply With Quote


1 members found this post helpful.