Jump to content
xeenenta

createDialog not executing for Zeus in MP

Recommended Posts

Hi Everyone,

 

I'm looking for some help regarding a zeus module that I am creating. To give some background, the module (when placed) should prompt the user to use sliders to configure a radius and number of AI with which to garrison buildings within said defined radius. I think I'm running into an issue with execution locality, as this works perfectly in the editor.

Expected behavior:
User selects the module in zeus and places it somewhere on the map

Dialog box appears to ask them to configure radius and number of AI
User hits OK and it calls another function to start placing AI relative to the module location

 

In singleplayer this works as above (I imagine this is due to the server and client both being local)
In multiplayer, the function to create the dialog is executed on the server (evidenced by debug output to the console), but a dialog does not appear for Zeus

My module is defined as follows:
 

	class xeen_module_base: Module_F
	{	
		icon = "\xeen_modules\insignia.paa";
		category = "xeen_modules";
		isGlobal = 0;
		isTriggerActivated = 1;
		isDisposable = 1;
		is3DEN = 0;	
		curatorCanAttach = 1;
		scope = 1;
		scopeCurator = 1;
	};

	class xeen_moduleGarrison: xeen_module_base
	{
		displayName = "Garrison Area";
		function = "xeen_fnc_garrisonModuleDialog";
		functionPriority = 10;
		scope = 2;
		scopeCurator = 2;	
		class Attributes: AttributesBase
		{
			class GarrisonSpread: Edit
			{
				property = "xeen_moduleGarrison_GarrisonSpread";
				displayName = "Unit Spread (m)";
				tooltip = "The distance of buildings to be garrisoned";
				typeName = "NUMBER";
				defaultValue = "50";
			};
			class MaxPerBuilding: Edit
			{
				property = "xeen_moduleGarrison_MaxPerBuilding";
				displayName = "Max units per building";
				tooltip = "Max units per building";
				typeName = "NUMBER";
				defaultValue = "5";
			};
			//class ModuleDescription: ModuleDescription{}; // Module description should be shown last
		};
		#include "description.hpp"
	};

and it calls the following function:

 

/*
 * Author: Xeenenta
 * Opens the dialog menu for the garrison module
 *
 * Arguments:
 * 0: Logic <LOGIC>
 *
 * Return Value:
 * None
 *
 * Example:
 * [_logic] call xeen_garrison_fnc_garrisonModuleDialog
 *
 * Public: No
 */

// Parameters
params ["_logic"];

_logicLocation = getPos _logic;

diag_log format ["Spawning display with logic %1", _logicLocation];

// Create display
createDialog "garrisonModuleDialog";
_display = findDisplay 99;

// Set Variable
_display setVariable ["_logicLocation", _logicLocation];

diag_log "Finished spawning display";

and my dialog is defined here:
 

class garrisonModuleDialog
{
	idd = 99;
	access = 0;
	movingEnable = false;
	enableSimulation = false;
	class ControlsBackground
	{
		class IGUIBack_2200: IGUIBack
		{
			idc = 2200;
			x = 0;
			y = 0.4;
			w = 1;
			h = 0.6;
		};
		class RscStructuredText_1100: RscStructuredText
		{
			idc = 1100;
			text = "AI per building:"; //--- ToDo: Localize;
			x = 0.025;
			y = 0.68;
			w = 0.17;
			h = 0.05;
		};
		class RscStructuredText_1101: RscStructuredText
		{
			idc = 1101;
			text = "Garrison Radius:"; //--- ToDo: Localize;
			x = 0.025;
			y = 0.44;
			w = 0.17;
			h = 0.05;
		};
		class RscStructuredText_1102: RscStructuredText
		{
			idc = 1102;
			text = "0"; //--- ToDo: Localize;
			x = 0.1625;
			y = 0.68;
			w = 0.06;
			h = 0.05;
		};
		class RscStructuredText_1103: RscStructuredText
		{
			idc = 1103;
			text = "0m"; //--- ToDo: Localize;
			x = 0.2;
			y = 0.44;
			w = 0.06;
			h = 0.05;
		};
	};
	class Controls
	{
		class RscButtonMenuOK_2600: RscButtonMenuOK
		{
			idc = 1234;
			x = 0.875;
			y = 0.88;
			w = 0.1;
			h = 0.1;
			onButtonClick = "[(findDisplay 99) getVariable ['_logicLocation', objNull], sliderPosition 1901, sliderPosition 1900] call xeen_fnc_garrisonModuleInit; (findDisplay 99) closeDisplay 1;"
		};
		class RscButtonMenuCancel_2700: RscButtonMenuCancel
		{
			x = 0.75;
			y = 0.88;
			w = 0.1;
			h = 0.1;
		};
		class RscSlider_1900: RscSlider
		{
			idc = 1900;
			x = 0.025;
			y = 0.74;
			w = 0.95;
			h = 0.1;
			type = 43;
			arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";
			arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";
			border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";
			thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa";
			color[] = {1,1,1,0.5};
            coloractive[] = {1,1,1,1};
            sliderPosition = 0;
            sliderRange[] = {0,10};
            sliderStep = 1;
            lineSize = 1;
			onSliderPosChanged="((findDisplay 99) displayCtrl 1102) ctrlSetStructuredText parseText str(sliderPosition 1900)"
		};

		class RscSlider_1901: RscSlider
		{
			idc = 1901;
			x = 0.025;
			y = 0.5;
			w = 0.95;
			h = 0.1;
			type = 43;
			arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";
			arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";
			border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";
			thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa";
			color[] = {1,1,1,0.5};
            coloractive[] = {1,1,1,1};
            sliderPosition = 5;
            sliderRange[] = {0,100};
            sliderStep = 10;
            lineSize = 1;
			onSliderPosChanged="((findDisplay 99) displayCtrl 1103) ctrlSetStructuredText parseText str(sliderPosition 1901)"
		};

	};
	class Objects
	{

	};
};

Any thoughts? Full source code can be found at: https://github.com/Xeenenta/xeenenta-enhanced-battlefield if anyone wanted to go digging around.

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

×