Jump to content
Sign in to follow this  
barbolani

Check who's the second in command

Recommended Posts

Hello,

In SP missions I want to set playable all the units in the player group, so when you die, you have as many "lives" as units are in your group.

But, what I dislike of this system is, when you control the new unit, after dying, this unit may not be the group leader, and that's undesirable due to lots of supports options, triggers etc..

My ide is to make a script that makes setplayable the second in command.

But I don't know how to check who's the second in command.

Help?

Thanks in advance!

Share this post


Link to post
Share on other sites

I think you can teamswitch as often as you like. So when you die and accidentally don't switch into the groupleader than you can do so just by pressing u and selecting the leader from the list. (He is even marked as group leader.)

Share this post


Link to post
Share on other sites

No problem. If you need to re-add supports by script after your groupleader was killed check this thread.

Or feel free to take my adaption of Larrows post there:

waitUntil {!(isNull player)};
_grp = group player;

while {(count units _grp) > 0} do {
_ldr = leader _grp;

waitUntil{!alive _ldr};

_oldUnit = _ldr;
_oldProviders = _oldUnit getVariable ["BIS_SUPP_allProviderModules", []];
_HQ = _oldUnit getVariable ["BIS_SUPP_HQ", nil];

waitUntil{((leader _grp) != _ldr) && ((leader _grp) == player)};
_ldr = leader _grp;

if ((count _oldProviders) > 0) then {
	{
		_providerModule = _x;
		{
			if (typeOf _x == "SupportRequester" && _oldUnit in (synchronizedObjects _x)) then {
				[_ldr, _x, _providerModule] call BIS_fnc_addSupportLink;
			};
		} forEach synchronizedObjects _providerModule;
	} forEach _oldProviders;
};

{
	_used = _oldUnit getVariable [format ["BIS_SUPP_used_%1",_x], 0];
	_ldr setVariable [format ["BIS_SUPP_used_%1", _x], _used, true]
} forEach [
	"Artillery",
	"CAS_Heli",
	"CAS_Bombing",
	"UAV",
	"Drop",
	"Transport"
];

_ldr setVariable ["BIS_SUPP_transmitting", false];
_ldr kbAddTopic ["BIS_SUPP_protocol", "A3\Modules_F\supports\kb\protocol.bikb", "A3\Modules_F\supports\kb\protocol.fsm", {call compile preprocessFileLineNumbers "A3\Modules_F\supports\kb\protocol.sqf"}];

if (!(isNil "_HQ")) then {
	_ldr setVariable ["BIS_SUPP_HQ", _HQ];
};
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×