Home   Help Search Login Register  

Author Topic: Flying guy  (Read 823 times)

0 Members and 2 Guests are viewing this topic.

O Neil

  • Guest
Flying guy
« on: 15 Apr 2005, 22:47:14 »
Hey

How would I go about levetating a guy up in the air? And keep him standing on air like, 5 meters high sorta thing.

(O'Neil

Offline Raptorsaurus

  • Editors Depot Staff
  • *****
Re:Flying guy
« Reply #1 on: 16 Apr 2005, 00:31:54 »
Make a looping script that setPos the guy at 5 m.  In the loop also set his velocity to [0,0,0] or else he will tip upside down because the ofp game engine will treat him like he his falling (because he is in the air).  So it would look like this:

Code: [Select]
_man = _this select 0
_height = _this select 1

#loop

_man setPos [getPos _man select 0, getPos _man select 1, _height]
-man setVelocity [0,0,0]
~.01

? alive _man goto "loop"

Save this script in your mission folder with the title "levitate.sqs".

To call this script put this in the init field of the man you want to levitate:

Code: [Select]
[this, 5] exec "levitate.sqs"
You can change the 5 to any number to do different heights.

If you want to have the script called by a waypoint or trigger, then give the man a name, like levitatingMan or something.  Then, in the on activation feild of the trigger or waypoint put:

Code: [Select]
[levitatingMan, 5] exec "levitate.sqs"
This is not tested, but except for possible typos on my part it should work.