View Single Post
Old 03-06-2012, 05:38 PM   #9
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'd probably need to be precached and it'd need a line in base_jump:ontouch to actually play the sound. But, you're most likely better off using an ambient_generic entity in the map and then making it play the sound with Lua using OutputEvent, though, as BroadCastSound plays the sound universally and doesn't factor in a player's distance from the event itself.

To play an ambient generic from Lua, use:

Code:
OutputEvent( "entity_name", "PlaySound" )
To add this to the trigger code while making it easy to have jump triggers with different sounds, you would do this:
Code:
------------------------------------------
-- jump triggers
------------------------------------------
base_jump = trigger_ff_script:new({ pushx = 0, pushy = 0, pushz = 0, sound_entname="base_jump_sound" })

-- push people when they touch the trigger
function base_jump:ontouch( trigger_entity )
	if IsPlayer( trigger_entity ) then
		local player = CastToPlayer( trigger_entity )
		
		player:SetVelocity( Vector( self.pushx, self.pushy, self.pushz ) )
		OutputEvent( self.sound_entname, "PlaySound" )
	end
end

-- up push
jump_up = base_jump:new({ pushx = 0, pushy = 0, pushz = 1000, sound_entname="jump_up_sound" })
jump_up_alt = base_jump:new({ pushx = 0, pushy = 0, pushz = 1000, sound_entname="jump_up_sound2"})
__________________
#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.; 03-06-2012 at 05:43 PM.
squeek. is online now   Reply With Quote