The Rook 0 Posted July 12, 2023 Hey, So I've been struggling with this for a while now. I tried every solution I found online, but I didn't manage to make it work. It's probably a mistake from me because I'm not familiar at all with server and network related things. Anyways, so I got an action that I want visible for every player, but if one player completes it, it disappears for every other players. Also, the code executed upon completion must be executed for every player. Here's what I have so far : In the init.sqf: Quote [] execVM "releasePrisoner.sqf"; The releasePrisoner.sqf : Quote [ Dmitri, // Object the action is attached to "Release", // Title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Idle icon shown on screen "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Progress icon shown on screen "_this distance _target < 3", // Condition for the action to be shown "_caller distance _target < 3", // Condition for the action to progress {}, // Code executed when action starts {}, // Code executed on every progress tick { mikhaifree = true; [Dmitri, ""] remoteExec ["switchMove"]; [] remoteExecCall ["BIS_fnc_holdActionRemove", 0]; }, // Code executed on completion {}, // Code executed on interrupted [], // Arguments passed to the scripts as _this select 3 3, // Action duration in seconds 0, // Priority true, // Remove on completion false // Show in unconscious state ] call BIS_fnc_holdActionAdd; // MP compatible implementation I tried differents things, including booleans but...not working. If anyone could put me on the right path that would be awesome ! Share this post Link to post Share on other sites
Casio91Fin 31 Posted July 12, 2023 I don't know if this helps? Here are also a few extra things that you can use Spoiler Dmitri setcaptive true; Dmitri setSkill 1; Dmitri disableAI "MOVE"; Dmitri disableAI "AUTOTARGET"; Dmitri disableAI "ANIM"; Dmitri allowFleeing 0; Dmitri setBehaviour "Careless"; Dmitri addGoggles "G_Blindfold_01_white_F"; _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"]; Dmitri switchMove _anim; if (_anim == "Acts_ExecutionVictim_Loop") then {Dmitri setDamage 0.5;}; //hold actions [ Dmitri, "Release", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { _this select 0 playMove "Acts_ExecutionVictim_Unbow"; } else { _this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out"; }; _complmsn = selectRandom ["text1", "text2", "text3"]; ["Dmitri", _complmsn] remoteExec ["BIS_fnc_showSubtitle"]; sleep .3; (_this select 0) enableAI "MOVE"; (_this select 0) enableAI "AUTOTARGET"; (_this select 0) enableAI "ANIM"; (_this select 0) setBehaviour "SAFE"; (_this select 0) setcaptive false; (_this select 0) setDamage 0; (_this select 0) unassignItem "G_Blindfold_01_white_F"; (_this select 0) removeItem "G_Blindfold_01_white_F"; [(_this select 0)] joinSilent player; [(_this select 0), (_this select 2)] remoteExec ["bis_fnc_holdActionRemove", [0,-2] select isDedicated, true]; }, { _intrmsn = selectRandom ["text4","text5","text6"]; ["Dmitri", _intrmsn] remoteExec ["BIS_fnc_showSubtitle"]; }, [_anim], 4, 0, true, false ] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true]; Share this post Link to post Share on other sites
JCataclisma 38 Posted July 12, 2023 I won't give you a better path because honestly I don't remember exactly how I solved this same issue I had not a long ago. But the thing is: 1.) easiest way, add a removeAllActions command for the unit once the action os executed; 2.) the more professional way would be to give some kind of variable name for this action of yours, and once it's executed, it would remove only the action itself. Please try and take a look from the finished code at the end of this link, but mind you that in that case, Larrow sugested a "loop" of On/Off actions, so that player would turn smoke on and off. In your case, you don't need the action become available again once executed, ever, correct? I'll try to find the topics that helped me a few weeks ago, but in the meantime someone will probably bring here a decent solution. Share this post Link to post Share on other sites
The Rook 0 Posted July 13, 2023 22 hours ago, Casio91Fin said: I don't know if this helps? Here are also a few extra things that you can use Reveal hidden contents Dmitri setcaptive true; Dmitri setSkill 1; Dmitri disableAI "MOVE"; Dmitri disableAI "AUTOTARGET"; Dmitri disableAI "ANIM"; Dmitri allowFleeing 0; Dmitri setBehaviour "Careless"; Dmitri addGoggles "G_Blindfold_01_white_F"; _anim = selectRandom ["Acts_AidlPsitMstpSsurWnonDnon01","Acts_AidlPsitMstpSsurWnonDnon02","Acts_AidlPsitMstpSsurWnonDnon03","Acts_AidlPsitMstpSsurWnonDnon04","Acts_AidlPsitMstpSsurWnonDnon05","Acts_ExecutionVictim_Loop"]; Dmitri switchMove _anim; if (_anim == "Acts_ExecutionVictim_Loop") then {Dmitri setDamage 0.5;}; //hold actions [ Dmitri, "Release", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "\a3\ui_f\data\IGUI\Cfg\HoldActions\holdAction_unbind_ca.paa", "_this distance _target < 3", "_caller distance _target < 3", {}, {}, { if (_this select 3 select 0 == "Acts_ExecutionVictim_Loop") then { _this select 0 playMove "Acts_ExecutionVictim_Unbow"; } else { _this select 0 switchMove "Acts_AidlPsitMstpSsurWnonDnon_out"; }; _complmsn = selectRandom ["text1", "text2", "text3"]; ["Dmitri", _complmsn] remoteExec ["BIS_fnc_showSubtitle"]; sleep .3; (_this select 0) enableAI "MOVE"; (_this select 0) enableAI "AUTOTARGET"; (_this select 0) enableAI "ANIM"; (_this select 0) setBehaviour "SAFE"; (_this select 0) setcaptive false; (_this select 0) setDamage 0; (_this select 0) unassignItem "G_Blindfold_01_white_F"; (_this select 0) removeItem "G_Blindfold_01_white_F"; [(_this select 0)] joinSilent player; [(_this select 0), (_this select 2)] remoteExec ["bis_fnc_holdActionRemove", [0,-2] select isDedicated, true]; }, { _intrmsn = selectRandom ["text4","text5","text6"]; ["Dmitri", _intrmsn] remoteExec ["BIS_fnc_showSubtitle"]; }, [_anim], 4, 0, true, false ] remoteExec ["BIS_fnc_holdActionAdd",[0,-2] select isDedicated,true]; I tried that out, but again same problem. Perfectly works for one player, but as soon there are more than one player on the server, the action gets duplicated as many times as there are players, and the AI get desynchronized (I mean by that the player who released it will see the AI free and moving, but the others players won't). Plus the action won't disappear even if one player completed it. 19 hours ago, JCataclisma said: I won't give you a better path because honestly I don't remember exactly how I solved this same issue I had not a long ago. But the thing is: 1.) easiest way, add a removeAllActions command for the unit once the action os executed; 2.) the more professional way would be to give some kind of variable name for this action of yours, and once it's executed, it would remove only the action itself. Please try and take a look from the finished code at the end of this link, but mind you that in that case, Larrow sugested a "loop" of On/Off actions, so that player would turn smoke on and off. In your case, you don't need the action become available again once executed, ever, correct? I'll try to find the topics that helped me a few weeks ago, but in the meantime someone will probably bring here a decent solution. Isn't removeAllActions for the actions on the left menu ? I'm using the HoldAction, I don't think it's the same. I'll take a look at the white smoke thing and try to give it a go. Share this post Link to post Share on other sites
Larrow 2808 Posted July 13, 2023 Spoiler //description.ext class CfgFunctions { class Prisoner { tag = "TAG"; class Category { file = "functions"; class addPrisonerHA { postInit = 1; }; //Automatically run class removePrisonerHA {}; }; }; }; //functions\fn_addPrisonerHA.sqf //If is dedicated Server( only want to add HA to clients ) if ( isDedicated ) exitWith {}; //If Dmitri no longer exists, abort if ( isNil "Dmitri" || { isNull Dmitri } ) exitWith {}; //Save the unique HoldAction index for this client prisonerReleaseHA = [ Dmitri, // Object the action is attached to "Release", // Title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Idle icon shown on screen "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Progress icon shown on screen "_this distance _target < 3", // Condition for the action to be shown "_caller distance _target < 3", // Condition for the action to progress {}, // Code executed when action starts {}, // Code executed on every progress tick { // Code executed on completion mikhaifree = true; [Dmitri, ""] remoteExec ["switchMove", Dmitri]; //SwitchMove where Dmitri is local [] remoteExec ["TAG_fnc_removePrisonerHA", 0, true ]; //Everyone and JIP }, {}, // Code executed on interrupted [], // Arguments passed to the scripts as _this select 3 3, // Action duration in seconds 0, // Priority true, // Remove on completion false // Show in unconscious state ] call BIS_fnc_holdActionAdd; // Just added locally for this client //functions\fn_removePrisonerHA //No HA on dedicated, abort if ( isDedicated ) exitWith {}; //If Dmitri no longer exists, abort if ( isNil "Dmitri" || { isNull Dmitri } ) exitWith {}; //So removal from JIP works waitUntil{ //Waituntil HA index has been set !isNil "prisonerReleaseHA"; }; //Remove HA [ Dmitri, prisonerReleaseHA ] call BIS_fnc_holdActionRemove; Think that should work, untested. 1 Share this post Link to post Share on other sites
The Rook 0 Posted July 19, 2023 On 7/13/2023 at 8:25 PM, Larrow said: Reveal hidden contents //description.ext class CfgFunctions { class Prisoner { tag = "TAG"; class Category { file = "functions"; class addPrisonerHA { postInit = 1; }; //Automatically run class removePrisonerHA {}; }; }; }; //functions\fn_addPrisonerHA.sqf //If is dedicated Server( only want to add HA to clients ) if ( isDedicated ) exitWith {}; //If Dmitri no longer exists, abort if ( isNil "Dmitri" || { isNull Dmitri } ) exitWith {}; //Save the unique HoldAction index for this client prisonerReleaseHA = [ Dmitri, // Object the action is attached to "Release", // Title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Idle icon shown on screen "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_secure_ca.paa", // Progress icon shown on screen "_this distance _target < 3", // Condition for the action to be shown "_caller distance _target < 3", // Condition for the action to progress {}, // Code executed when action starts {}, // Code executed on every progress tick { // Code executed on completion mikhaifree = true; [Dmitri, ""] remoteExec ["switchMove", Dmitri]; //SwitchMove where Dmitri is local [] remoteExec ["TAG_fnc_removePrisonerHA", 0, true ]; //Everyone and JIP }, {}, // Code executed on interrupted [], // Arguments passed to the scripts as _this select 3 3, // Action duration in seconds 0, // Priority true, // Remove on completion false // Show in unconscious state ] call BIS_fnc_holdActionAdd; // Just added locally for this client //functions\fn_removePrisonerHA //No HA on dedicated, abort if ( isDedicated ) exitWith {}; //If Dmitri no longer exists, abort if ( isNil "Dmitri" || { isNull Dmitri } ) exitWith {}; //So removal from JIP works waitUntil{ //Waituntil HA index has been set !isNil "prisonerReleaseHA"; }; //Remove HA [ Dmitri, prisonerReleaseHA ] call BIS_fnc_holdActionRemove; Think that should work, untested. I tested it out and it seems to work fine. Except that the boolean in "code executed on completion" now only seems to change its value only for the player who completed the action. When this boolean switches to true, it lead to other events. It was working fine for all the players before. I suppose it's still my execution method that's wrong. Share this post Link to post Share on other sites
Larrow 2808 Posted July 21, 2023 On 7/19/2023 at 4:52 PM, The Rook said: Except that the boolean in "code executed on completion" now only seems to change its value only for the player who completed the action. It was working fine for all the players before. Impossible that it would have changed for other players before, its a global variable set inside an addAction, it would only have ever changed on the client machine where the action was used. Anway change... mikhaifree = true; ...to... missionNamespace setVariable[ "mikhaifree", true, true ]; ...will broadcast the change to all. Share this post Link to post Share on other sites