Jump to content
Sign in to follow this  
fortun

Making a car already moving when entering the mission

Recommended Posts

Remember on Arma 2 where i had that, but cant remember the code for it. I want the Car that is driven by AI to be on its way when im entering the mission, so it dont need to start up the engine and all that. But whats the code for it?

Share this post


Link to post
Share on other sites

Try using setVelocity. Experiment to get a fairly natural starting speed. The AI should be capable of recovering and driving on normally.

If you don't like the sudden lurch it gives the vehicle, you can hide it from your players by having your mission fade in from black. To do that, use cutText or similar by displaying no text but making use of "BLACK IN" for a fade-in effect. (Not that I've tested cutText much in ArmA 3.)

Finally, if you want a player-driven vehicle to be moving at the start of a mission (not what you're asking but I may as well mention it), use engineOn in addition to the above.

Share this post


Link to post
Share on other sites

Thanks, will test it out. I have in my mind though that it was something easier, where it all just worked fine when starting, and the vehicle was moving in its direction (Was a chopper) in its normal speed with its natural speed without having to adjust it.

But i formated my computer so can't get the mission file back from Arma 2 and look at the Code. Hope someone have a clue about it.

Share this post


Link to post
Share on other sites

Anyone? Really need this one to work for my mission i have, seems a bit weird without it hehe

*I want the car/boat to be moving when i enter the mission so it doesen't need to startup and gain speed

Share this post


Link to post
Share on other sites

Bump*

Another mission where i need heli to move, after two month still not any answer in this thread. Would really need something to make this happen.

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/setVelocity

as said previsouly....

This script sets the vehicle speed to 80% of maxSpeed.

_maxSpeed = getNumber(configFile >> "CfgVehicles" >> typeOf _vehicle >> "maxSpeed");
_vel = velocity _vehicle;
_dir = direction _vehicle;
_speed = _maxSpeed * 0.8;

_vehicle setVelocity [(sin _dir*_speed),cos _dir*_speed),(_vel select 2)];

Share this post


Link to post
Share on other sites

Is it for a SP mission? Then using setAccTime might help. Give the vehicle a normal move waypoint, and setAccTime in your init.sqf (while fading from black). This gives the vehicle more time to actually be moving before you fade in and and setAccTime back to 1.

Don't think it will work in MP though.

Share this post


Link to post
Share on other sites

edit: wrong thread

Edited by Tomsz

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  

×