Home   Help Search Login Register  

Author Topic: split gunner from pilot in script, then set behaviour for each?  (Read 453 times)

0 Members and 1 Guest are viewing this topic.

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
hi all ;D

I know u can do this by placing a seperate dude as pilot then another as gunner and tell em to each moveindriver and moveingunner and set each ones behaviour respectively---But I need to do this in a script where the map maker has placed a single "manned" not "empty" chopper.

I know its possible cause bremmer did it in his AIcontrol script for retreating troops--he used a global variable "yellow".

BUT
#1. Im not able to extrapolate on bremmers code and apply it to chopper scenario-- its a bit hard for me :'(

#2 I dont wanna  use a global variable  cause the script Im applying this to is gonna be run by multiple choppers at differing times:o


Here some code of what bremmer used:

Code: [Select]
#single
   ;get the name, units and number in the group
   _units = units group _unit
   _count = count _units
   _group = group _unit
   ? _count < 4 : goto "general_retreat1"

   ;create a new group leader
   _select = (_count / 2) - ((_count / 2) % 1)
   _unit = _units select _select
   [_unit] join grpnull
   yellow = group _unit
   _select = _select + 1

#assign
   ;assign half the existing group to the new group
   _unit = _units select _select
   [_unit] join yellow
   _select = _select + 1
   ?_select < _count : goto "assign"

   ;reassign the group tags
   _group1 = group (_units select 0)
   _group2 = group _unit
   _groups = [_group1, _group2]
   _group1 = _groups select 0
   _group2 = _groups select 1


I cant seem to get my head around it and apply it to a chopper so I can set pilot to different behaviour to gunner cause they are grouped to each other.

Any help appreciated ;D

Zay out

"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"

Offline Zayfod

  • ECP Team
  • *
  • Llama, softest natural fibre in the world.
This works  ;D

Code: [Select]
   _groups = _this select 1
   _helo = _this select 2
   _helocrew = crew _helo
                _gunner = _helocrew select 1
   [_gunner] join grpnull
   _gunners = []
   _gunners = _gunners + [_gunner]
                _gunner = _gunners select 0


weeeeeeeeeeeeee ;)

Zay out

dont ya just love answering your own questions?
"I have come here to kick ass and chew bubble gum......an I'm all outta bubble gum!"