Jump to content
Sign in to follow this  
resistance-rat

Car is breaking, when mission is loaded

Recommended Posts

Hello everyone,

I've got a problem with mission loading and driving a vehicle.

Everytime I save the game, while driving a car and load it, car brakes itself, even if I'm holding E button.

I tried to fix that with eventHandler, but setVelocity makes car unstable and undrivable for a while.

addMissionEventHandler ["Loaded",{RESRAT_Car setVelocity [((velocity RESRAT_Car) select 0)+(sin (getDir RESRAT_Car)*20),((velocity RESRAT_Car) select 1)+(cos (getDir RESRAT_Car)*20),

((velocity RESRAT_Car) select 2)]}]

Any suggestions, how to force car to do not brake?

Edited by resistance-rat

Share this post


Link to post
Share on other sites

If this is happening on mission load, as in loading of a saved game, I don't see a way to script that reasonably. Play with your keys a bit, I'm sure theres a work around. I'll bet jamming W will do the trick.

Share this post


Link to post
Share on other sites

I've never used addMissionEventHandler ["Loaded",{ but I did test you code in a trigger and it is a bit jerky.

The issue seems to be that you forcing a fixed speed on the vehicle all at once, basically just giving it a kick up the backside.

You could try to smooth it out by placing it in a loop and apply a smaller force over a period of time.

If you can save the original speed or retrieve it on reload you could do something like this.

addMissionEventHandler ["Loaded",{
null=[] spawn {acc = 0.3;sleep 1; while { speed RESRAT_Car <40} do {sleep 0.01;  RESRAT_Car setVelocity [((velocity RESRAT_Car) select 0)+(sin (getDir RESRAT_Car)*acc),((velocity RESRAT_Car) select 1)+(cos (getDir RESRAT_Car)*acc),((velocity RESRAT_Car) select 2)];};};
};];

I've used 40 as default speed but as said it would be better if you could retrieve pre saved speed so the script will force the car to that speed.

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  

×