Actually got around to doing something that might be useful to any other scripters wanting to do stuff with ALiVE. Wanted to spice up some conventional missions so I dove into trying to mix my scripts into ALiVE's objective system so I could make things like counterattacks and reinforcements when objectives were being attacked/lost (ALiVE does this already but I was going to do some special stuff like paratroopers). Only have two functions right now but I am definitely gonna make more if possible since this is only the beginning of my project. Hopefully these functions don't already exist somewhere, otherwise I wasted my time :|
Anyone who is interested in this type of stuff should also look into a few functions Cameroon made awhile ago.
1. Get's all opcoms that control any of the passed factions
["OPF_F"] call Spyder_fnc_getFactionOpcoms;
returns an array [_opcom,[_factions]] in which _opcom is the logic itself and _faction is an array of the factions that it controls that were picked from the array that was passed into the function (To provide more accurate results if an opcom controls multiple factions). If the opcom controls a single faction, _faction is structured as ["EAST"], if it controls multiple then it is structured as ["EAST","WEST"].
Spyder_fnc_getFactionOpcoms = {
_factions = _this;
_result = [];
{
_opcom = _x;
_factionGroup = [];
_opcomFactions = [_opcom,"factions",[]] call ALiVE_fnc_HashGet;
{
_faction = _x;
if (_faction in _factions) then {
_factionGroup pushBack _faction;
};
} forEach _opcomFactions;
_data = [_opcom,_factionGroup];
_result pushBack _data;
} foreach OPCOM_instances;
_result;
};
2. Get's all opcoms that control any of the passed sides
["EAST"] call Spyder_fnc_getSideOpcoms;
Returns all opcoms that control any of the sides that were passed into the function.. [_opcom,_side]
Spyder_fnc_getSideOpcoms = {
_sides = _this;
_result = [];
{
_opcom = _x;
_opcomSide = [_opcom,"side",""] call ALiVE_fnc_HashGet;
if (_opcomSide in _sides) then {
_data = [_opcom,_side];
_result pushBack _data;
};
} foreach OPCOM_instances;
_result;
};