Thread: (Request) Speed boost lua
View Single Post
Old 12-16-2014, 11:33 PM   #1
KubeDawg
Nade Whore
Server Owner
Beta Tester
 
KubeDawg's Avatar
 
Join Date: Sep 2007
Location: Oklahoma
Class/Position: Scout/Soldier
Gametype: CTF/TDM
Affiliations: blunt. Moto
Posts Rated Helpful 128 Times
Speed boost lua

For the purposes of my new map, I want to create a boost/lift that shoots people from the corners of my map upwards and towards the center. So a 45 degree angle horizontally and depending on what works best, somewhere between 45-75 degrees vertically.

I've been using this code until now:
Code:
base_jump = trigger_ff_script:new({ pushz = 0, pushx = 0 })

function base_jump:ontouch( trigger_entity )
	if IsPlayer( trigger_entity ) then
		local player = CastToPlayer( trigger_entity )
		local playerVel = player:GetVelocity()
		playerVel.z = self.pushz
		playerVel.x = self.pushx
		player:SetVelocity( playerVel )
	end
end
player_launch = base_jump:new({ pushz = 0, pushx = 1000 })
But it appears I cannot control the direction it pushes the player in. If I set pushz to 1000 and pushx to 0, it flings me straight up in the air. If I do the opposite with pushx 1000 and pushz 0, it flings me in one single direction. So if I have it in each corner of my map, one will push me to the right, another straight forward, another backwards and one to the left. Is there a way to control the direction of the horizontal and vertical direction with lua?
__________________
Moto's Funhouse | Dallas, TX - 74.91.114.247:27015

ff_plunder - Complete
KubeDawg is offline   Reply With Quote