Skip to content

Instantly share code, notes, and snippets.

@shadez95
Last active July 13, 2022 06:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadez95/ba99e7674d2b9593fc859b2dd59bd389 to your computer and use it in GitHub Desktop.
Save shadez95/ba99e7674d2b9593fc859b2dd59bd389 to your computer and use it in GitHub Desktop.
ACEX Fortify persistence, a custom ACEX Fortify preset, and a persistent ACEX Fortify budget.
class ACEX_Fortify_Presets {
class ASO_Fortify_Objects {
objects[] = {
{"Land_BagFence_Round_F", 5},
{"Land_BagFence_Short_F", 5},
{"Land_BagFence_Long_F", 10},
{"Land_Plank_01_4m_F", 10},
{"Land_BagBunker_Small_F", 25},
{"Land_HBarrierTower_F", 100},
{"Land_HBarrierWall4_F", 25},
{"Land_HBarrierWall_corner_F", 25},
{"Land_HBarrier_1_F", 5},
{"Land_BagBunker_Tower_F", 50},
{"Land_BagBunker_Large_F", 100},
{"Land_Cargo_Patrol_V1_F", 100}
};
};
};
["CAManBase", "Init", {
params ["_entity"];
_entity setVariable ["side_unit", side _entity];
_entity addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
_sideUnit = _unit getVariable ["side_unit", sideUnknown];
if (_sideUnit isEqualTo sideUnknown) exitWith {};
_budget = switch(_sideUnit) do {
case west: { -50 };
case east: { 50 };
case resistance: { 50 };
case civilian: {
if ((side _instigator) isEqualTo west) then { -200 } else { 0 }
};
default { 0 };
};
if (_budget isEqualTo 0) exitWith {};
[west, _budget, (_sideUnit isEqualTo civilian)] call acex_fortify_fnc_updateBudget;
["ACE_Fortify_budget_change", []] call CBA_fnc_serverEvent;
}];
}] call CBA_fnc_addClassEventHandler;
["acex_fortify_objectPlaced", {
[ALiVE_SYS_LOGISTICS, "updateObject", [(_this select 2)]] call ALIVE_fnc_logistics;
["ACE_Fortify_budget_change", []] call CBA_fnc_serverEvent;
}] call CBA_fnc_addEventHandler;
["acex_fortify_objectDeleted", {
[ALiVE_SYS_LOGISTICS, "removeObject", [(_this select 2)]] call ALIVE_fnc_logistics;
["ACE_Fortify_budget_change", []] call CBA_fnc_serverEvent;
}] call CBA_fnc_addEventHandler;
_action = ["ASO_Logistics_Update", "Save Position", "", {
[ALiVE_SYS_LOGISTICS, "updateObject", [_target]] call ALiVE_fnc_logistics;
hintSilent "Position saved!";
}, {true}] call ace_interact_menu_fnc_createAction;
["Reammobox_F", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
_budget = "ACE_fortify_budget" call AliVE_fnc_ProfileNameSpaceLoad;
_objects = ["ASO_Fortify_Objects"] call acex_fortify_fnc_getPlaceableSet;
if (_budget isEqualType 0) then {
["acex_fortify_registerObjects", [west, _budget, _objects]] call CBA_fnc_serverEvent;
} else {
["acex_fortify_registerObjects", [west, 0, _objects]] call CBA_fnc_serverEvent;
};
["ACE_Fortify_budget_change", {
_budget = [west] call acex_fortify_fnc_getBudget;
_saved = ["ACE_fortify_budget", _budget] call ALiVE_fnc_ProfileNameSpaceSave;
}] call CBA_fnc_addEventHandler;
_objects = [alive_sys_logistics, "allObjects"] call ALiVE_fnc_logistics;
_aceFortifyObjects = ["ASO_Fortify_Objects"] call acex_fortify_fnc_getPlaceableSet;
private _aceFortifyObjectsCleaned = [];
{
_aceFortifyObjectsCleaned pushBack (_x select 0);
} forEach _aceFortifyObjects;
{
if (_x isKindOf "Static") then {
if (_x isKindOf "CBA_NamespaceDummy" || _x isKindOf "Helipad_base_F") exitWith {};
if ((typeOf _x) in _aceFortifyObjectsCleaned) then {
_jipID = ["acex_fortify_addActionToObject", [west, _x]] call CBA_fnc_globalEventJIP;
[_jipID, _x] call CBA_fnc_removeGlobalEventJIP;
};
};
} forEach _objects;
@shadez95
Copy link
Author

The above code gets ACEX Fortify to work with persistence, a custom ACEX Fortify preset, and a persistent ACEX Fortify budget.

Please note I have setup the ACEX Fortify budget to update so that when a side west unit kills opfor or resistance, it will give them more currency; and when a civilian is killed, currency is taken away. You can edit the code to your liking but this example gives you an advance configuration.

@CySpiegel
Copy link

seems persistance is broken with the budget with current alive and acex being folded into regular ace. Any chance on getting this fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment