Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: JUMPXY not working on Linux

  1. #11

    Default

    Quote Originally Posted by Razo[R]apiD View Post
    You can use it if you figure out how to make player be in air before.
    There is a private repo where selected people can make changes.
    I found a possible solution following your hint

    local.player jump 100
    wait 0.2
    local.player jumpxy 150 150 150
    It's a very good starting point. At least I have some control over the jump. Let's see if ryback is going to post a better/different solution by using sv_gravity

  2. #12
    Developer RyBack's Avatar
    Join Date
    Apr 2014
    Location
    In Front of the screen
    Posts
    1,603

    Default

    inside mohaa, jumpxy is implemented by doing some basic calculations on "how much should we add to the player's velocity" then adding these calculations to the player's velocity.
    to make it feel real, sv_gravity (ie gravity force) is used.
    here's how it's done in opm:
    void Player::JumpXY
    (
    Event *ev
    )

    {
    float forwardmove;
    float sidemove;
    float distance;
    float time;
    float speed;

    forwardmove = ev->GetFloat( 1 );
    sidemove = ev->GetFloat( 2 );
    speed = ev->GetFloat( 3 );

    velocity = yaw_forward * forwardmove - yaw_left * sidemove;
    distance = velocity.length();
    velocity *= speed / distance;
    time = distance / speed;
    velocity[ 2 ] = sv_gravity->integer * time * 0.5f;

    airspeed = distance;

    // make sure the player leaves the ground
    client->ps.walking = qfalse;
    }

    here's an equivalent morpheus script:


    jumpxy local.player local.forwardmove local.sidemove local.speed:
    local.yaw_forward = angles_toforward(local.player.angles[1]);
    local.yaw_left = angles_toleft(local.player.angles[1]);
    local.yaw_forward = vector_scale(local.yaw_forward, local.forwardmove);
    local.yaw_left = vector_scale(local.yaw_left, local.sidemove);
    local.player.velocity = local.yaw_forward - local.yaw_left;
    local.distance = vector_length(local.player.velocity);
    local.player.velocity = vector_scale(local.player.velocity, local.speed / local.distance);
    local.time = local.distance / local.speed;
    local.gravity = int(getcvar("sv_gravity"));
    local.player.velocity[2] = local.gravity * local.time * 0.5;
    end


    there's an odd part tho,
    Code:
        // make sure the player leaves the ground
        client->ps.walking = qfalse;
    this might be a fix for the crash, but idk, try the script to see if it crashes or smth.
    Last edited by RyBack; May 1st, 2019 at 03:21 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •