Home   Help Search Login Register  

Author Topic: Help! AI infantry does not respond after HALO jumping!  (Read 1374 times)

0 Members and 3 Guests are viewing this topic.

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Explanation of problem:

I created a script to simulate HALO jumping from a C-130.  When the C-130 enters the area of a trigger located in its flight path, the HALO script is executed, which causes 2 infantry squads to make the jump.  The script simply moves the infantry to a position 2 meters below the plane, with an X and Y axis deviation of +/- 2 meters just so that the line of jumpers isn't perfectly straight.  As each infantry unit is forced out, a second script is executed for each individual unit.

This second script uses the @ command to wait until that individual unit is 75 meters in altitude.  At this time, it spawns a parachute with the camCreate command and moves the unit into the driver position of the parachute.

Every units lands safely.  However, once on the ground, they no longer respond to the leader's orders.  I can order them to change their behavior, combat mode, speed mode, and formation, but they refuse to move.  They won't return to formation, and they won't move to anywhere that I order them to move.

Additionally, if I give a waypoint to a completely AI-controlled squad, they do not move, either.  So, it's not just because I'm a player-leader--this problem applies to AI and human-controlled squads alike.

Does anyone know how to get around or fix this problem?
Ranger

Offline Skumball

  • Members
  • *
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #1 on: 02 Dec 2002, 21:59:24 »
It might be because you have issued orders to the leader of the group. I mistakenly included the leader in a looping script which went through the whole group and when I tried to issue an order afterwards to fall back into formation they did not follow the leader. The voice said something like "All follow group" instead of "fall back into formation". With the looping script I just started the _i = 0 variable at _i = 1, thereby skipping the leader.

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #2 on: 02 Dec 2002, 23:21:32 »
It might be because you have issued orders to the leader of the group. I mistakenly included the leader in a looping script which went through the whole group and when I tried to issue an order afterwards to fall back into formation they did not follow the leader. The voice said something like "All follow group" instead of "fall back into formation". With the looping script I just started the _i = 0 variable at _i = 1, thereby skipping the leader.

Hmm, could be so.  I don't recall what the radio message was afterward, but I do remember that the squadmates asked, "Where are you?"

So, how does not including the leader help any of this?  I'll have to try it and find out later.

Of course, I wasn't literally issuing orders to the leader, though.  The script just moves them outside of the plane, which lets them fall, and then moves them into the parachutes.

In any event, what do you suggest for getting the leader to HALO jump without including him in that loop?  Would it work to just have a separate bit of code to handle him specifically?

Thanks for your reply.
Ranger

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #3 on: 03 Dec 2002, 01:08:47 »
Sounds to me like you need to unassign your soldiers from the aircraft.

If your simply throwing them out of the aircraft without unassigning them, the aircraft will try to land, and they'll try to get back in. From what I've heard of the herc, it can't land anywhere apart from the desert, so in effect your guys will just sit there (as they can't get back in).

Try using:

unassignvehicle unit

for all your guys. Or even better:

"unassignvehicle _x" foreach [ unit1,unit2,unit3... etc. ]

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #4 on: 03 Dec 2002, 01:18:09 »
Try using:

unassignvehicle unit

for all your guys. Or even better:

"unassignvehicle _x" foreach [ unit1,unit2,unit3... etc. ]

I didn't mention it above, but I have already unassigned them as they jump.  Do you think I should also use orderGetIn false?

Thanks for the reply.
Ranger

Offline Skumball

  • Members
  • *
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #5 on: 03 Dec 2002, 01:59:44 »
could you post your script for us to look at?

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #6 on: 03 Dec 2002, 02:58:58 »
Sure thing.  My main script is as follows:

Code: [Select]
;===========================================================================================
; Usage: [vehicle,squad1,squad2,squad3,...,squadN] exec "HALO.sqs"
;
; This script takes the passed group names and causes them to perform a HALO jump from
; the passed vehicle.
;===========================================================================================

; Error checking.

? count _this < 2 : hint ["HALO.sqs error: too few parameters."]

; Assign the vehicle and squads to their respective variables.

_aircraft = _this select 0
_squads = _this - [_this select 0]

_numSquads = (count _squads) - 1

; Initialize the _units array.

_units = []

#GetUnits

; Assign the units of the squad to a local variable.

_units = _units + units (_squads select _numSquads)

_numSquads = _numSquads - 1

; If _numSquads is >= 0, then loop.

? _numSquads >= 0 : goto "GetUnits"

#CountUnits

; Count the number of units in the squad.

_numUnits = (count _units) - 1

#Jump

; If there are no units left, then exit.

? _numUnits < 0 : exit

; Get the position of the aircraft at the moment that a unit jumps.

_pos = getPos _aircraft

_cx = _pos select 0
_cy = _pos select 1
_cz = _pos select 2

; Set the squad member's position to the same as the aircraft, but 1 meter lower.
; Randomize it slightly so that it's not too perfect.

(_units select _numUnits) setPos [_cx + random(4) - 2,_cy + random(4) - 2,_cz - 1]

; Unassign the unit from the vehicle, or else the leader will order him back in.

unassignVehicle (_units select _numUnits)

; Cause unit to exec the script to make it open its chute.

(_units select _numUnits) exec "OpenChute.sqs"

; Delay briefly so that the units don't hit each other while falling or parachuting.

~0.2

; Decrement _numUnits.

_numUnits = _numUnits - 1

goto "Jump"

The OpenChute.sqs script is as follows:

Code: [Select]
;===========================================================================================
; Usage: unit exec "OpenChute.sqs"
;
; This script takes the passed unit and forces it to "open" a parachute when it falls to
; an altitude of 75 meters.
;===========================================================================================

; Wait until the unit is at 75 meters in altitude.

@ (getPos _this) select 2 < 75

_tempObj = "ParachuteWest" camCreate getPos _this

_this moveInDriver _tempObj

Thanks again.
Ranger

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #7 on: 03 Dec 2002, 06:11:42 »
I tried not making the leader jump, and I also tried using orderGetIn false, and neither of these ideas fixed the problem.  Any other thoughts?
Ranger

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #8 on: 03 Dec 2002, 12:17:29 »
da prob is dt u cant setpos units out of a vehicle - it kills da AI

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #9 on: 03 Dec 2002, 18:31:22 »
da prob is dt u cant setpos units out of a vehicle - it kills da AI

LCD OUT

Thank you, LCD.  That answers exactly why it won't work.

Is there some way to get the units to eject from the plane without opening a parachute?

Actually, you might not be totally correct.  I did a workaround that still involves setPosing the units out of the plane.  However, instead of creating a parachute and moving the units into it, I did the (lame) helicopter trick, where you setPos a helicopter to the unit's position, moveInCargo the unit, force the unit to eject, and then setPos the helicopter somewhere far away.

This allows every unit to parachute at the end of the HALO jump, and the AI still functions properly after everyone lands.

Thanks everyone for your replies so far.
Ranger

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #10 on: 03 Dec 2002, 23:32:40 »
Quote
force the unit to eject

EJECT

u c ? totaly right  :P

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Help! AI infantry does not respond after HALO jumping!
« Reply #11 on: 03 Dec 2002, 23:50:39 »
EJECT

u c ? totaly right  :P

I think you misunderstood my question.  Is there any way to get a unit out of an aircraft other than forcing a unit to eject?  If I force them to eject from the C-130, then they'll open parachutes immediately.  That's what I'm wondering.

Whatever the case, I guess I'll just have to use the helicopter workaround.  It works, but it just seems stupid that I have to do that.

Thanks for your help, everyone.
« Last Edit: 03 Dec 2002, 23:51:50 by Ranger »
Ranger