mattjb
Member-
Content Count
21 -
Joined
-
Last visited
-
Medals
Everything posted by mattjb
-
Add/Remove Vehicle Action on Enter/Leave
mattjb posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'd like some suggestions to try here... I've been trying to add an ACE action dynamically to players when they enter/leave vehicles. I discovered why my actions were not visible if I just tried to attach the action to the player and assume that it would carry with whatever vehicle he got into... apparently it isn't the case, and it seems necessary to leverage a vehicle/getinman/getoutman EH. Ideally the CBA_fnc_addPlayerEventHandler would be best here, as it triggers on Zeus actions and other scenarios; however, I cannot discern between an "enter" and "leave" condition... The code segment I have for this: _unit = player; addVicAction = { _unit = _this select 0; _vehicle = _this select 1; _fullHealVic = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{true}] call ace_interact_menu_fnc_createAction; [[_vehicle, 0, ["ACE_MainActions", "ACE_Passengers", str _unit], _fullHealVic],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; }; removeVicAction = { _unit = _this select 0; _vehicle = _this select 1; _fullHealVic = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{true}] call ace_interact_menu_fnc_createAction; [[_vehicle, 0, ["ACE_MainActions", "ACE_Passengers", str _unit], _fullHealVic],ace_interact_menu_fnc_removeActionFromObject] remoteExec ["call", -2, true]; }; ["vehicle", { params ["_unit", "_vehicle"]; _unit sideChat format ["unit: %1 :: vehicle: %2 :: vehicle _unit: %3", _unit, _vehicle, vehicle _unit]; if (vehicle _unit != _unit) then { [_unit, _vehicle] call addVicAction; } else { [_unit, _vehicle] call removeVicAction; }; }] call CBA_fnc_addPlayerEventHandler; The else statement's 'removeVicAction' is never getting called to remove the action, resulting in +1 or +2 (enter or enter/leave) actions added. Looking at the vars from the sideChat statement reveals that the vehicle var is being assigned after getting in, and before getting out... See screenshot below for the sideChat messages after getting in and getting out -- all vars are identical: -
Add/Remove Vehicle Action on Enter/Leave
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I think I figured it out (still need to do testing with 2+ people), but the issue was the usage of addActionToObject. Thanks, Dedmen! Your typeOf clue gave me a hint in trying addActionToClass instead, as follows: [[typeOf _unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; Instead of: [[_unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; Doing this, there's no need for the EH as the action appears in both the ACE_MainActions when outside a vehicle, and inside the vehicle via Vehicle -> Passengers -> Unit's Name subaction menu as well. I still need to test with more human players, as I lose remote control when controlling an AI unit entering the same vehicle as myself, but testing from outside -> inside is working. I will update this thread with results from inside -> inside when I get around to it, for anyone else with the same issue that stumbles by this thread. -
Add/Remove Vehicle Action on Enter/Leave
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Just giving a quick update - still haven't figured this out yet, but I did discover a param (enableInside) in createAction that I've been tinkering with as it sounds suspicious -- initial testing still no go, but maybe I'm missing something: [ACE] fnc_createAction.sqf * Arguments: * 0: Action name <STRING> * 1: Name of the action shown in the menu <STRING> * 2: Icon <STRING> * 3: Statement <CODE> * 4: Condition <CODE> * 5: Insert children code <CODE> (Optional) * 6: Action parameters <ANY> (Optional) * 7: Position (Position array, Position code or Selection Name) <ARRAY>, <CODE> or <STRING> (Optional) * 8: Distance <NUMBER> (Optional) * 9: Other parameters [showDisabled,enableInside,canCollapse,runOnHover,doNotCheckLOS] <ARRAY> (Optional) * 10: Modifier function <CODE> (Optional) params [ "_actionName", "_displayName", "_icon", "_statement", "_condition", ["_insertChildren", {}], ["_customParams", []], ["_position", {[0, 0, 0]}], ["_distance", 2], ["_params", [false, false, false, false, false]], ["_modifierFunction", {}] ]; My modified createAction: _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable ['ACE_medical_bodyPartStatus',[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain',0] > 0) or (_target getVariable ['ACE_isUnconscious',false] isEqualTo true))},{},[],[0,0,0],3,[false,true,false,false,false]] call ace_interact_menu_fnc_createAction; -
Add/Remove Vehicle Action on Enter/Leave
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'd like to use a "player is inside vehicle" based condition... But I'm lost on how to attach it to the player and have the action carried between vehicles. The addActionToObject works if I am in a vehicle at mission start. If I get out, and get back in, it still works for that vehicle. However, if I get out and go to another vehicle, the action doesn't appear -- leading me to think that vehicle _unit only registered the vehicle that the player started in, and is not being dynamically reassigned when the player changes vehicles. i.e. [[(vehicle _unit), 0, ["ACE_MainActions", "ACE_Passengers", str _unit], _fullHealVic],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; Would you happen to know how to get it to show up dynamically? I'm already using a hefty condition as can be seen by _fullHeal --- {(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable ['ACE_medical_bodyPartStatus',[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain',0] > 0) or (_target getVariable ['ACE_isUnconscious',false] isEqualTo true))} I'm assuming this is where a "player is inside vehicle" condition would go, right? But again, getting the action to even show up in the first place between various vehicles is the main problem. -
Add/Remove Vehicle Action on Enter/Leave
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
If there's a means to not have to add/remove it constantly, I'm open to suggestions/alternatives. :) The reason why I resorted to looking into doing it that way is because I wasn't having any luck for the past 3 weeks in figuring out a way to have it carried with the player. My initial instinct was to try something like: [[(vehicle _unit), 0, ["ACE_MainActions", "ACE_Passengers", str _unit], _fullHealVic],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; But when testing this, I observed that when an injured player gets into the vehicle, the passenger action doesn't appear; however, if the player spawns in the vehicle (i.e. mission start), the action appears... I concluded that the addActionToObject was being added to the vehicle, and not the player itself. The action is for passengers in the vehicle, not the vehicle itself. The actions work perfectly in targeting the player when used in the above context and my initial post (with EH), just the problems I'm having with either solution... remoteExec's are in there as it's a purely client-driven script targeting other players. For reference, the entire init sqf code is below (_fullHealVic is just temporary, _fullHeal is the real action -- I got tired of shooting myself with remote controlled units so I went with a {true} condition). This is for a mod I've been developing in my spare time for my group that wanted a simpler solution to utilizing a fully customizable PAK solution in ACE Basic Medical -- without deleting the ace_medical.pbo - as they are too devoted to using Steam Workshop: if (isServer) exitWith {}; [[], { waitUntil { !(isNull player) && {(player == player)} && {!isNil "BIS_fnc_init"} }; _unit = player; if (hasInterface) then { if (isNil {_unit getVariable ["WolfPAKActive", nil]}) then { _unit setVariable ["WolfPAKActive", true]; // WolfPAK v1.5 - initialization code _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable ['ACE_medical_bodyPartStatus',[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain',0] > 0) or (_target getVariable ['ACE_isUnconscious',false] isEqualTo true))}] call ace_interact_menu_fnc_createAction; [[_unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; [_unit, 1, ["ACE_SelfActions"], _fullHeal] call ace_interact_menu_fnc_addActionToObject; addVicAction = { _unit = _this select 0; _vehicle = _this select 1; _fullHealVic = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{true}] call ace_interact_menu_fnc_createAction; [[_vehicle, 0, ["ACE_MainActions", "ACE_Passengers", str _unit], _fullHealVic],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; }; removeVicAction = { _unit = _this select 0; _vehicle = _this select 1; _fullHealVic = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{true}] call ace_interact_menu_fnc_createAction; [[_vehicle, 0, ["ACE_MainActions", "ACE_Passengers", str _unit], _fullHealVic],ace_interact_menu_fnc_removeActionFromObject] remoteExec ["call", -2, true]; }; ["vehicle", { params ["_unit", "_vehicle"]; _unit sideChat format ["unit: %1 :: vehicle: %2 :: vehicle _unit: %3",_unit,_vehicle, vehicle _unit]; if (vehicle _unit != _unit) then { [_unit, _vehicle] call addVicAction; } else { [_unit, _vehicle] call removeVicAction; }; }] call CBA_fnc_addPlayerEventHandler; systemChat "Initialized WolfPAK v1.5 (PBO)"; // End of WolfPAK v1.5 - initialization code }; }; }] remoteExec ["spawn", -2, true]; -
ACE3 - A collaborative merger between AGM, CSE, and ACE
mattjb replied to acemod's topic in ARMA 3 - ADDONS & MODS: COMPLETE
Did this question ever get answered? I'm looking to do the same thing, but am having some difficulty with the syntax to the point where it seems to keep breaking the script I'm calling it from. -
[ACE] calling progressBar does not work in vehicles
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Just found fnc_addPassengerActions.sqf and fnc_addPassengersActions.sqf inside ace_interaction.pbo - going to see if I can leverage those functions... -
[ACE] calling progressBar does not work in vehicles
mattjb posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I can't seem to wrap my head around why ace_common_fnc_progressBar starts and immediately quits (within a frame) when inside a vehicle, but works fine when outside a vehicle. Could anyone shed some light on this? I've simplified the non-working code down to being this as simple as this: _target = _this select 0; _player = _this select 1; [ 3, [], {true}, {true}, "ProgressBar...", {true} ] call ace_common_fnc_progressBar; Calling the script containing the above with: _progressbartest = ["progress_bar_test", "<t color='#00ff00'>ProgressBar Test</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_progresbartest.sqf"},{true}] call ace_interact_menu_fnc_createAction; [_unit, 1, ["ACE_SelfActions"], _progressbartest] call ace_interact_menu_fnc_addActionToObject; -
[ACE] calling progressBar does not work in vehicles
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Finally got around to doing some thorough testing of this. The ACE_SelfAction progressBar is working fine, but I'm now having difficulty getting the action to show up for other players in a vehicle. It is very similar to what the OP in this thread was trying to achieve: I've tried so many combinations now, and derived at the conclusion that str _unit isn't creating the action under a "vehicularized" playername's action menu, but creating actions that target the vehicle directly seem to be working, i.e. ["ACE_MainActions"] or ["ACE_MainActions","ACE_Passengers"] - for instance the "Check Fuel" example provided by the examples page: https://ace3mod.com/wiki/framework/interactionMenu-framework.html#25-examples Just an FYI, I have the {true} condition for _fullHealVehicle just to make testing easier and quicker -- for now I'm just trying get the action appearing and targeting the unit correctly... if (isServer) exitWith {}; [[], { waitUntil { !(isNull player) && {(player == player)} && {!isNil "BIS_fnc_init"} }; _unit = player; if (hasInterface) then { if (isNil {_unit getVariable ["WolfPAKActive", nil]}) then { _unit setVariable ["WolfPAKActive", true]; // WolfPAK v1.5 - initialization code _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable ['ACE_medical_bodyPartStatus',[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain',0] > 0) or (_target getVariable ['ACE_isUnconscious',false] isEqualTo true))}] call ace_interact_menu_fnc_createAction; _fullHealVehicle = ["full_heal_vic", "<t color='#00ff00'>WolfPAK (Full Heal) Vic</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{true}] call ace_interact_menu_fnc_createAction; [[_unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; //[["LandVehicle", 0, ["ACE_MainActions"], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; //[["LandVehicle", 0, ["ACE_MainActions","ACE_Passengers"], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; //[["LandVehicle", 0, ["ACE_MainActions","ACE_Passengers",(str _unit)], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; //[["LandVehicle", 0, ["ACE_MainActions","ACE_Passengers",_unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; [[vehicle _unit, 0, ["ACE_MainActions","ACE_Passengers"], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; [[vehicle _unit, 0, ["ACE_Passengers"], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; [[vehicle _unit, 0, ["ACE_MainActions", str _unit], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; [[vehicle _unit, 0, [str _unit], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; //[["LandVehicle", 0, ["ACE_MainActions", "ACE_Passengers", name _unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; //[["LandVehicle", 0, ["ACE_Passengers", str _unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; //[["LandVehicle", 0, ["ACE_Passengers", name _unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true]; // Adds action to check fuel levels for all land vehicles _action = ["CheckFuel", "Check Fuel", "", {hint format ["Fuel: %1", fuel _target]}, {true}] call ace_interact_menu_fnc_createAction; ["LandVehicle", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass; [_unit, 1, ["ACE_SelfActions"], _fullHeal] call ace_interact_menu_fnc_addActionToObject; systemChat "Initialized WolfPAK v1.5 (PBO)"; // End of WolfPAK v1.5 - initialization code }; }; }] remoteExec ["spawn", -2, true]; -
[ACE] calling progressBar does not work in vehicles
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I think ["isNotInside"] may very well be the key to the solution! Did some initial testing this morning (the best I can do through a VNC connection from work here), and at least self-interact seems to be working inside the driver seat of a vehicle. I was looking through the ace common & medical functions last night and saw that "isNotInside" being passed from I think the treatment function (as well as "isNotSwimming") but I couldn't find exactly what those keywords were doing. Will do some more testing with that, as well as seeing if I should tag on "isNotSwimming" too, for the situations when trying to use a progressBar function while in the water. I will report back with my findings. :) Thanks for the suggestion, Mr H.! Also to you, HazJ, for your suggestions! -
[ACE] calling progressBar does not work in vehicles
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Still the same behavior Using: [[(vehicle _unit), 0, ["ACE_MainActions"], _progressbartest],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; [[(vehicle _unit), 1, ["ACE_SelfActions"], _progressbartest],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; -
[ACE] calling progressBar does not work in vehicles
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Progress bar works outside of vehicles, but not when inside. I've made a quick video showing the behavior, with the github example: -
[ACE] calling progressBar does not work in vehicles
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_unit = player; Sorry if that seemed confusing, I'll provide the whole WolfPAKinit.sqf here. The _progressbartest handle just calls a test script that I've temporarily embedded into the mod. It is stripped down to just the essentials of calling an ACE progressBar at its most primitive functionality (returning true). _fullheal is the handle for the main script which is exhibiting the same progressBar behavior. WolfPAKinit.sqf [[], { if (isServer) exitWith {}; waitUntil { !(isNull player) && {(player == player)} && {!isNil "BIS_fnc_init"} }; _unit = player; if (hasInterface) then { if (isNil {_unit getVariable ["WolfPAKActive", nil]}) then { _unit setVariable ["WolfPAKActive", true]; // WolfPAK v1.5 - initialization code _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable ['ACE_medical_bodyPartStatus',[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain',0] > 0) or (_target getVariable ['ACE_isUnconscious',false] isEqualTo true))}] call ace_interact_menu_fnc_createAction; _progressbartest = ["progress_bar_test", "<t color='#00ff00'>ProgressBar Test</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_progresbartest.sqf"},{true}] call ace_interact_menu_fnc_createAction; [[_unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; [_unit, 1, ["ACE_SelfActions"], _fullHeal] call ace_interact_menu_fnc_addActionToObject; [_unit, 1, ["ACE_SelfActions"], _progressbartest] call ace_interact_menu_fnc_addActionToObject; systemChat "Initialized WolfPAK v1.5 (PBO)"; // End of WolfPAK v1.5 - initialization code }; }; }] remoteExec ["spawn", -2, true]; wolfpak_progressbartest.sqf _target = _this select 0; _player = _this select 1; [ 3, [], {true}, {true}, "ProgressBar...", {true} ] call ace_common_fnc_progressBar; -
[ACE] calling progressBar does not work in vehicles
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Additionally, the success code segment is never being hit here. -
I've created a mod that is based on calling a script using postInit, which utilizes several function calls and variables from ACE. It was seemingly working for some time, but recently I discovered a flaw that I would like to iron out before I continue with other similar mods based on the same structure/framework. I've narrowed it down to likely some kind of race condition: 1) The ACE add action appears on first server start & client join, but attempting to use the menu item from it does nothing. a) ACE_isUnconscious is null, ACE_medical_pain is null, bodyPartStatus is a non-existent array 2) If client leaves and rejoins server, the mod is working fine and as intended. a) ACE vars are defined now, mod works: Relevant portions of the code that I would think are most relevant are here: config.cpp #include "BIS_AddonInfo.hpp" class CfgPatches //Very important, makes this text into something Arma cares about. https://community.bistudio.com/wiki/CfgPatches { class WTF_WolfPAK { units[] = {}; // Unit classnames addind in this mod. None added here. weapons[] = {}; // Weapon classnames added by this mod. None added here. requiredVersion = 1; requiredAddons[] = {"A3_Modules_F","ace_medical","ace_medical_ai"}; }; }; class CfgFunctions //Script converted to function to be run at the beginning of missions. { class wolfpak //Prefix or tag to keep things tidy. Register it on http://www.ofpec.com/tags/ to aid in compatibility with other addons/mods. See this for a better explanation http://www.ofpec.com/faq/index.php?action=read&cat=202&id=56 { class functions //Define for postInit below. It looks for files with this format fn_thisClassName.sqf (fn_clientFPSinit.sqf) { file = "wolfpak\functions"; // Location of the .sqf function within the .pbo file. class initWolfPAK { postInit = 1; }; }; //Call the function at the beginning of every mission. https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Pre_and_Post_Init }; }; class Extended_PreInit_EventHandlers { wolfpak = "call compile preprocessFileLineNumbers 'wolfpak\XEH_preInit.sqf'"; }; class cfgMods { author = "76561198102736622"; // Your Steam community ID aka GUID timepacked = "1522002158"; // Current build timestamp in UNIX/Epoch format. https://www.epochconverter.com/clock }; fn_initWolfPAK.sqf [] execVM "wolfpak\WolfPAKinit.sqf"; WolfPAKinit.sqf [[], { if (isServer) exitWith {}; waitUntil { !(isNull player) && {(player == player)} && {!isNil "BIS_fnc_init"} }; _unit = player; if (hasInterface) then { if (isNil {_unit getVariable ["WolfPAKActive", nil]}) then { _unit setVariable ["WolfPAKActive", true]; // WolfPAK v1.5 - initialization code #include "\z\ace\addons\medical\script_component.hpp" _unit sideChat format ["bodypartstatus: %1",_unit getVariable [QGVAR(bodyPartStatus),[]]]; _unit sideChat format ["unconscious: %1",_unit getVariable 'ACE_isUnconscious']; _unit sideChat format ["pain: %1",_unit getVariable 'ACE_medical_pain']; _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable [QGVAR(bodyPartStatus),[]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable 'ACE_medical_pain' > 0) or (_target getVariable 'ACE_isUnconscious' isEqualTo true))}] call ace_interact_menu_fnc_createAction; [[_unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true]; [_unit, 1, ["ACE_SelfActions"], _fullHeal] call ace_interact_menu_fnc_addActionToObject; systemChat "Initialized WolfPAK v1.5 (PBO)"; // End of WolfPAK v1.5 - initialization code }; }; }] remoteExec ["spawn", -2, true]; Any advice or suggestions to try?
-
Need help with Personal Aid Kit mod
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Thanks, diwako, your earlier suggestions of specifying defaults for getVariable seemed to have fixed the race condition. Currently working on making the rest of the mod compliant with regarding to removal of hpp files. I've posted another follow-up issue that is related to the same mod, but a different issue -- if you have any insight on that as well... -
Need help with Personal Aid Kit mod
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'll try each of these strategies -- also will tinker with diwako's idea of substituting ACE_medicalbodyPartStatus in place of QGVAR(bodyPartStatus), which I never liked using in the first place as it seemed to require the: #include "\z\ace\addons\medical\script_component.hpp" Will try adjusting the ACE action condition: _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain', 0] > 0) or (_target getVariable ['ACE_isUnconscious', false] isEqualTo true))}] call ace_interact_menu_fnc_createAction; Or as a last resort trying to initialize the ACE vars with defaults if nil: if (_unit getVariable [QGVAR(bodyPartStatus),[]] isEqualTo []) then { _unit setVariable [QGVAR(bodyPartStatus),[0,0,0,0,0,0]]; }; if (isNil (_unit getVariable ['ACE_isUnconscious', nil])) then { _unit setVariable ['ACE_isUnconscious', false]; }; if (isNil (_unit getVariable ['ACE_medical_pain',nil])) then { _unit setVariable ['ACE_medical_pain', 0]; }; -
Resolved: [ACE] Unconscious / Medic Cry Script
mattjb posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Wondering if anyone has any ideas to solve the issue with the script I have here... Issue: If a player goes unconscious, wakes up, and goes down again during the sleep timer, two or more spawns are created (depending on how many times this happens during the sleep). It does clear up if the player stays alive until the sleep timer finishes due to the condition. I'm planning on increasing the sleep period to 60 seconds or so, so this could result in more spawns happening in the sleep duration for the unfortunate player. Another minor annoyance is that because of this, the two or more spawns may include voices from different voice pools due to me randomizing it, sounding a bit awkward. :) Theory: Terminate the _handle on player wake-up; however, I'm not sure how to terminate the _handle for the player due to locality. Is it possible to store a handle via setVariable and retrieve it via getVariable to be terminated? I've also thought about generating a boolean variable stored in the player object and using that to determine if it should spawn another thread (i.e. if (_unit getVariable "runningLoop" isEqualTo true) exitWith {}; ) but I'm having issues with that as well. -
Resolved: [ACE] Unconscious / Medic Cry Script
mattjb replied to mattjb's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I managed to hack up a solution leveraging "time" and setting it into a player variable ("timeDown") to be compared.... so far it seems working. I'm still interested though if there's a way to terminate handles from other scripts. -
Help: counting dead units in trigger area
mattjb posted a topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Is there a means to count the number of dead units in thisList for a trigger area's condition? Trying, unsuccessfully, with something like: ({!alive _x} count thisList) > 0; Does thisList only count alive units for some reason? Note: Using ACE medical - not sure if this affects anything. -
Help: counting dead units in trigger area
mattjb replied to mattjb's topic in ARMA 3 - ADDONS - CONFIGS & SCRIPTING
Your logic worked perfectly pierremgi, although I actually ended up taking it a step further in looking for a side-based area trigger for dead units (to simulate an alarm being pulled to trigger reinforcements without relying on eventhandlers) and came up with a combination that appears to be working: Activation: OPFOR Activation type: Present {_x inArea thisTrigger && getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 0} count allDeadMen > 0; Thanks for the help! :)