OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: CptBravo 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
-
Here is a very inefficient but simple method:
Create a script called "ActionHandler.sqs"
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 ;)
-
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