Profiles
Profiles
Needs Virtual AI System
Creates a CfgGroups group as virtual profiles at one marker and gives it a move waypoint to another.
Runs onServerNeedsVirtual AI System
if (!isServer) exitWith {};
waitUntil {!isNil "ALIVE_profileSystemInit"};
private _spawnPos = getMarkerPos "grp_spawn";
private _destPos = getMarkerPos "grp_dest";
// "OIA_InfSquad" is a CfgGroups class of faction OPF_F.
// 4th argument false = place the group exactly at _spawnPos.
// true (the default) lets ALiVE pick a good spot nearby when it spawns.
private _profiles = ["OIA_InfSquad", _spawnPos, random 360, false, "OPF_F"] call ALIVE_fnc_createProfilesFromGroupConfig;
private _waypoint = [_destPos, 0, "MOVE"] call ALIVE_fnc_createProfileWaypoint;
{
if ((_x select 2 select 5) == "entity") then {
[_x, "addWaypoint", _waypoint] call ALIVE_fnc_profileEntity;
};
} forEach _profiles;
- The old wiki's fourth argument meant the opposite, so a true copied from ALiVE 2 code now means 'pick a good spot'.
- The faction is the fifth argument; ALiVE looks the class up as OPF_F_OIA_InfSquad.
A trigger condition that is true while any virtualised OPFOR group, spawned or not, is within 50 m of the trigger.
Runs onServer Only triggerNeedsVirtual AI System
// Trigger condition (tick Server Only in the trigger's attributes)
count ([getPosATL thisTrigger, 50, ["EAST", "entity"]] call ALIVE_fnc_getNearProfiles) > 0
// Virtualised OPFOR vehicles within 500 m instead
count ([getPosATL thisTrigger, 500, ["EAST", "vehicle"]] call ALIVE_fnc_getNearProfiles) > 0
- The query reads server-side data, so the trigger must be Server Only or the condition is false on clients.
Every minute, hands any live unit or vehicle that is not yet profiled to the virtual AI system.
Runs onServerNeedsVirtual AI System
if (isServer) then {
[] spawn {
waitUntil {!isNil "ALIVE_profileSystemInit"};
while {true} do {
sleep 60;
[] call ALiVE_fnc_createProfilesFromUnitsRuntime;
};
};
};
- It leaves players, Combat Support assets and anything flagged
ALIVE_profileIgnore or ALIVE_Convoy alone.
Marks a group (and a lone vehicle) so ALiVE never turns it into a profile or despawns it.
Runs onAny machine (init field) or server scriptNeedsVirtual AI System
// In the group leader's init field:
(group this) setVariable ["ALIVE_profileIgnore", true, true];
// For a lone vehicle, mark the vehicle itself:
this setVariable ["ALIVE_profileIgnore", true, true];
Looks a profile up by the ID stored on a spawned unit and answers whether it is still registered.
Runs onServerNeedsVirtual AI System
MyMission_fnc_profileExists = {
params ["_profileID"];
private _profile = [ALIVE_profileHandler, "getProfile", _profileID] call ALIVE_fnc_profileHandler;
!isNil "_profile"
};
// A spawned unit or vehicle carries its profile ID:
private _id = _unit getVariable ["profileID", ""];
if ([_id] call MyMission_fnc_profileExists) then { /* still in play */ };
- The old wiki's
ALiVE_sysProfile global doesn't exist; the handler is ALIVE_profileHandler, and getProfile is one of its operations.
Reads how many virtual groups and vehicles each side has, for a debug line or a scoring condition.
Runs onServerNeedsVirtual AI System
if (isServer) then {
private _bySide = [ALIVE_profileHandler, "profilesBySide"] call ALIVE_fnc_hashGet;
private _east = count ([_bySide, "EAST"] call ALIVE_fnc_hashGet);
private _west = count ([_bySide, "WEST"] call ALIVE_fnc_hashGet);
private _guer = count ([_bySide, "GUER"] call ALIVE_fnc_hashGet);
private _civ = count ([_bySide, "CIV"] call ALIVE_fnc_hashGet);
diag_log format ["Profiles - OPFOR %1, BLUFOR %2, Independent %3, Civilian %4", _east, _west, _guer, _civ];
};
- Counts include vehicle profiles as well as groups.
Asks whether any virtualised enemy helicopters are within 2 km of a position, without spawning anything.
Runs onServerNeedsVirtual AI System
private _pos = getMarkerPos "base";
private _nearHelis = [_pos, 2000, ["EAST", "vehicle", "Helicopter"]] call ALIVE_fnc_getNearProfiles;
if (count _nearHelis > 0) then {
diag_log "Enemy helicopter activity near the base";
};
- The third selector slot is the vehicle kind ALiVE recorded when it made the profile, such as Helicopter, Plane, Car or Tank.
Adds any object to the list of spawn sources so virtual units near it spawn in even with no player nearby.
Runs onServerNeedsVirtual AI System
if (isServer) then {
waitUntil {!isNil "ALiVE_SpawnSources"};
ALiVE_SpawnSources pushBackUnique myForwardBase; // any object
// When you delete the object, take it out again:
// ALiVE_SpawnSources = ALiVE_SpawnSources - [myForwardBase];
};
- Nothing prunes the list, so remove an object before you delete it.
Turns an editor-placed group and an empty vehicle into profiles that belong together, so the men ride in the vehicle whenever it spawns.
Runs onServerNeedsVirtual AI System
[myLeader, myVehicle] spawn ALiVE_fnc_createProfileVehicleAssignment;
- Use
spawn, not call: the function waits for the virtual AI system to be ready.
- Both are turned into profiles if they aren't already, so the live units are replaced straight away and spawn again as usual when a player is near.
- Needs a development build from 24 Sep 2026 (ee5bfc11) or later. Before that, the group and the vehicle were profiled separately and the men never got in.
Uses CBA's extended init handler so every man that spawns, including ALiVE's, runs your script.
Runs onEvery machine (config)NeedsCBA
// description.ext
class Extended_Init_EventHandlers {
class Man {
init = "_this call (compile preprocessFileLineNumbers 'my_unit_init.sqf')";
};
};
// my_unit_init.sqf
params ["_unit"];
if (isPlayer _unit) exitWith {}; // player persistence restores the player's own gear
if (side _unit == west) then {
// change loadout here
};
- Skip players: anything you add to a player is re-applied on top of what player persistence restores.
← Back to the list
Commanders
Commanders
Needs Military AI Commander
Registers a position as a military objective with one side's commander, or with every commander.
Runs onServerNeedsMilitary AI Commander
// One side. Fire it from a trigger's activation (Server Only) or initServer.sqf.
["EAST", "addObjective", ["my_base_obj", getMarkerPos "my_base", 150, "MIL", 200]] call ALiVE_fnc_OPCOM;
// Every commander:
{
[_x, "addObjective", ["my_base_obj", getMarkerPos "my_base", 150, "MIL", 200]] call ALiVE_fnc_OPCOM;
} forEach OPCOM_instances;
- Arguments: id, position, size in metres, "MIL" or "CIV", priority (higher is more urgent).
- A side reaches the first commander of that side. With two commanders on one side, use a faction or the loop.
- Don't give a marker the same name as the objective id; ALiVE takes such markers over.
- With Persistent on, the commander saves this objective and loads it back. Calling it again at every start is safe: the same id at the same position hands back the objective already there, and the same id at a different position is added as a second objective under that id. Dev builds before 27 Sep 2026 (64918448) gave the commander the objective twice if you called it at every start.
- Call it after the commander has started; it may take a few cycles to act.
- Dev builds from late April to late September 2026 ignored the side form. Use the loop there.
Queues a one-off recon, capture, defend or reserve order at a position for one side's commander.
Runs onServerNeedsMilitary AI Commander
private _opcom = [nil, "findOPCOMByAllegiance", "EAST"] call ALiVE_fnc_OPCOM;
[_opcom, "addTask", ["capture", getMarkerPos "target", []]] call ALiVE_fnc_OPCOM;
- The empty third element lets the commander choose the groups; pass profile IDs to name them.
- Ignored, with a line in the RPT, if the operation is not one of the four or the commander's TACOM is not running yet.
Hands groups to a commander as a one-off ambush or search-and-destroy order at a place, and gives them back to the commander after the time you set.
Runs onServerNeedsMilitary AI Commander (Invasion or Occupation), Virtual AI System
if (!isServer) exitWith {};
waitUntil {!isNil "ALiVE_REQUIRE_INITIALISED"};
private _opcom = [nil, "findOPCOMByAllegiance", "EAST"] call ALiVE_fnc_OPCOM;
private _site = getMarkerPos "ambush_site";
// A squad of the commander's own faction, made as profiles 300 m from the site
private _profiles = ["OIA_InfSquad", _site getPos [300, random 360], 0, true, "OPF_F"] call ALIVE_fnc_createProfilesFromGroupConfig;
private _groupIDs = (_profiles select {(_x select 2 select 5) == "entity"}) apply {[_x, "profileID"] call ALIVE_fnc_hashGet};
// "ambush" or "sad", the place, the groups (profile IDs), seconds before the commander takes them back
[_opcom, "addTimedTask", ["ambush", _site, _groupIDs, 900]] call ALiVE_fnc_OPCOM;
- "ambush": the groups go to the place, hide and hold fire, and open fire when an enemy comes within 80 m or they are already fighting. "sad": they search and destroy within 150 m, weapons free, then stay there.
- When the time is up (600 s if you leave it out) their orders are cleared, they go back to their usual combat mode and the commander uses them again.
- Any of the commander's groups will do: pass their profile IDs and they are taken off whatever they were doing.
- Returns the order's internal objective. Any type but "sad" or "ambush", or an empty group list, does nothing.
- The command tablet doesn't offer these orders for an insurgency commander.
Adds an objective at the front of a commander's list and says whether to take it or hold it, as a player's map marker does.
Runs onServerNeedsMilitary AI Commander
if (!isServer) exitWith {};
waitUntil {!isNil "ALiVE_REQUIRE_INITIALISED"};
private _opcom = [nil, "findOPCOMByAllegiance", "EAST"] call ALiVE_fnc_OPCOM;
// id, position, size, type, priority, state, cluster, commander id, made by a player, put it first
private _objective = [_opcom, "addObjective", ["hold_the_bridge", getMarkerPos "bridge", 150, "MIL", 200,
"unassigned", "none", [_opcom, "opcomID", ""] call ALiVE_fnc_hashGet, false, true]] call ALiVE_fnc_OPCOM;
// "hold": attack it while only the enemy is there, defend it otherwise
// "take": attack it until only this side is there; the key then goes back to ""
[_objective, "playerIntent", "hold"] call ALiVE_fnc_hashSet;
- The commander applies it each time it reviews its objectives, counting forces within 500 m.
- A taken objective becomes an ordinary one: the key goes back to "" and the commander holds it or not as it judges.
- "Made by a player" true would count it against the command tablet's limit on player objectives, so leave it false.
- The last argument true puts it at the front of the list, so it is the commander's first pick among objectives in the same state.
- addObjective called again with the same id and place returns the objective already there.
Marks the enemy groups around one or more places as seen by one side's AI commanders for the next 30 minutes, and reads back what a commander knows.
Runs onAnywhere for the report (a client's call is passed to the server); the server for the readNeedsMilitary AI Commander, Virtual AI System
waitUntil {!isNil "ALiVE_REQUIRE_INITIALISED"};
// The side to tell, then the places. Any machine: a client's call is passed to the server.
// Here EAST's commanders are tipped off about the players' camp.
["report", "EAST", [getMarkerPos "player_camp"]] call ALIVE_fnc_taskKnownEnemy;
// Only the server can read what a commander knows: [profile IDs, last known positions]
if (isServer) then {
private _opcom = [nil, "findOPCOMByAllegiance", "EAST"] call ALiVE_fnc_OPCOM;
([_opcom, "knownEnemy"] call ALiVE_fnc_OPCOM) params ["_ids", "_positions"];
};
- Every enemy group within 150 m of each place counts as seen, and the place itself is kept as known too.
- It is what the commander's Tasks Only Against Known Enemy and Reinforcements Match the Enemy settings go by, and C2ISTAR's Tasks Only Against Known Enemy.
- With an HVT manhunt running, the same report narrows the search near it.
- The list also holds an entry per reported place, named report_<x>_<y>.
Overwrites the eight force-type counts one commander started with, which Military Logistics reads when it sizes reinforcements.
Runs onServerNeedsMilitary AI Commander
{
if (([_x, "side", ""] call ALIVE_fnc_hashGet) == "WEST") then {
// infantry, motorised, mechanised, armoured, air, sea, artillery, AAA
[_x, "startForceStrength", [12, 4, 2, 2, 0, 0, 1, 1]] call ALIVE_fnc_hashSet;
};
} forEach OPCOM_instances;
// Or nudge one type (Infantry, Motorized, Mechanized, Armored, Air, Sea, Artillery or AAA):
["WEST", "Infantry", 5] call ALIVE_fnc_OPCOMIncrementStartForceStrength;
- The order is the commander's own. The old wiki listed artillery and AAA before air and sea.
- The increment and decrement helpers use the same order as the array, so "Air", "Sea", "Artillery" and "AAA" each move their own slot (the other four names are "Infantry", "Motorized", "Mechanized" and "Armored"). Dev builds before 27 Sep 2026 (3b4fa76d) sent those last four to each other's slots, so +1 Air changed the artillery count there.
Every 30 seconds asks, for every objective of every commander, whether WEST controls it right now.
Runs onServerNeedsMilitary AI Commander
[] spawn {
waitUntil {!isNil "ALiVE_REQUIRE_INITIALISED"};
waitUntil {!isNil "OPCOM_instances" && {count OPCOM_instances > 0}};
while {true} do {
{
private _objectives = [_x, "objectives", []] call ALiVE_fnc_hashGet;
{
if ([_x, "WEST", 300, false] call ALiVE_fnc_isHeldObjective) then {
// WEST controls this objective right now
};
} forEach _objectives;
} forEach OPCOM_instances;
sleep 30;
};
};
- Capture and defend events describe orders; they do not fire when an objective quietly changes hands, which is why ownership is polled.
Moves the player's group into the nearest group on an attack order, or opens the map to pick one of the commander's attack objectives and joins the group sent to take it.
Runs onClientNeedsMilitary AI Commander
// Nearest group on an attack order ("defending" for a defence)
[player, "attacking"] spawn ALiVE_fnc_OPCOMjoinNearestGroup;
// Or pick an objective on the map
[player, "attacking"] call ALiVE_fnc_OPCOMJoinObjective;
// As an action on an object:
this addAction ["Select assault mission", {[_this select 1, "attacking"] call ALiVE_fnc_OPCOMJoinObjective}];
- Both find the player's commander by the player's faction; a faction no commander owns does nothing.
- The player's group joins that AI group, and its AI leader stays in charge. If the group is riding in a vehicle, the map pick puts the players in its cargo.
- The map pick marks the attack objectives and waits for a click near one. It moves the group straight to the section taking it; there's no parachute drop.
Lists the objective positions a faction's commander has in one state, and names its top objective among the states you give.
Runs onServerNeedsMilitary AI Commander
if (!isServer) exitWith {};
// Positions of every objective BLU_F's commander holds in reserve
private _reserve = ["BLU_F", "reserve"] call ALIVE_fnc_OPCOMpositions;
// The id of WEST's most important objective it is attacking, or "" if none
private _target = ["WEST", ["attack", "attacking"]] call ALIVE_fnc_OPCOMgetHighestPrioObjective;
- States: idle, attack, attacking, defend, defending, reserve, reserving.
- The first takes a faction, the second a side string (WEST, EAST, GUER).
Draws every AI Commander objective, and any live insurgent installation, on every player's map for about a minute, then fades them out.
Runs onAnywhere (a client call is sent to the server)NeedsMilitary AI Commander
// Every commander, every objective
call ALIVE_fnc_OPCOMToggleInstallations;
// Only within 500 m of the player, for the commander of side east
[getPos player, 500, east] call ALIVE_fnc_OPCOMToggleInstallations;
- Despite the name it doesn't switch anything off: each call draws the markers again and they fade on their own.
- Given a side, it can also mark where that commander's high value target was last seen.
← Back to the list
Support and logistics
Support and logistics
Needs Military Logistics, Player Combat Support, Military Placement (Civ. Obj.)
Creates a Combat Support asset with its crew and radio callsign after the mission has started.
Runs onServerNeedsPlayer Combat Support
if (isServer) then {
waitUntil {!isNil "NEO_radioLogic" && {NEO_radioLogic getVariable ["init", false]}};
// CAS: position, direction, class, callsign, code run on spawn, height
["CAS", [getMarkerPos "cas_spawn", 60, "B_Heli_Attack_01_F", "Phantom 1", "", "0"]] call ALiVE_fnc_combatSupportAdd;
// TRANSPORT: ... height, allow slingloading, number of slingload boxes
["TRANSPORT", [getMarkerPos "trn_spawn", 60, "B_Heli_Transport_01_F", "Victor 1", "", "0", true, 3]] call ALiVE_fnc_combatSupportAdd;
// ARTY: position, class, callsign, number of guns, rounds, code
["ARTY", [getMarkerPos "arty_spawn", "B_MBT_01_arty_F", "Sholef", 2, [["HE", 20], ["SMOKE", 10], ["ILLUM", 10]], ""]] call ALiVE_fnc_combatSupportAdd;
};
- The side comes from the vehicle class; callsigns are stored upper-case.
- Height is a string, as the Eden attribute is.
Deletes an asset and its crew by side, type and callsign, for example when a task ends.
Runs onServerNeedsPlayer Combat Support
["WEST", "CAS", "PHANTOM 1"] call ALiVE_fnc_combatSupportRemove;
["WEST", "TRANSPORT", "VICTOR 1"] call ALiVE_fnc_combatSupportRemove;
- Match the callsign in upper case; the side is the side string of the asset.
Sets how long a Combat Support asset takes to be replaced when it is lost, and how many times, apart from the module's shared settings.
Runs onServerNeedsPlayer Combat Support
if (isServer) then {
waitUntil {!isNil "NEO_radioLogic" && {NEO_radioLogic getVariable ["init", false]}};
["CAS", [getMarkerPos "cas_spawn", 60, "B_Heli_Attack_01_F", "Phantom 1", "", "0"]] call ALiVE_fnc_combatSupportAdd;
// "KIND|CALLSIGN" (CAS, TRANS, GROUND or ARTY, then the callsign in capitals) ->
// [seconds before it's replaced, how many times]. -1 in either keeps the Combat Support
// module's own value; 0 times means it's never replaced.
ALiVE_CS_respawnReg set ["CAS|PHANTOM 1", [60, 1]];
};
- The replacement is built where the asset first stood, after the time, and counts down its own number; the module's shared limit for that kind is left alone.
- An asset placed in Eden with its own Respawn Time or Limit fills its entry at the start; one added by script has no entry until you set it.
- Set it on the server after the asset is added. It works for assets from the Eden modules too: use the callsign shown in the radio menu.
Adds 20 to BLUFOR's reinforcement pool once Military Logistics is running.
Runs onServerNeedsMilitary Logistics
if (isServer) then {
waitUntil {!isNil "ALIVE_MLGlobalRegistry" && {count (([ALIVE_MLGlobalRegistry, "modules"] call ALIVE_fnc_hashGet) select 1) > 0}};
private _pool = [ALIVE_globalForcePool, "BLU_F", 0] call ALIVE_fnc_hashGet;
[ALIVE_globalForcePool, "BLU_F", _pool + 20] call ALIVE_fnc_hashSet;
};
- The third argument to hashGet is the default when the faction has no entry yet.
Drops a small military fort at a position and profiles two OPFOR infantry groups and one motorised group around it.
Runs onServerNeedsVirtual AI System
if (isServer) then {
waitUntil {!isNil "ALIVE_profileSystemInit"};
[
getMarkerPos "fob_1", "Military", "Fort", "OPF_F", "Small",
2, // infantry groups
1, // motorised groups
0, 0, 0
] call ALIVE_fnc_spawnRandomPopulatedComposition;
};
- Type is Civilian, Military or Guerrilla; ALiVE matches category and size as part of the composition's class name.
- If no composition matches, ALiVE logs a warning and spawns nothing.
Limits the roadblocks Military Placement (Civ. Obj.) builds to a list of compositions, when the module's own Roadblock Compositions picker is empty.
Runs onServer, before Civilian Placement starts (initServer.sqf)NeedsMilitary Placement (Civ. Obj.)
// Class names from ALiVE's own composition set (Military > CheckpointsBarricadesSmall)
ALiVE_compositions_roadblocks = ["CheckpointSandbags1", "CheckpointTower"];
- Only used when the module's Roadblock Compositions picker is empty; the picker wins otherwise.
- Each roadblock takes one name from the list at random. A name ALiVE can't find sends that roadblock back to its usual checkpoints.
Puts up to five roadblocks on the roads around the edge of a circle (a ring from 10 m inside the radius to 20 m outside it) centred on a position, using ALiVE's checkpoint compositions.
Runs onServerNeedsMilitary Placement (Civ. Obj.)
if (!isServer) exitWith {};
// centre, radius, how many (up to 5)
private _roads = [getMarkerPos "checkpoint", 250, 2] call ALiVE_fnc_createRoadblock;
// Optional: debug, then the compositions to choose from
// [getMarkerPos "checkpoint", 200, 1, false, "CheckpointSandbags1,CheckpointTower"] call ALiVE_fnc_createRoadblock;
- Returns the road pieces it built on. A road within 100 m of another roadblock, or with no room for the composition, is skipped. Roadblocks go on the edge of the circle, not near its centre. The function works out whose roadblock it is from the groups within the radius of the centre; with none it builds nothing and logs "Unable to find a dominant faction". To name the faction yourself, pass it as the seventh argument: [getMarkerPos "checkpoint", 250, 2, false, "", 1, "OPF_F"] call ALiVE_fnc_createRoadblock.
Builds a roadblock players can dismantle once the area is clear, or adds the same action to a composition ALiVE has already spawned.
Runs onServerNeedsMilitary Placement (Civ. Obj.) or Civilian Placement, for the roadblock compositions
if (!isServer) exitWith {};
waitUntil {!isNil "ALiVE_REQUIRE_INITIALISED"};
// As "Build a roadblock where you want one", with the last argument true. Centre, radius, how many,
// debug, compositions, patrol, faction, spawn code, run it once, dismantle
[getMarkerPos "checkpoint", 250, 1, false, "", 1, "", "", true, true] call ALiVE_fnc_createRoadblock;
// The same for a composition ALiVE already spawned: its centre, the radius it covers, and the word
// players see ("Dismantle the fortifications")
[getMarkerPos "my_bunker", 30, "fortifications"] call ALIVE_fnc_addDismantleAction;
- About 5 s later a traffic cone stands beside it with a 15 s hold action. Players see it within 8 m of the cone, and only with no enemy within 60 m.
- Finishing it removes the composition and its saved copy. The guards and the parked vehicle are left.
- addDismantleAction only removes compositions ALiVE spawned and saved within the radius.
- Leave the faction "" and the guards come from whoever holds the area.
← Back to the list
Civilians
Civilians
Needs Civilian Placement, Civilian Population
Lowers the civilian hostility towards BLUFOR of the town around a prison whenever an ACE-captured unit is brought there.
Runs onServerNeedsCivilian Placement, Civilian Population, ACE (for the capture event)
if (isServer) then {
waitUntil {!isNil "ALIVE_clusterHandler"};
// ACE raises this when a unit is handcuffed or released
["ace_captiveStatusChanged", {
params ["_unit", "_state"];
if (_state && {_unit inArea prison_area}) then {
[getPos _unit, ["WEST"], -10] call ALIVE_fnc_updateSectorHostility;
};
}] call CBA_fnc_addEventHandler;
};
- The hostility change is ALiVE's; the event is ACE's. Without ACE the handler never fires.
- It only changes towns a Civilian Placement module has registered, in the 1 km map square the position falls in, so use a point inside the town.
- Sides are the side strings ALiVE uses: WEST, EAST, GUER.
Moves a single civilian's hostility up or down, the same way aid, irritation and wounds do.
Runs onServer (a call elsewhere is passed to the server)NeedsCivilian Population
// Positive angers, negative calms. The result stays between 0 and 100; 30 is calm.
private _now = [_civ, 25] call ALIVE_fnc_civSetHostility;
- Returns the new value on the server, and nothing on other machines.
- A mission that limits remoteExec with CfgRemoteExec must allow ALIVE_fnc_civSetHostility for client calls.
Gives a container of water and rations to the nearest town, easing its hostility towards one side, with no C2ISTAR task and no player needed.
Runs onServer (a call elsewhere is passed to the server)NeedsCivilian Population with Aid Crate on (the default), Civilian Placement
if (!isServer) exitWith {};
waitUntil {!isNil "ALIVE_civilianPopulationSystem" && {[ALIVE_civilianPopulationSystem, "startupComplete", false] call ALiVE_fnc_hashGet}};
// A crate with at least 10 of the Civilian Population module's water and ration items in it
private _crate = "B_supplyCrate_F" createVehicle getMarkerPos "aid_drop";
clearWeaponCargoGlobal _crate; clearMagazineCargoGlobal _crate;
clearItemCargoGlobal _crate; clearBackpackCargoGlobal _crate;
_crate addItemCargoGlobal ["ALiVE_Waterbottle", 10];
_crate addItemCargoGlobal ["ALiVE_Humrat", 10];
// Later, once it's there (from a trigger, say): hand it to the town within 200 m, from WEST
private _result = ["handover", [_crate, "WEST", objNull]] call ALiVE_fnc_aidCrate;
// "delivered", or why not: "toofew", "notown", "cooldown", "disabled" or "gone"
- It's worth 5, plus 1 for every 5 items, up to the module's Aid Crate Max Effect: hostility to the giving side falls by that across the town's map sector and rises for the other sides, and the town's civilians calm down a little.
- Only the food and water are taken; the crate is deleted once it's empty.
- A town, and the towns within 1500 m of it, take one crate per Aid Crate Cooldown (1800 s by default).
- ACE water and MREs count too. Pass a player instead of objNull and his side is used, he must be within 50 m and he gets the message.
← Back to the list
Start-up and pausing
Start-up and pausing
Needs The modules you name
The one line to put at the top of any script that reads an ALiVE global or calls an ALiVE function.
Runs onAny machineNeedsALiVE (Required)
waitUntil {!isNil "ALiVE_REQUIRE_INITIALISED"};
// ALiVE_eventLog and the placement, CQB, commander and Player Options modules you placed have started from here.
// Other modules can still be starting: for the Virtual AI System, a force pool or your saved data, wait on their own signals too (see the Scripting Overview)
- Set by the Required module once the placement, CQB, commander and Player Options modules you placed have started, and published, so clients can wait on it too. Other modules can still be starting then.
Stops the virtual AI system, the commanders, civilians and logistics in place, then starts them again.
Runs onServer (forwards itself from a client)Needsthe modules named
waitUntil {!isNil "ALiVE_REQUIRE_INITIALISED"}; // scheduled script, e.g. initServer.sqf
// Military Logistics and Civilian Population finish starting after that: wait for any that are placed
waitUntil {sleep 1; (entities "Module_F" select {typeOf _x in ["ALiVE_mil_logistics", "ALiVE_amb_civ_population"]}) findIf {isNil {_x getVariable "handler"} && {isNil {_x getVariable "class"}}} < 0};
["ALIVE_SYS_PROFILE", "ALIVE_MIL_OPCOM", "ALIVE_AMB_CIV_POPULATION", "ALIVE_MIL_LOGISTICS"] call ALiVE_fnc_pauseModule;
// later
["ALIVE_SYS_PROFILE", "ALIVE_MIL_OPCOM", "ALIVE_AMB_CIV_POPULATION", "ALIVE_MIL_LOGISTICS"] call ALiVE_fnc_unPauseModule;
- Names are module class names and case doesn't matter; ALiVE skips a name with no placed module. You can call it from a scheduled script (initServer.sqf, or spawn) or from a module's init field: ALiVE waits for each named module to finish starting, up to 10 minutes, before pausing it.
- Military Logistics and Civilian Population finish starting after ALiVE does, so the second wait is there for them: pausing either one earlier throws a script error and leaves it running.
- Resuming doesn't start a commander set to Hold Until Go: only Start the war on the tablet does, or
[nil, "go", "name"] call ALiVE_fnc_OPCOM on the server.
Pauses the commander and the virtual AI system when the server empties and resumes them when someone joins.
Runs onServer (initServer.sqf)NeedsVirtual AI System, Military AI Commander
["idlePause", "onPlayerDisconnected", {
// The player who is leaving still counts at this moment, so look again shortly after
[] spawn {
sleep 10;
if (count (allPlayers - entities "HeadlessClient_F") == 0) then {
["ALIVE_SYS_PROFILE", "ALIVE_MIL_OPCOM"] call ALiVE_fnc_pauseModule;
};
};
}] call BIS_fnc_addStackedEventHandler;
["idleResume", "onPlayerConnected", {
[] spawn { ["ALIVE_SYS_PROFILE", "ALIVE_MIL_OPCOM"] call ALiVE_fnc_unPauseModule; };
}] call BIS_fnc_addStackedEventHandler;
- Inside onPlayerDisconnected the player who is leaving still counts as a player, so a check made there never finds the server empty. That's why it waits 10 seconds.
- Headless clients aren't counted, so a server with one still pauses.
- onPlayerConnected also fires for the server itself when the mission starts; resuming then does no harm.
← Back to the list
Rally points
Rally points
Needs Rally Points
Makes an object a rally point players can travel to and from, with a name, for one side or for any.
Runs onAnywhere (a client's call is passed to the server, which keeps the list)NeedsRally Points module, for the action players use (the function works without it, but nobody gets the action)
// In init.sqf, or the object's init field:
if (isServer) then {
["add", [myFlag, "Charlie", "WEST"]] call ALiVE_fnc_rallyPoint;
};
// To take it off the list again:
// ["remove", [myFlag]] call ALiVE_fnc_rallyPoint;
- The name is optional: leave it "" and the object's ALiVE_rallyName variable is used, else the nearest place's name.
- The side is "ANY" (default), "WEST", "EAST" or "GUER": who may use it.
- A removed object stays off the list even if it matches Rally Point Classes.
Takes a scripted rally point off the list once enemies have stood near it for the time you give.
Runs onServerNeedsRally Points module (it runs the check)
if (isServer) then {
waitUntil {!isNil "ALiVE_rallyLogic"};
["add", [myFlag, "Charlie", "WEST"]] call ALiVE_fnc_rallyPoint;
// Lost once enemies have been within the module's Enemy Radius for 120 s. The flag stays standing.
myFlag setVariable ["ALiVE_rallyOverrun", 120];
};
- The module looks every 5 s, using its Enemy Radius (at least 50 m); ALiVE's virtual groups count as enemies too.
- It needs a side: an "ANY" point is never overrun.
- Points the module finds itself (synced or by class) use its Placed Rally Point Overrun Time; the variable overrides that, and 0 keeps one safe.
- Players of the side are told the point was overrun. Add it again with "add" to bring it back.
Moves a player there, with their group's nearby AI if they lead it, the way Travel does; force skips the enemy check and the wait.
Runs onAnywhere (it runs where the player is local)NeedsRally Points module or rally points added by script
// From a trigger, an addAction or the debug console:
["travel", [player, myFlag, true]] call ALiVE_fnc_rallyPoint;
// Without force, the module's Enemy Check and wait apply,
// and the player is told if the trip is refused:
// ["travel", [player, myFlag, false]] call ALiVE_fnc_rallyPoint;
- The destination can be an object, a position, or a row from ["list", [player]] call ALiVE_fnc_rallyPoint.
- ["list", [player]] gives the rally points that player may use: [[name, posASL, object, FOB id], ...].
← Back to the list