Home   Help Search Login Register  

Author Topic: How do I geta car to start on its side?  (Read 1727 times)

0 Members and 1 Guest are viewing this topic.

Olphy

  • Guest
Re:How do I geta car to start on its side?
« Reply #15 on: 14 Jan 2004, 00:08:30 »
Okay, I just wrote a quick script to do this (I needed it for myself anyway):

flipcar.sqs:

Code: [Select]
_car = _this select 0
_offset = _this select 1

_dir = getdir _car
?(_this select 2) == 1 : _dir = 90 + getdir _car

_wedge = format["%1",typeof _car] camcreate [0,0,0]
_wedge setdir _dir
_wedge setpos [(getpos _car select 0) + _offset*cos (_dir), (getpos _car select 1) + _offset*sin (_dir) , 2]
_car setpos  [getpos _car select 0, getpos _car select 1, 7]

_wedge setvelocity [0,0,10]

~5
deletevehicle _wedge

It is called like this: [vehicle, offset, 0 or 1]

vehicle is the car/bus/truck to be flipped
offset is a number that you have to fiddle with yourself until you find a number that will flip the car (usually around 0.8-1.5)
0 or 1 explained below

What this script does is it makes another vehicle of the same type as the one you pass it, then it moves your vehicle into the air, moves the new one beneath it, and launches the new vehicle upwards at your vehicle. If you get the offset right, this will flip the car so it lands either on its side or on its top. Normally the new vehicle is created parallel to the old one (facing the same direction, either to the left or right of the old one, depending on the sign of your offset). If you place a 1 in the last slot of the array, the new vehicle will be placed perpendicular to the old one, and either in front of or behind the old vehicle, depending on the sign of your offset (think the top of a T). With some vehicles it is easier to flip it on its top using this method. After 5 seconds the new vehicle (the one used to flip the other) will be deleted.

Here are some examples:

To flip a 5t truck or bus on its side: [this, 1, 0] exec "flipcar.sqs"
To flip a car on its back: [this, 1.7, 1] exec "flipcar.sqs"
To flip a car on its side: [this, 1.2, 0] exec "flipcar.sqs"

I must say that looks pretty impressive and I'm gonna give that one a try as soon as I can.

Thanx. Ill let u know if it works or not. Cheers mate! ;)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:How do I geta car to start on its side?
« Reply #16 on: 14 Jan 2004, 02:36:41 »
10/10 for General Barron, this is the first time I've seen a satisfactory answer to this one.  :thumbsup:
Plenty of reviewed ArmA missions for you to play

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:How do I geta car to start on its side?
« Reply #17 on: 14 Jan 2004, 05:21:06 »
 :wave:

Thank you, thank you! You're too kind!

*takes a bow*
:moon:
 :tomato:

-edit
  Though after trying out the script a little more, it seems that it only works sometimes, but not always. The randomness should be nice for most uses, but if you want to have something very specific/precise like the truck blocking an enterence, you may have to try something else.
« Last Edit: 14 Jan 2004, 05:24:41 by General Barron »
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!