Skip to content

Instantly share code, notes, and snippets.

@diwako
Last active January 29, 2023 22:53
Show Gist options
  • Save diwako/f9fce8001b61ed3c7404280f32ae430a to your computer and use it in GitHub Desktop.
Save diwako/f9fce8001b61ed3c7404280f32ae430a to your computer and use it in GitHub Desktop.
Issue reproduction from ACE, APS, and basically any other mod and mission script.
private _action = "DefaultAction";
private _name = format ["ACE_Action_%1", _action];
private _actionsVar = player getVariable [_name, [-1, [-1, [], []], objNull]];
if (player != _actionsVar select 2) then { // check if the unit is still valid, fixes respawn issues
_actionsVar = [-1, [-1, [], []], objNull];
};
_actionsVar params ["_actionID", "_actionsArray"];
_actionsArray params ["_id", "_actionIDs", "_actions"];
_id = _id + 1;
_actionIDs pushBack _id;
_actions pushBack [{true}, {systemChat "You clicked!"}];
private _addAction = call compile format [
"[
'',
{[{if (inputAction '%1' == 0) exitWith {}; {if (_this call (_x select 0)) then {_this call (_x select 1)}} forEach (((_this select 0) getVariable '%2') select 1 select 2)}, _this] call CBA_fnc_directCall},
nil,
-1,
false,
true,
'%1',
""if (_this != ACE_player || {vehicle _this != _target}) exitWith {false}; _actions = (_this getVariable '%2') select 1 select 2; _count = count _actions; _index = 0; _return = false; while {_index < _count && {!_return}} do {_return = [_target, _this] call ((_actions select _index) select 0); _index = _index + 1}; _return""
]",
_action,
_name
];
diw_actionId_0 = player addAction _addAction;
player setVariable [_name, [diw_actionId_0, [_id, _actionIDs, _actions], player], false];
{
missionNamespace setVariable [format ["diw_actionId_%1", _forEachIndex+1], player addAction [format ["%1 I am NOT from the 'Help Me' mod and I should not be removed", _x], "systemChat 'Hello there!'"]];
} forEach [
"* HelpMe Options",
"*",
"*}",
"*{",
"**",
"--",
"----",
" -",
"- ",
"[ ",
"[ Y",
"[Y",
"[",
"* - Spawned Unit:",
"You Have U",
"* - Delete Spawned",
"* - Explode Spawned",
""
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment