Home   Help Search Login Register  

Author Topic: Helicopter Hunting Script  (Read 2188 times)

0 Members and 1 Guest are viewing this topic.

Offline Landdon

  • Members
  • *
Helicopter Hunting Script
« on: 04 Jun 2007, 07:12:17 »
Code: [Select]
;;Only execute on Server, requires gamelogic named server in mission
;;?!(local Server): exit

;;Variables

;;Name of Downed Pilot
_track = leader f_GrpBLU11A

;;Helicopter Name as read in from function param
_Chopper = _this select 0

;;Name of onboard squad
_Squad = _this select 1

;;Distance nearest East Infantry starts from Downed Pilot
_Distance = 3000

@time>1
~60
_Chopper setfuel 1
_Chopper doMove (getpos Wreck)
_Chopper flyinheight 50
@unitready _Chopper

#B1
;;Get Random Distances of Waypoint from Wreck Site
;;***************************************************************************************************
;;Get Random Distance Horizontal
_RandX = Random _Distance

;;Get Random Distance Vertical
_RandY = Random _Distance

;;Determine Random Bearing of waypoint from Wreckage (1 of 4 quadrants)
;;***************************************************************************************************
_Select = Random 4
? (_Select >= 0) AND (_Select < 1): goto "B1A"
? (_Select >= 1) AND (_Select < 2): goto "B1B"
? (_Select >= 2) AND (_Select < 3): goto "B1C"
? (_Select >= 3) AND (_Select < 4): goto "B1D"
;;***************************************************************************************************
;;North East Quadrant
#B1A
_Chopper doMove[(getpos Wreck select 0)+_RandX,(getpos Wreck select 1)+_RandY,getpos Wreck select 2]
goto "B2"

;;***************************************************************************************************
;;South East Quadrant
#B1B
_Chopper doMove[(getpos Wreck select 0)+_RandX,(getpos Wreck select 1)-_RandY,getpos Wreck select 2]
goto "B2"

;;***************************************************************************************************
;;North West Quadrant
#B1C
_Chopper doMove[(getpos Wreck select 0)-_RandX,(getpos Wreck select 1)+_RandY,getpos Wreck select 2]
goto "B2"

;;***************************************************************************************************
;;South West Quadrant
#B1D
_Chopper doMove[(getpos Wreck select 0)-_RandX,(getpos Wreck select 1)-_RandY,getpos Wreck select 2]
goto "B2"


#B2
;;Helicopter at waypoint?
?(unitready _Chopper): goto "B1"

;;Check if Heli saw RescueSquad/Pilot, if so skip to B3...if not get next waypoint
?(((_Chopper Knowsabout Pilot) > 0) AND (Alive Pilot)): _track = Pilot; goto "B3"
?(((_Chopper Knowsabout W1) > 0) AND (Alive W1)): _track = W1; goto "B3"
?(((_Chopper Knowsabout W2) > 0) AND (Alive W2)): _track = W2; goto "B3"
?(((_Chopper Knowsabout W3) > 0) AND (Alive W3)): _track = W3; goto "B3"
?(((_Chopper Knowsabout W4) > 0) AND (Alive W4)): _track = W4; goto "B3"
?(((_Chopper Knowsabout W5) > 0) AND (Alive W5)): _track = W5; goto "B3"
?(((_Chopper Knowsabout W6) > 0) AND (Alive W6)): _track = W6; goto "B3"
?(((_Chopper Knowsabout W7) > 0) AND (Alive W7)): _track = W7; goto "B3"
?(((_Chopper Knowsabout W8) > 0) AND (Alive W8)): _track = W8; goto "B3"
?(((_Chopper Knowsabout W9) > 0) AND (Alive W9)): _track = W9; goto "B3"
?(((_Chopper Knowsabout W10) > 0) AND (Alive W10)): _track = W10; goto "B3"
?(((_Chopper Knowsabout W11) > 0) AND (Alive W11)): _track = W11; goto "B3"
?(((_Chopper Knowsabout W12) > 0) AND (Alive W12)): _track = W12; goto "B3"
?(((_Chopper Knowsabout W13) > 0) AND (Alive W13)): _track = W13; goto "B3"
?(((_Chopper Knowsabout W14) > 0) AND (Alive W14)): _track = W14; goto "B3"
?(((_Chopper Knowsabout W15) > 0) AND (Alive W15)): _track = W15; goto "B3"
?(((_Chopper Knowsabout W16) > 0) AND (Alive W16)): _track = W16; goto "B3"

;;If Helicopter has been notified
?(CallHeli==1): _track=Pilot; goto "B3"

~10
goto "B1"

#B3
;;Call script to have squad start monitoring distance to track and get ready for jump
?(!Alive _track): _track = leader f_GrpBLU11A
_Chopper flyinheight 150
~5
[_Chopper,_Squad,_track] exec "MoveAirborne.sqs"

#B3a
?(!Alive _track): _track = leader f_GrpBLU11A
?(GameLoss==1): exit

;;Set Next Waypoint to Track
_Chopper doMove getpos _track
~10
?(Jumped==1): goto "B3b"
goto "B3a"


#B3b
;;Wait 15 seconds to give plenty of time for all troops to disembark
~15
#B4
;;Give the chopper a waypoint at the tracks location, after 10 seconds update waypoint
;;***************************************************************************************************
;;Check if current tracking unit is dead, if so select the present leader of RescueSquad
?(!Alive _track): _track = leader f_GrpBLU11A
?(GameLoss==1): exit

_Chopper doMove getpos _track
~10
?(!Alive driver _Chopper): exit
_Chopper flyinheight 80
goto "B4"

MoveAirborne.sqs

Code: [Select]
;;This script will eject the airborne screw from the heli and have them start tracking the enemy squad on the ground
;; It is called from Moveheli.sqs

;;Helicopter name
_Chopper = _this select 0

;;Name of onboard squad
_Squad = _this select 1

_track = _this select 2

;;When Chopper is close to tracking object
@((_Chopper distance _track)<400)

;;Eject squad from helicopter at 1 second intervals starting with the officer
E_Heli_1 action["eject", _Chopper]
unassignVehicle E_Heli_1
~1
E_Heli_2 action["eject", _Chopper]
unassignVehicle E_Heli_2
~1
E_Heli_3 action["eject", _Chopper]
unassignVehicle E_Heli_3
~1
E_Heli_4 action["eject", _Chopper]
unassignVehicle E_Heli_4
~1
E_Heli_5 action["eject", _Chopper]
unassignVehicle E_Heli_5
~1
E_Heli_6 action["eject", _Chopper]
unassignVehicle E_Heli_6
~1
E_Heli_7 action["eject", _Chopper]
unassignVehicle E_Heli_7
~1
E_Heli_8 action["eject", _Chopper]
unassignVehicle E_Heli_8
~1
E_Heli_9 action["eject", _Chopper]
unassignVehicle E_Heli_9
~2

;;Notify chopper that squad has jumped
Jumped=1
publicvariable "Jumped"
"[_x] Join GrpNull" forEach units _Squad

#B1
;;Check if current tracking unit is dead, if so select the present leader of RescueSquad
?(!Alive _track): _track = leader f_GrpBLU11A
?(GameLoss==1): exit

?(Alive E_Heli_1): E_Heli_1 domove getpos _track
?(Alive E_Heli_2): E_Heli_2 domove getpos _track
?(Alive E_Heli_3): E_Heli_3 domove getpos _track
?(Alive E_Heli_4): E_Heli_4 domove getpos _track
?(Alive E_Heli_5): E_Heli_5 domove getpos _track
?(Alive E_Heli_6): E_Heli_6 domove getpos _track
?(Alive E_Heli_7): E_Heli_7 domove getpos _track
?(Alive E_Heli_8): E_Heli_8 domove getpos _track
?(Alive E_Heli_9): E_Heli_9 domove getpos _track

~5
?(!Alive _Chopper): goto "B2"
goto "B1"

#B2
?(!Alive _track): _track = leader f_GrpBLU11A
?(GameLoss==1): exit

?(Alive E_Heli_1): E_Heli_1 domove getpos _track
?(Alive E_Heli_2): E_Heli_2 domove getpos _track
?(Alive E_Heli_3): E_Heli_3 domove getpos _track
?(Alive E_Heli_4): E_Heli_4 domove getpos _track
?(Alive E_Heli_5): E_Heli_5 domove getpos _track
?(Alive E_Heli_6): E_Heli_6 domove getpos _track
?(Alive E_Heli_7): E_Heli_7 domove getpos _track
?(Alive E_Heli_8): E_Heli_8 domove getpos _track
?(Alive E_Heli_9): E_Heli_9 domove getpos _track

~20
goto "B2"
« Last Edit: 04 Jun 2007, 17:35:43 by h- »

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Helicopter Hunting Script
« Reply #1 on: 04 Jun 2007, 17:01:00 »
You might want to take a look at GroupLinkII upgraded for ArmA. I used the old version for OFP and it had helicopters that would either drop paras, or land for ai to get out. The ai then move to the last spotted position, with the helicopter acting like an eye in the sky.
« Last Edit: 04 Jun 2007, 17:37:10 by h- »
urp!

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Helicopter Hunting Script
« Reply #2 on: 04 Jun 2007, 17:36:44 »
Landdon, if you post long pieces of code please use the code tags.
I edited your post to include those..

@P
Fixed yer url linkypoo..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline Landdon

  • Members
  • *
Re: Helicopter Hunting Script
« Reply #3 on: 06 Jun 2007, 02:06:16 »
Mr. Peanut,

Thank you Mr. Peanut for you assistance, I have looked into it and indeed it looks like a a viable option.  I was hoping to be able to re-create it as Strango had done, that way it would be completely random thereby not allow player to ambush it.

My apologies H-,  I was not aware of the feature.  Thanks for correcting that for me and I will try and bear that in mind in any future posts.

V/R
Landdon

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Helicopter Hunting Script
« Reply #4 on: 06 Jun 2007, 16:45:48 »
When you say "it does not work" could you please be a little more speciific? Does nothing happen? Does the heli move but the group never disembark? Might be able to help with a few more details.
urp!

Offline Landdon

  • Members
  • *
Re: Helicopter Hunting Script
« Reply #5 on: 08 Jun 2007, 06:35:16 »
Mr. Peanut,

Getting the troops into the helicopter works, but the helicopter just sits there on the ramp.  They way I remember it working in the OFP is it would get up and fly off winging its way back and forth across the island in a random manner.  If you (the coop players) were spotted (detected) then the paratroopeers would jump out and pursue your team.  I have all of the orginal files from Strango's mission, if that would provide any insight on how it works (the Orignal Mission was in OFP).

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Helicopter Hunting Script
« Reply #6 on: 08 Jun 2007, 15:56:21 »
So the troops get in and the helicopter does not even bother to take off or turn on its engines?  :no:

What have you used for Wreck?

It's a long shot but try replacing:
Code: [Select]
_Chopper doMove (getpos Wreck)
_Chopper flyinheight 50
with
Code: [Select]
_Chopper doMove (getpos _Chopper)
_Chopper flyinheight 50
_Chopper doMove (getpos Wreck)
« Last Edit: 08 Jun 2007, 16:16:17 by Mr.Peanut »
urp!

Offline Landdon

  • Members
  • *
Re: Helicopter Hunting Script
« Reply #7 on: 09 Jun 2007, 01:26:27 »
Wreck is the down US Helicopter, I will try it.  Thanks. I'm crossing my fingers.