Home   Help Search Login Register  

Author Topic: Addaction to new groupleader?  (Read 1151 times)

0 Members and 1 Guest are viewing this topic.

CptBravo

  • Guest
Addaction to new groupleader?
« on: 26 Nov 2004, 19:27:56 »
Hey guys,

I have a mision where I need a certain Addaction available to group leader. So if he dies it will be come available to new leader.

So how do you add following to new leader action menue automatically??

leader gw1 addaction ["ALL - HOLD FIRE","Combatmode.sqs"];

The simpler the better :)

Thanks in advance

Offline CrashDome

  • Members
  • *
Re:Addaction to new groupleader?
« Reply #1 on: 26 Nov 2004, 20:39:09 »
Here is a very inefficient but simple method:

Create a script called "ActionHandler.sqs"

Code: [Select]
Private ["_unit"]

_unit = _this select 0

@(_unit == leader _unit)

_unit addaction ["ALL - HOLD FIRE","Combatmode.sqs"]

EXIT

then in init line of all units able to become the leader:
[this] exec "ActionHandler.sqs"

I say this is inefficient because all units will be checking if they are the leader every 3 secs.

Better method is to use "Killed" eventhandler, but requires managing of groups and units ahead of time.

Anyway, the above will work if you are desperate ;)

CptBravo

  • Guest
Re:Addaction to new groupleader?
« Reply #2 on: 30 Nov 2004, 20:26:52 »
Hey CrashDome thanks for the response. Having 4 Player controlled squads might cause a bit of lag considering there are other scripts and triggors running in mission as well. So a more effiecient way is more attractive even thought it might not be newB friendly  ;D

So please share your "Killed eventhandler" method.

Thanks