Jump to content
LukasKr

Increasing a vehicles top speed

Recommended Posts

Hello fellow Arma3-Editors,

 

Obilgatory im am relativly new at editing and scripting in Arma3,

I have been trying over the past few days to improve a Vehicles top speed (in this case an SDV's). I attempted to use the setVelocity script from example 2:

_vel = velocity _vehicle;

_dir = direction _vehicle;

_speed = 10; comment "Added speed";

_vehicle setVelocity [

       (_vel select 0) + (sin _dir * _speed), (_vel select 1) + (cos _dir * _speed),

       (_vel select 2)

];

modified it slightly for the need, but never got it to work the way i intended it to: a permant speed increase when the SDV is used. So the question that i have is a two-parter:

 

1. Can i achive my goal of giving the vehicle a permanent speed-buff only in the editor without needing to write seperate scripts?

 

2. No matter if the answer to the first question is yes or no, i kindly asked to be told which steps i need to take to achieve this

Share this post


Link to post
Share on other sites

I think the only true way to increase the speed would be to make an addon and change the speed characteristics of that vehicle.

From a scripting perspective, you can certainly set the velocity of any object, but you have to loop it. Something like this:

 


while { alive _vehicle } do

{

 sleep 0.1;

 _vel = velocity _vehicle;

 _dir = direction _vehicle;

 _speed = 10; comment "Added speed";

 _vehicle setVelocity [

       (_vel select 0) + (sin _dir * _speed), (_vel select 1) + (cos _dir * _speed),

       (_vel select 2)

 ];

};

 

I wouldn't do this if players are in the SDV because it will have a somewhat jerky motion, could cause nausea 😉

There may be other solutions, this is just something I have done for moving a large sub around in the water.

 

Share this post


Link to post
Share on other sites
5 minutes ago, AZCoder said:

I think the only true way to increase the speed would be to make an addon and change the speed characteristics of that vehicle.

From a scripting perspective, you can certainly set the velocity of any object, but you have to loop it. Something like this:

 

 


while { alive _vehicle } do

{

 sleep 0.1;

 _vel = velocity _vehicle;

 _dir = direction _vehicle;

 _speed = 10; comment "Added speed";

 _vehicle setVelocity [

       (_vel select 0) + (sin _dir * _speed), (_vel select 1) + (cos _dir * _speed),

       (_vel select 2)

 ];

};

 

 

I wouldn't do this if players are in the SDV because it will have a somewhat jerky motion, could cause nausea 😉

There may be other solutions, this is just something I have done for moving a large sub around in the water.

 

this of course complicates things since im trying to implement this in a multiplayer-mission, thanks for the advice ill look into it🙂

Share this post


Link to post
Share on other sites

You could do something like this I guess :shrug:

["ehname", "oneachframe", {
    private _vehicle = _this # 0;

    if (alive _vehicle && {speed _vehicle < 50}) then {
         private _vel = velocity _vehicle;
         private _dir = direction _vehicle;
         
        if (inputAction "submarineForward" > 0) then {
            _vehicle setVelocity [
                (_vel # 0) + 0.01*(sin _dir),
                (_vel # 1) + 0.01*(cos _dir),
                _vel # 2
            ];
        };
    };
}, [_vehicle]] call BIS_fnc_addStackedEventHandler

That should allow the vehicle speed up until it hits 50km/h. Untested so mileage may vary.
I'd assume in MP execute that locally to the driver. Also if using CBA you could use their perFrameHandler instead.

  • Like 2

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

×