I was trying to make a simple lunge script to simulate a really long, low jump. When I am on the ground and I press Reload it makes the player barely move forward and is not getting the intended effect, but if I press reload and jump right after I press it, it works as intended. I am getting no errors.
[lua] function Lunge(ply)
if ply:GetStaminia() > 30 then
if ply:KeyDown( IN_RELOAD ) && ply:OnGround() then
ply:SetVelocity( ply:GetForward() * 200 + Vector( 1, 1, 150 ) )
ply:SetStaminia(ply:GetStaminia()-30)
end
else return
end
end
hook.Add("KeyPress", "Lunge", Lunge)
[/lua]
Move the player off the ground by a couple of units, then set the velocity.
How? I thought SetVelocity was the only way to force a player to move.
player:SetPos()?
This topic was brought up recently. IIRC you can SetGroundEntity( NULL ) first, then apply the velocity.
[QUOTE=iRzilla;19126518]But you must do SetGroundEntity() back to the world right?[/QUOTE]
I believe it does it automatically.
[QUOTE=foszor;19126132]This topic was brought up recently. IIRC you can SetGroundEntity( NULL ) first, then apply the velocity.[/QUOTE]
Yeah, I think that's how laser dance does it in any case.
Sorry, you need to Log In to post a reply to this thread.