OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Resources Beta Testing & Submission => Topic started by: norrin on 04 Feb 2009, 01:50:41

Title: Unflip/right flipped vehicle action (ACCEPTED)
Post by: norrin on 04 Feb 2009, 01:50:41
Unflip/right flipped vehicle action

Description
This is a very simple script that gives a player an action to right an empty overturned car if he walks up next to it.

Acknowledgements
I must thank alef for the code to detect whether a vehicle was upright or on its side.

To implement
1. Copy across the unflip folder from the test mission to your mission.
2. Copy the lines from the init.sqf in the test mission into the init.sqf in your own mission

How to use
Walk up to a flipped car and make sure no one is in it, after a second or so you'll get an action to "right vehicle", then just use it and the car will flip back onto its wheels.

Background
One of my clan members has a habit of rolling any Humvee he comes in contact with and he asked me to make this.

Possible changes
At the moment this script will only work with the car class but this could be easily changed.  The condition that the vehicle is empty can also be easily changed.

EDIT: OK, I've removed the debug hint from the code that I accidentally left in and the dependence on QG for the test mission.  I've also changed the code using a modification of a suggestion by rommel (thanks mate) so that the vehicle upright code (setPos) runs locally to where the vehicle exists - in this case as its empty, local to the server.  

see version 2 below

OFPEC DOWNLOAD (http://www.ofpec.com/ed_depot/index.php?action=details&id=594)
Title: Re: Unflip/right flipped vehicle action
Post by: hoz on 06 Feb 2009, 19:04:36
Tried it out. Its pretty cool. Just the flipped vehicles in itself is cool and would be excellent objects to place.
I'm not sure the action "Right Vehicle" is appropriate though, I think UnFlip vehicle sounds better.

I think you should add the ability to flip the vehicles and have the ability to flip them onto their roofs as well.

Title: Re: Unflip/right flipped vehicle action
Post by: Mandoble on 06 Feb 2009, 19:52:45
Well, what to say ...  :blink:
Is this this so common to find flipped vehicles in ArmA?  :blink: :blink: :blink:
Anyway, check this (http://www.ofpec.com/forum/index.php?topic=29432.0), probably you can improve a lot that unflip action with it (smooth unflipping over the same position), or even adding also the corresponding flip action too.
Title: Re: Unflip/right flipped vehicle action
Post by: hoz on 06 Feb 2009, 19:56:52
Actually its always a problem when its flipped and you need to go get some milk. It always happens at the wrong time. You might want to add a check to only present the dialog when the vehicle is actually flipped over.

Another use I thought of was you could flip a vehicle for cover.
Title: Re: Unflip/right flipped vehicle action
Post by: norrin on 06 Feb 2009, 20:59:39
Thanks for looking at this guys and your suggestions :)  I'll see what I can do and post another version.
Title: Re: Unflip/right flipped vehicle action
Post by: Worldeater on 06 Feb 2009, 23:56:31
Quote
Is this this so common to find flipped vehicles in ArmA?

Yes, it is. At least when playing online. Most of my cars end up being parked either on their side mirrors or roofs.
Title: Re: Unflip/right flipped vehicle action
Post by: Mandoble on 07 Feb 2009, 00:10:52
I see  :-[ (Definitively I should play ArmA more than once per year).
Norrin, being that the case I think your current script is valid as it is, you may consider to apply smoother rotation but certainly it is not really needed for the purpose of the script itself and the game problem it solves. It works well in its current stage.

I assume this effect doesnt happen to crewed vehicles in ArmA, right?

EDIT:
I suppose this might happen to spawned empy vehicles only, right? If so, and instead of adding actions, you might consider the following: Once every 20 seconds a script is run server side, it checks "vehicles" global array, looks for the non destroyed empty vehicles that are overturned and unflips them automatically.
Title: Re: Unflip/right flipped vehicle action
Post by: i0n0s on 07 Feb 2009, 00:33:07
This happens to all kind of vehicle, especially to player controlled one ;)
But the AI has those problems too. Tanks and APCs can jump and flip inside missions due the "physic engine" ArmA uses. And there are already addons out there which are watching that this don't happens to AI controlled vehicles.
Title: Re: Unflip/right flipped vehicle action
Post by: Xeno on 07 Feb 2009, 02:11:34
And, to add to iOnOs comment...

there are even missions out there for a long time that have some engineers that can unflip those vehicles or add "no flip" functionality directly to AI controlled vehicles :)
Title: Re: Unflip/right flipped vehicle action
Post by: hoz on 07 Feb 2009, 02:19:31
Good point. Add a option to limit it to specific units.
Title: Re: Unflip/right flipped vehicle action
Post by: norrin on 07 Feb 2009, 03:35:00
Will do hoz :)

In the past I have seen the ATOT system: http://www.armaholic.com/page.php?id=3837 and the accompanying movie gives a really nice example of how it works and why it is needed but I must admit I wasn't aware that this feature was already in place in some missions as I'm a bit like Mandoble and spend a very small amount of my time actually playing ArmA.  When I do its with my clan and most of the time its in fairly small team made co-ops maps. I did check both OFPEC and armaholic before originally posting here and could not find any scripts that fit the bill so if I have overlooked someone else's work in posting this I do apologise.
Title: Re: Unflip/right flipped vehicle action
Post by: alef on 03 Apr 2009, 10:46:48
The UnFlip action was added to ACE mod honda quad, which usually flipped as you drive high slopes.
Because the quad is relatively light, a human alone would be able to flip it.

Title: Re: Unflip/right flipped vehicle action
Post by: Sparticus76 on 07 Apr 2009, 02:39:41
This is a great script Norrin, but I dont think it should be restricted to any one soldier type. If I came alont and saw an ATV on its side and wanted to use it, I wouldnt shout out "Engineer! Can you flip this for me!" I'd just flip the thing and get on.
I think a good addition(and realistic) if it could be done is to also flip cars etc, but be required to have more soldiers beside the vehicle and maybe all have to click "flip" and maybe a counter?..2 more per required..1 more pers required? I think one person flipping anything bigger than an ATV is a bit much.