Jump to content
MajorBlunderbuss

BIS_fnc_holdActionAdd not working in Multiplayer?

Recommended Posts

Greetings,

 

I'm currently trying to fix a few things in an beloved mission of mine called OPEX, made by Gemini. He probably retired from this work a couple of years ago, and some things just brake with time - I guess.

 

Theres especially one selectable task in this mission which drives me nuts since a few days. It's about installing a so called "Spy Wire/Microphone" inside of a building. The install process is handled with an HoldActionAdd, and in SP everything works fine - but in MP, this is the only HoldActionAdd I came across that doesn't work - the scrollbar entry just doesn't show up. Apparently, Gemini had to fix this exact problem by himself about two times in the past.

 

You can check the crucial part of the code below. If anyone around here could tell me what's wrong with it or, even better, is able to fix it, make it work, It'd be highly appreciated - cause I'm out of options.

 

Regards,

MajorBlunderbuss

 

	// ADDING ACTION TO BUILDING
	spotted = false;
	microInstallation = 0; publicVariable "microInstallation";
	/*
	[
		_building, // Object the action is attached to
		localize "STR_action_installSpyMicro", // 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
		"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)", // Condition for the action to be shown
		"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)", // Condition for the action to progress
		{hint localize "STR_hint_installSpyMicroStart"; (_this select 1) playActionNow "Gear"}, // Code executed when action starts
		{microInstallation = microInstallation + 1; publicVariable "microInstallation"; (_this select 1) playActionNow "Gear"}, // Code executed on every progress tick
		{hint localize "STR_hint_installSpyMicroDone"; if ((_this select 1) call (_this select 3 select 0)) then {(_this select 1) removeItem "Gemini_spyMicro"}; sleep 3; if (!spotted) then {hint localize "STR_hint_leaveAreaStealth"}}, // Code executed on completion
		{if (microInstallation >= 24) then {hint localize "STR_hint_installSpyMicroDone"; if ((_this select 1) call (_this select 3 select 0)) then {(_this select 1) removeItem "Gemini_spyMicro"}; sleep 3; if (!spotted) then {hint localize "STR_hint_leaveAreaStealth"}}},	// Code executed on interrupted
		[],	// Arguments passed to the scripts as _this select 3
		12, // Action duration [s]
		10, // Priority
		true, // Remove on completion
		false // Show in unconscious state
	] remoteExec ["BIS_fnc_holdActionAdd", 0, _building]; // MP compatible implementation
	*/
	[
		_building,
		["STR_action_installSpyMicro", "white"],
		"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
		"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)", "(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)",
		{hint localize "STR_hint_installSpyMicroStart"; (_this select 1) playActionNow "Gear"}, {microInstallation = microInstallation + 1; publicVariable "microInstallation"; (_this select 1) playActionNow "Gear"},
		{hint localize "STR_hint_installSpyMicroDone"; if ((_this select 1) call (_this select 3 select 0)) then {(_this select 1) removeItem "Gemini_spyMicro"}; sleep 3; if (!spotted) then {hint localize "STR_hint_leaveAreaStealth"}},
		{if (microInstallation >= 24) then {hint localize "STR_hint_installSpyMicroDone"; if ((_this select 1) call (_this select 3 select 0)) then {(_this select 1) removeItem "Gemini_spyMicro"}; sleep 3; if (!spotted) then {hint localize "STR_hint_leaveAreaStealth"}}},
		[],
		12,
		10,
		true, false, true
	] remoteExec ["Gemini_fnc_holdActionAdd", 0, _building];

 

Share this post


Link to post
Share on other sites

"Gemini_fnc_holdActionAdd" Where do you define this? If you're using a BIS function, it stays with a BIS_ prefix because that's the whole function name.

Share this post


Link to post
Share on other sites

@honger - "Gemini_fnc_holdActionAdd" is defined inside the mission folder, found under \opex_kunduz.kunduz\scripts\Gemini\fnc_holdActionAdd.

 

I already tried different approaches, replaced "Gemini_fnc_holdActionAdd" with "BIS_fnc_holdActionAdd" (In the task itself, not in "fnc_holdActionAdd"), and some other stuff I thought it might help - but without any success.

 

The whole thing (fnc_holdActionAdd) looks like this:

 

/*
	example 1:
	[player, ["STR_myLocalizedText", "white"], ""\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", ""\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "true", "true", {}, {}, {hint "CODE OK"}, {hint "CODE INTERRRUPTED"}, [], 1, 10, true, false, true] call BIS_fnc_holdActionAdd;

	example 2:
	[_vehicle, ["STR_action_searchVehicle", "white"], "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", "(_target distance2D _this < 6) && (alive _target)", "(_target distance2D _this < 6) && (alive _target)", {}, {}, {_this call Gemini_fnc_searchVehicle}, {}, [], 10, 0, false, false, true] remoteExec ["Gemini_fnc_holdActionAdd", 0, _vehicle];
*/

