Jump to content
Sign in to follow this  
Joker621

How to assign a speed at "anyvehicle"

Recommended Posts

I'm in trouble to assign a speed at "anyvehicle". I'd like to assign a speed of 5 km/H.

What command must I use? Please, an example will be very appreciate. Thanks in advance.

Share this post


Link to post
Share on other sites

fSetSpeed.sqf => mission directory

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_s","_d","_x","_y"];

_s = (_this select 1)/3.6;

_d = _this select 2;

_x = (sin _d) * _s;

_y = (cos _d) * _s;

(_this select 0) setDir _d;

(_this select 0) setVelocity [_x,_y,0];

[_x,_y,0]

Syntax: [vehicle, speed, dir] call fSetSpeed

init.sqs => mission directory

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fSetSpeed = loadFile "fSetSpeed.sqf"

somescript.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; constantly move a jeep direction North (= 0) with 100 km/h

#loop

[jeep, 100, 0] call fSetSpeed

~0.01

? (alive jeep) : goto "loop"

Share this post


Link to post
Share on other sites

thanks a lot for your help!

best regards.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×