Ulmann 45 Posted August 16, 2018 Hello again, I have another question: I try to use bis_fnc_holdAction but have a trouble, when I play my coop-mission in multiplayer (server is hosted by player in game) action is duplicated and is not deleted after executing the code, also the code is executed only locally (only on player who performed the action). There is my code, any things how I can fix it? Thanks. [myTerminal, "Hack Terminal", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_this distance _target < 3", "_caller distance _target < 2", {playSound "HackStart"}, {Hint "Hacking..."}, {Hacked = True; PublicVariable "Hacked"}, {Hint "Stop Hacking"}, [], 25, 0, true, false] remoteExec ["BIS_fnc_holdActionAdd", 0, myTerminal]; Second question about PlaySound, when I execute code sound plays somewhere too far and barely heard, any ideas? Share this post Link to post Share on other sites
davidoss 550 Posted August 17, 2018 the most important information was not provided: where you have put this code Share this post Link to post Share on other sites
Ulmann 45 Posted August 17, 2018 7 hours ago, davidoss said: the most important information was not provided: where you have put this code I put this in trigger with condition: Player distance OfficerSLA < 3 and alive OfficerSLA PlaySound I put in the script which called from the trigger with condition: {alive _x} count units FT1 == 0 and {alive _x} count units FT2 == 0} Script: ["End2", false, true, false, false] spawn BIS_fnc_endMission; _sound = switch (selectRandom [1,2,3]) do { case 1 : {"LooseV1"}; case 2 : {"LooseV2"}; case 3 : {"LooseV3"}; }; playSound _sound; Share this post Link to post Share on other sites
davidoss 550 Posted August 17, 2018 I do not understand what end missions sound has together with hacking sound but here you have code which i would use in serverside init. You need to pay attention for command parameters and effect locality. [ myTerminal, // Object the action is attached to "Hack Terminal", // Title of the action "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Idle icon shown on screen "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", // Progress icon shown on screen "_this distance _target < 3", // Condition for the action to be shown "_caller distance _target < 2", // Condition for the action to progress { 0 = [ ["A3\Sounds_F\sfx\objects\upload_terminal\Upload_terminal_loop", myTerminal, true, getPosASL myTerminal , 1, 1, 50] ] remoteExecCall ["playSound3D", [0,-2] select isDedicated,false] }, // Code executed when action starts {Hint "Hacking..."}, // Code executed on every progress tick { Hacked = True; PublicVariable "Hacked"; 0 = [(myTerminal,(_this select 2)] remoteExec ["bis_fnc_holdActionRemove", [0,-2] select isDedicated,myTerminal] }, // Code executed on completion {Hint "Stop Hacking"}, // Code executed on interrupted [], // Arguments passed to the scripts as _this select 3 25, // Action duration [s] 0, // Priority true, // Remove on completion false // Show in unconscious state ] remoteExec ["BIS_fnc_holdActionAdd", [0,-2] select isDedicated, myTerminal]; // MP compatible implementation 1 1 Share this post Link to post Share on other sites
Larrow 2803 Posted August 19, 2018 You would be better off removing the remoteExec item from the JIP queue, rather than queuing up both an add and a remove JIP queue items. Especially if this system was used multiple times, the JIP queue would become extremely messy (and I personally would not rely on it to add remove the holdActions in the correct order). Does myTerminal really ever become null? As there is no point in using it as a JIP parameter if not. //initServer.sqf [ myTerminal ] remoteExec["TAG_fnc_addHackAction", [ 0, -2 ] select isDedicated, "HackActionJIPID"]; if ( isDedicated ) then { TAG_fnc_remHackAction = { //Remove JIP que Dedicated remoteExec[ "", "HackActionJIPID" ]; }; }; //initPlayerLocal.sqf TAG_fnc_addHackAction = { params[ "_object" ]; _actionID = [ _object, "Hack Terminal", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "_this distance _target < 3", "_caller distance _target < 2", { playSound "HackStart" }, { hint "Hacking Terminal" }, { params[ "_object" ]; //Remove hack action and handle JIP que [ _object ] remoteExec[ "TAG_fnc_remHackAction", 0 ]; }, {hint "Stop Hacking"}, [], 25, 0, true, false ] call BIS_fnc_holdActionAdd; _object setVariable [ "hackAction", _actionID ]; }; TAG_fnc_remHackAction = { params[ "_object" ]; _actionID = _object getVariable [ "hackAction", -1 ]; if ( _actionID > -1 ) then { [ _object, _actionID ] call BIS_fnc_holdActionRemove; }; if ( isServer ) then { //Remove JIP que Hosted remoteExec[ "", "HackActionJIPID" ]; }; }; 1 1 Share this post Link to post Share on other sites