private _entity = param [0, objNull, [objNull, 0]];
private _text = param [1, ["noLocalizedText", "white"], [["", ""]]];
private _iconShow = param [2, "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", [""]];
private _iconProgress = param [3, "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa", [""]];
private _conditionShow = param [4, "true", [""]];
private _conditionProgress = param [5, "true", [""]];
private _codeStart = param [6, {}, [{}]];
private _codeProgress = param [7, {}, [{}]];
private _codeCompleted = param [8, {}, [{}]];
private _codeInterrupted = param [9, {}, [{}]];
private _arguments = param [10, [], [[]]];
private _duration = param [11, 1, [1]];
private _priority = param [12, 10, [10]];
private _removeCompleted = param [13, true, [true]];
private _showUnconscious = param [14, false, [false]];
private _showWindow = param [15, true, [true]];

private _localizedText = _text select 0;
private _color = "";
switch (_text select 1) do
 	{
 		case "white"	:	{_color = "<t color='#FFFFFF'>"};
 		case "red"		:	{_color = "<t color='#FF0000'>"};
 		case "green"	:	{_color = "<t color='#00A903'>"};
 		case "orange"	:	{_color = "<t color='#EC9A00'>"};
 		default 			{_color = "<t color='#FFFFFF'>"};
 	};

[_entity, _color + (localize _localizedText) + "</t>", _iconShow, _iconProgress, _conditionShow, _conditionProgress, _codeStart, _codeProgress, _codeCompleted, _codeInterrupted, _arguments, _duration, _priority, _removeCompleted, _showUnconscious, _showWindow] call BIS_fnc_holdActionAdd;

 

Share this post


Link to post
Share on other sites

Addition: I've build the code up from scratch with the help of the BIS-Wiki and simplified the crucial section, but again, it works completely in SP, but in MP I can only play this task to the point where I have to install the "Spy Wire" - but I don't get the action to install it.

 

What is it that I and the original creator seem to be missing? It now looks like this:

 

 

	// ADDING ACTION TO BUILDING
	spotted = false;
	microInstallation = 0; publicVariable "microInstallation";

    [
    	_building,
    	"Please install it",
    	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    	"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)",
    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)",
    	{hint "Wow, it works"; (_this select 1) playActionNow "Gear"},
    	{microInstallation = microInstallation + 1; publicVariable "microInstallation"; (_this select 1) playActionNow "Gear"},
    	{ hint "Congrats, you again installed the wire in SP"; if ((_this select 1) call (_this select 3 select 0)) then {(_this select 1) removeItem "Gemini_spyMicro"}; sleep 3; if (!spotted) then {hint "Leave the area and help me ffs" }},
    	{if (microInstallation >= 24) then {hint "I live, so I suffer"; if ((_this select 1) call (_this select 3 select 0)) then {(_this select 1) removeItem "Gemini_spyMicro"}; sleep 3; if (!spotted) then {hint "Sweating Bullets"}}},
    	[],
    	12,
    	0,
    	true,
    	false
    ] remoteExec ["BIS_fnc_holdActionAdd", 0, _building];

 

 

IMPORTANT EDIT: I was able to get it working in MP, but only by deleting the custom conditions for the action to be shown and progress, and by replacing them with the default conditions (distance to object):

 

Custom:

    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)",
    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)",

 

Default:

    	"_this distance _target < 3",
    	"_caller distance _target < 3",

 

So the culprit must be the custom conditions for the action to be shown and progress. But why? If someone is able to figure it out, I'd be mighty grateful!

Share this post


Link to post
Share on other sites
10 hours ago, MajorBlunderbuss said:

IMPORTANT EDIT: I was able to get it working in MP, but only by deleting the custom conditions for the action to be shown and progress, and by replacing them with the default conditions (distance to object):

 

Custom:


    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)",
    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (!spotted) && (_this call fnc_hasMicro) && (microInstallation < 24)",

 

Default:


    	"_this distance _target < 3",
    	"_caller distance _target < 3",

 

So the culprit must be the custom conditions for the action to be shown and progress. But why? If someone is able to figure it out, I'd be mighty grateful!

 

If this fixed the issue one of the logic tests in the previous conditions obviously failed. To know for sure you'd have test them individually and see which one returns false.

 

I'd do that before attempting a further fix.

Share this post


Link to post
Share on other sites

@mrcurry - Yeah, testing them individually was the exact thing I was doing for the last 1 1/2 hours - with some interesting results.


Turns out that this combination of conditions is working in MP:

 

    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (microInstallation < 24)",
    	"(OPEX_taskID == '13') && ((position _this) call Gemini_fnc_isInsideBuilding) && (microInstallation < 24)",

 

And the conditions that don't work in MP (but in SP) are:

 

1.

    	"(!spotted)",
    	"(!spotted)",

2.

    	"(_this call fnc_hasMicro)",
    	"(_this call fnc_hasMicro)",

 

Those two are the culprit for the whole thing not working correctly in MP. I guess I won't be able to completely fix this without someone that has more knowledge than me. But for the moment, the task is at least working in some, more or less, satisfying way. The fact that I now can install the "Spy Wire" while being spotted is no problem at all, since the task fails anyway when being spotted - at least by an enemy. Being able to install the "Spy Wire" without actually carrying it is a bit odd, but still acceptable - I'd take it with me anyway. Still, getting all of this working the way it was supposed to be would be nice.

 

Until then, have a nice day folks!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×