parachutes

Started by Eva, Feb 01, 2017, 12:10 PM

Previous topic - Next topic

Eva

Hi maybe its a silly question, but would it be possible to port the parachute from San Andreas into vcmp? I guess its not but if so how can it be done?

MatheuS

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

jWeb

#2
With a bit of work and some math skills probably yes http://forum.vc-mp.org/?topic=1051.0 But for the average VCMP scripter... absolutely not.

For a better performance and accuracy, this should probably be implemented as a native plugin.

vito

Yes, possible. But animation won't be same.

KAKAN

Whatever you do, it'll be a good addition to a private server not a public one. With a bit more improvement on client side, this can be done totally on client side :D
oh no

Shadow

#5
Quickly expanding @happymint 's solution, I came up with this which looks smooth enough and it doesn't deal any damage to the player upon falling.

// quick function that I coded on the go
function clamp(value, min, max)
{
return value < min ? min : (value > max ? max : value);
}

local g_PlayerFallAccum = array(GetMaxPlayers(), 0.0);

function onPlayerFall(player, speed)
{
player.Speed.z += clamp(speed, (-1) * player.Speed.z * 0.7, (-1) * player.Speed.z * 0.9);
}

function onPlayerMove(player, px, py, pz, cx, cy, cz)
{
    // Get the speed to avoid too many table lookups
    local speed = g_PlayerFallAccum[player.ID];
    // Update the accumulated speed
    speed += pz > cz ? pz - cz : 0.0;
    // Check the accumulated speed
    if (speed > 1.0) onPlayerFall(player, speed);
    // Save the accumulated speed
    g_PlayerFallAccum[player.ID] = speed;
}

function _PlayerFallResetFunc()
{
    g_PlayerFallAccum.apply(@(v) 0.0);
}

local _PlayerFallResetTimer = NewTimer("_PlayerFallResetFunc", 500, 0);

EDIT: Updated the function
QuotePS:is trash is ur home language??

Eva

#6
Quote from: Shadow on Feb 01, 2017, 02:29 PMQuickly expanding @happymint 's solution, I came up with this which looks smooth enough and it doesn't deal any damage to the player upon falling.

// quick function that I coded on the go
function clamp(value, min, max)
{
return value < min ? min : (value > max ? max : value);
}

local g_PlayerFallAccum = array(GetMaxPlayers(), 0.0);

function onPlayerFall(player, speed)
{
player.Speed.z += clamp(speed, (-1) * player.Speed.z * 0.7, (-1) * player.Speed.z * 0.9);
}

function onPlayerMove(player, px, py, pz, cx, cy, cz)
{
    // Get the speed to avoid too many table lookups
    local speed = g_PlayerFallAccum[player.ID];
    // Update the accumulated speed
    speed += pz > cz ? pz - cz : 0.0;
    // Check the accumulated speed
    if (speed > 1.0) onPlayerFall(player, speed);
    // Save the accumulated speed
    g_PlayerFallAccum[player.ID] = speed;
}

function _PlayerFallResetFunc()
{
    g_PlayerFallAccum.apply(@(v) 0.0);
}

local _PlayerFallResetTimer = NewTimer("_PlayerFallResetFunc", 500, 0);
I will experiment with this, :)

vito


KAKAN

oh no

Shadow

Updated the function and made it more minimalistic.
QuotePS:is trash is ur home language??

vito

Quote from: KAKAN on Feb 01, 2017, 05:49 PM
Quote from: vito on Feb 01, 2017, 03:37 PM
Quote from: KAKAN on Feb 01, 2017, 02:13 PMnot a public one
Why?
Try it with 250+ pingers and find out why.
Lag is not a big problem, player will lag for others in the sky, but this part of gameplay not so important if you planning no critical shooting to this player during fall. (Its hard to kill him).

KAKAN

Quote from: vito on Feb 02, 2017, 07:17 AM
Quote from: KAKAN on Feb 01, 2017, 05:49 PM
Quote from: vito on Feb 01, 2017, 03:37 PM
Quote from: KAKAN on Feb 01, 2017, 02:13 PMnot a public one
Why?
Try it with 250+ pingers and find out why.
Lag is not a big problem, player will lag for others in the sky, but this part of gameplay not so important if you planning no critical shooting to this player during fall. (Its hard to kill him).
Well, he'll start falling simply and then after a few seconds, your parachute system will work, so it won't be a "immediate" one, the only way to make it lag-free is it if it's implemented natively( in vcmp's client code ofc ) or via a client side script.
oh no

vito

Quote from: KAKAN on Feb 02, 2017, 08:53 AMWell, he'll start falling simply and then after a few seconds, your parachute system will work, so it won't be a "immediate" one, the only way to make it lag-free is it if it's implemented natively( in vcmp's client code ofc ) or via a client side script.
Of course it should be created in client-side. Actually I did almost same few months ago (safari gamemode) - attach player to helicopter and it worked fine (for local player). We need a smooth mainly for local player, so lags for others players is not a big problem.

Yesterday I've tested flying over city via client side and got some fun in the border of map.

https://www.youtube.com/watch?v=JeS7NCEDuuA#

Eva


Eva

First betatest with parachutes