Home   Help Search Login Register  

Author Topic: Help with Heli  (Read 909 times)

0 Members and 1 Guest are viewing this topic.

Offline Killzone

  • Members
  • *
  • War is the true Enemy
Help with Heli
« on: 09 Jul 2004, 20:03:06 »
Hi alll

I recently wrote a script for a heli to come extract my player from where ever on the map so that it can take me back to the U.S.S. Nimtiz  it works fine except when the heli lands I have it so a soldier gets out to secure the landing site and shoot any bad guys this works fine but the problem is when he goes to board the heli the heli lifts off about 10m  then lands again is there a way I can stop this from happening. I tried using negative numbers but that dont work. I wrote this script to force myself to continue to learn how to script so it may be ugly to some but it does what  it is designed to do except that one problem.   >:(

Here is the script:

#loop
mark = "HeliHEmpty" createVehicle getPos sean;  mark setpos [(getPos sean select 0) + (1), (getPos sean select 1) + (1), 0]

fred domove getpos mark


heli setspeedmode "limited"


? heli distance sean <150: goto "height"; hint"Scanning area for landing position."; heli setvelocity [0,0,0]

~8

goto "loop"


#height

fred domove getpos mark

Fred flyinheight 30

? heli distance sean <80: goto "height2"

~6

goto "height"

#height2

hint" Alpha-1 is landing, Let's go soldier!!!"
heli setvelocity [0,0,0]


heli setvelocity [0,0,0]

Heli flyinheight 20

~4

Heli flyinheight 5

~4

;Heli flyinheight 5

~4

Heli flyinheight 1

~5

unassignVehicle bob

~5

bob assignascargo heli
Heli flyinheight -1

~2

[bob] ordergetin true       (this is where the heli lifts off about 10m  >:(
Heli flyinheight -1


end
 


Thanks as always for the help.  :)  
"Everyone dies so deal with it and move on"

                                                      ME

PsyWarrior

  • Guest
Re:Help with Heli
« Reply #1 on: 09 Jul 2004, 22:14:38 »
Greetings, Killzone

You may want to try adding the line

heli land "LAND"

in place of that last

Heli flyinheight -1

That you have. It will command the chopper to stay on the ground, and kill the engines.

Place down an 'invisible H' object where you want the chopper to land, or place one on the map and move it to the landing position. This is good practive when using the land command, as it makes the chopper behaviour a little more predictible. But note the use of the word 'little'... ;) :P

Alternatively, use "GET IN" or "GET OUT" instead of "LAND" to keep the engines running, althogh this may not prevent the chopper from flying up.

Alternatively ( ::)), you could run a 0.1 second loop scanning for any movement away from the invisible H (helo distance invH >2), and then kill the chopper's velocity if movement occurs (helo setVelocity [0, 0, 0]).

It's not a bad script for a 'learner', actually. Given time, you'll find your own scripting style and discover just what is possible in OFP with sqs scripts...

Good luck in your scripting 'career' Killzone! :thumbsup:

Reference: OFPEC Online COMREF:
http://www.ofpec.com/editors/comref.php?letter=L
EDIT: snYpir's "Quick Helicopter Landings"
http://www.ofpec.com/editors/resource_view.php?id=316

-Supreme Commander PsyWarrior
-Psychic Productions C-in-C

P.S. - You may also want to examine this script:
http://www.ofpec.com/editors/resource_view.php?id=316

Normally, I would direct you to this immediately, but as you are using the script as a learning process, rather than just to achieve the results, you may just want to look at how snYpir did it.
« Last Edit: 09 Jul 2004, 22:19:35 by PsyWarrior »

Offline Killzone

  • Members
  • *
  • War is the true Enemy
Re:Help with Heli
« Reply #2 on: 10 Jul 2004, 03:10:56 »
Thanks for the help PsyWarrior. I will give it a try ;D
"Everyone dies so deal with it and move on"

                                                      ME