player.AddSpeed invalid variable

Started by Fjose, Oct 26, 2014, 02:36 AM

Previous topic - Next topic

Fjose

wiki is not 100% updated for that, there are some issues..

what is the true function for set the speed individually?

Honey

player.AddSpeed does not add acceleration speed.It is some sort of speed which interferes with Vectors.Correct Usage is player.AddSpeed( Vector speed ).

Fjose

oh. anyway there is no other way to modify player speed?

Honey

Of course there is, you can use player.RelativeSpeed.

Example to increase Vehicle Acceleration : player.Vehicle.RelativeSpeed*0.5;
Example to Decrease Vehicle Acceleration : player.RelativeSpeed/0.5;
Example to Totally stop a vehicle acceleration : player.RelativeSpeed = 0;

Gudio

You will notice new speed when you're in the air. You can test it by pressing spacebar to jump but don't forget to set speed while falling down.

Sorry for such a late reply, but I forgot my password here and I couldn't get it via e-mail due to bad configuration on this forum (I reported it few days ago).

Fjose

thanks guys for their replies. when I had time I'll test the suggestions. :P

Fjose

sorry for bump my own topic, today I've tested honey suggestions and I got an error..

"Member Variable not found"

1) player.RelativeSpeed = 0;

2) player.RelativeSpeed / 0.5;

maybe not exists these functions :(

Honey


Fjose

Quote from: Honey on Nov 26, 2014, 11:34 AMIt's Vehicle.RelativeSpeed

and why you said player.RelativeSpeed '-'
two examples with player.RelativeSpeed and one with player.Vehicle.RelativeSpeed.

anyway I want the speed only for the player, no for player inside vehicle, maybe this function was not added :/ because the only one is player.AddSpeed but this callback doesn't exists

Honey

player.AddSpeed does exist but only .Z Vector which makes the person fly in the air ( metaphorically )

Fjose

I have not more option to wait for that function :/

Topic Locked. Definitely

Stormeus

Overriding lock to clarify because there have been a lot of wrong answers here.

There are two ways of dealing with a player's speed:
  • player.Speed - a Vector which can be accessed to get their velocity, and set to a Vector to change their velocity.
  • player.AddSpeed(Vector offset) - a function which is used to add to the player's existing speed

If you wanted to throw a player into the air, you would have a few options:

player.Speed.Z += 15.0;
or
player.Speed += Vector(0.0, 0.0, 15.0);
or
player.AddSpeed(0.0, 0.0, 15.0);

If these functions absolutely do not work, post the error and we'll figure out from there if it is a bug or a script error.