Overiding kJumpForce

Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
The force used when a player is jumping is stored as a local variable in the JumpMoveMixin. I need to override the force as i have increased gravity. Although I have increased the players JumpHeight, he doesn't have sufficient force in the jump to reach the height.

In the code, the only example of a kJumpForce override is the Onos who sets Onos.kJumpForce = 20. I have tried this method, but my player does not jump any higher. By reducing the gravity slightly I got a bit more height.

I tried to set Avatar.kJumpForce = 100, but still no improvement. Does anyone know a good way to override this? I am not sure why it has been hidden away in a core mixin file, jump force is a very basic attribute to be modded, yet it appears difficult to mod.

Comments

  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    That's because
    local kStrafeJumpForce = 1
    local kStrafeJumpDelay = 0.7
    function Marine:ModifyJump(input, velocity, jumpVelocity)
        
        local isStrafeJump = input.move.z == 0 and input.move.x ~= 0
        if isStrafeJump and self:GetTimeGroundTouched() + kStrafeJumpDelay < Shared.GetTime() then
        
            local strafeJumpDirection = GetNormalizedVector(self:GetViewCoords():TransformVector(input.move))
            jumpVelocity:Add(strafeJumpDirection * kStrafeJumpForce)
            jumpVelocity.y = jumpVelocity.y * 0.8
            self.strafeJumped = true
            
        else
            self.strafeJumped = false
        end
        
        jumpVelocity:Scale(self:GetSlowSpeedModifier())
        
    end
    
    Is what you want
    function JumpMoveMixin:ModifyJump(input, velocity, jumpVelocity)
    end
    
  • Soul_RiderSoul_Rider Mod Bean Join Date: 2004-06-19 Member: 29388Members, Constellation, Squad Five Blue
    Thanks @SamusDroid. I had deleted that function, as I don't use strafe jump, so missed the example. Thanks for the tip. :D
  • SamusDroidSamusDroid Colorado Join Date: 2013-05-13 Member: 185219Members, Forum Moderators, NS2 Developer, NS2 Playtester, Squad Five Gold, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    Well, it's been the same code for a long time so, doesn't mean current strafe jump necessarily
Sign In or Register to comment.