Jump to content
JasperRab

Error with making a module.

Recommended Posts

Hello forum,

 

I keep getting an error when I try to make an module. The error is: [bIS_fnc_moduleExecute] Cannot execute module, error found in "a_function_name".

 

I've rebuild the module multiple times, I even copied everything from the Arma 3 Module Framework page and still get the error.

 

Does anyone of you guys know where I'm wrong with this? Or anyone has this issue fixed and knows the solution.

Share this post


Link to post
Share on other sites

I've made a new one multiple times but here are two one of them is one I made and the other one is from the BIKI page.
 
My one:

class CfgPatches
{
	class etr_operation_assets_modules_test
	{
		units[]={};
		requiredVersion=0.1;
		requiredAddons[]={"A3_Modules_F"};
	};
};

class CfgFactionClasses
{
	class NO_CATEGORY;
	class etr_modules: NO_CATEGORY
	{
		displayName = "[ETR]";
	};
};

class CfgFunctions 
{
	class etr_operation_assets_modules_test
	{
		class Test
		{
			file = "\etr_operation_assets\Modules\test\Functions";
			class test{};
		};
	};
};

class CfgVehicles
{
	class Logic;
	class Module_F: Logic
	{
		class ArgumentsBaseUnits
		{
			class Units;
		};
		class ModuleDescription
		{
			class AnyBrain;
		};
	};
	class etr_modules_test: Module_F
	{
		author="ETR Dev Team";
		scope=2;
		icon="\etr_operation_assets\Modules\Test\Data\iconTest.paa";
		displayName="Testing Module";
		category="etr_modules";
		function="etr_modules_fnc_test";
		functionPriority=1;
		isGlobal=2;
		isTriggerActivated=0;
		isDisposable=1;
		class Arguments
		{
			class number
			{
				displayName="Some number?";
                                description="IDK what this does just select a number.";
				typeName="NUMBER";
				class values
                                {
                                class null
		                {
		                    name="null";
		                    value=0;
		                };
                                class one
                                {
                                    name="one";
                                    value=1;
                                    default=1;
                                };
                                class two
                                {
                                   name="two";
                                   value=2;
                                };
                        };
	          };
	    };
      };
}; 

 

The BIKI one:

class CfgPatches
{
	class myTag_addonName
	{
		units[] = {"myTag_ModuleNuke"};
		requiredVersion = 1.0;
		requiredAddons[] = {"A3_Modules_F"};
	};
};

class CfgVehicles
{
	class Logic;
	class Module_F: Logic
	{
		class ArgumentsBaseUnits
		{
			class Units;
		};
		class ModuleDescription
		{
			class AnyBrain;
		};
	};
	class myTag_ModuleNuke: Module_F
	{
		// Standard object definitions
		scope = 2; // Editor visibility; 2 will show it in the menu, 1 will hide it.
		displayName = "Nuclear Explosion"; // Name displayed in the menu
		icon = "\etr_modules\data\iconTest.paa"; // Map icon. Delete this entry to use the default icon
		category = "Effects";

		// Name of function triggered once conditions are met
		function = "myTag_fnc_moduleNuke";
		// Execution priority, modules with lower number are executed first. 0 is used when the attribute is undefined
		functionPriority = 1;
		// 0 for server only execution, 1 for remote execution on all clients upon mission start, 2 for persistent execution
		isGlobal = 1;
		// 1 for module waiting until all synced triggers are activated
		isTriggerActivated = 1;
		// 1 if modules is to be disabled once it's activated (i.e., repeated trigger activation won't work)
		isDisposable = 1;

		// Menu displayed when the module is placed or double-clicked on by Zeus
		curatorInfoType = "RscDisplayAttributeModuleNuke";

		// Module arguments
		class Arguments: ArgumentsBaseUnits
		{
			// Arguments shared by specific module type (have to be mentioned in order to be placed on top)
			class Units: Units {};
			// Module specific arguments
			class Yield
  			{
				displayName = "Nuclear weapon yield"; // Argument label
				description = "How strong will the explosion be"; // Tooltip description
				typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
				class values
				{
					class 50Mt	{name = "50 megatons";	value = 50; default = 1;}; // Listbox item
					class 100Mt	{name = "100 megatons"; value = 100;};
				};
			};
			class Name
  			{
				displayName = "Name";
				description = "Name of the nuclear device";
				defaultValue = "Tsar Bomba"; // Default text filled in the input box
				// When no 'values' are defined, input box is displayed instead of listbox
			};
		};

		// Module description. Must inherit from base class, otherwise pre-defined entities won't be available
		class ModuleDescription: ModuleDescription
		{
			description = "Short module description"; // Short description, will be formatted as structured text
			sync[] = {"LocationArea_F"}; // Array of synced entities (can contain base classes)
	 
			class LocationArea_F
			{
				description[] = { // Multi-line descriptions are supported
					"First line",
					"Second line"
				};
				position = 1; // Position is taken into effect
				direction = 1; // Direction is taken into effect
				optional = 1; // Synced entity is optional
				duplicate = 1; // Multiple entities of this type can be synced
				synced[] = {"BLUFORunit","AnyBrain"}; // Pre-define entities like "AnyBrain" can be used. See the list below
			};
			class BLUFORunit
			{
				description = "Short description";
				displayName = "Any BLUFOR unit"; // Custom name
				icon = "iconMan"; // Custom icon (can be file path or CfgVehicleIcons entry)
				side = 1; // Custom side (will determine icon color)
			};
		};
	};
};

class CfgFunctions 
{
	class myTag
	{
		class Effects
		{
			file = "\etr_modules\functions";
			class test{};
		};
	};
}; 

 

As you can see I changed barely anything in the one from BIKI only the path to the file.

 

And the errors I'm getting are with the function name etr_modules_fnc_test and myTag_fnc_moduleNuke.

Share this post


Link to post
Share on other sites

It's because your function "etr_modules_fnc_test", doesn't exist, because you haven't defined a "tag" for your functions in CfgFunctions, so you need to do the following to make it work the way you want:

class CfgFunctions 
{
	class etr_operation_assets_modules_test
	{
		tag = "etr_modules";
		class Test
		{
			file = "\etr_operation_assets\Modules\test\Functions";
			class test{};
		};
	};
};

Here is an example of how my custom module setup looks like, using my simple garrison function:

class CfgPatches
{
	class JSHK_garrison
	{
		units[] = {"JSHK_garrisonModule"};
		requiredVersion = 1.0;
		requiredAddons[] = {"A3_Modules_F"};
	};
};

class CfgFactionClasses
{
	class JSHK;
	class JSHK_garrisonClass: JSHK
	{
		displayName = "JSHK - Garrison";
	};
};

class CfgVehicles
{
	class Logic;
	class Module_F: Logic
	{
		class ArgumentsBaseUnits
		{
			class Units;
		};
		class ModuleDescription
		{
			class EmptyDetector;
		};
	
	};
	
	class JSHK_garrisonModule: Module_F
	{
		scope = 2;
		displayName = "JSHK - Garrison";
		category = "Garrison";
		
		function = "JSHK_fnc_garrison";
		functionPriority = 1;
		isGlobal = 0;
		isTriggerActivated = 1;
		isDisposable = 1;
		
		curatorInfoType = "RscDisplayAttributegarrisonModule";
		
		class Arguments: ArgumentsBaseUnits
		{
			// Arguments shared by specific module type (have to be mentioned in order to be placed on top)
			class Units: Units {};
			
			class JSHK_garrisonSide
			{
				displayName = "Side of Garrisoned Units"; // Argument label
				description = "Choose One"; // Tooltip description
				typeName = "STRING"; // Value type, can be "NUMBER", "STRING" or "BOOL"
				class values
				{
					class EAST	{name = "EAST";	value = "east"; default = 1;}; // Listbox item
					class WEST	{name = "WEST"; value = "west";};
					class INDEPENDENT	{name = "INDEPENDENT"; value = "independent";};
					class CIVILIAN	{name = "CIVILIAN"; value = "civilian";};
				};
			};
			
			class JSHK_garrisonRadius
			{
				displayName = "Garrison Radius"; // Argument label
				description = ""; // Tooltip description
				typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
				defaultValue = 200;
			};
			
			class JSHK_garrisonPercent
			{
				displayName = "Building Fill Percentage"; // Argument label
				description = "Must be between 0-1"; // Tooltip description
				typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
				defaultValue = 0.2;
			};
			
			class JSHK_garrisonLimit
			{
				displayName = "Limit Units Spawned"; // Argument label
				description = ">(-1) overwrites percent fill, (-1) to use percent"; // Tooltip description
				typeName = "NUMBER"; // Value type, can be "NUMBER", "STRING" or "BOOL"
				defaultValue = -1;
			};
			
			class JSHK_garrisonUnits
			{
				displayName = "Types of Units"; // Argument label
				description = "Array of Classnames"; // Tooltip description
				typeName = "ARRAY"; // Value type, can be "NUMBER", "STRING" or "BOOL"
				defaultValue = ["O_Soldier_F","O_Soldier_AR_F"];
			};
		};
		
		class ModuleDescription: ModuleDescription
		{
			description = "J.Shock Garrison Module";
			sync[] = {};
			
			position = 1; // Position is taken into effect
			direction = 0; // Direction is taken into effect
		};
	};
};

class CfgFunctions
{
	class JSHK
	{
		tag = "JSHK";
		class Garrison
		{
			file = "JSHK_garrison";
			class garrison {};
			class buildingPositions {};
		};
	};
};

Share this post


Link to post
Share on other sites

Nice, got it fixed you're a hero, shame that the BIKI doesn't explain that  :( .

Share this post


Link to post
Share on other sites

Nice, got it fixed you're a hero, shame that the BIKI doesn't explain that  :( .

 

Probably doesn't specifically reference that because it's not about module framework, that's a function framework issue.

Share this post


Link to post
Share on other sites

Ok, I got that issue fixed now but currently I'm getting a error in the log files.

 

 

15:57:01 Error in expression <_fnc_moduleInit_modules",[]]);

_modules set [_modules find _logic,-1];
_logicMai>
15:57:01   Error position: <set [_modules find _logic,-1];
_logicMai>
15:57:01   Error Zero divisor
15:57:01 File A3\functions_f\Modules\fn_moduleExecute.sqf, line 50

 

The function works but I'm just making sure I'm not making any bigger error's with this.

Share this post


Link to post
Share on other sites

Ok, I got that issue fixed now but currently I'm getting a error in the log files.

 

 

The function works but I'm just making sure I'm not making any bigger error's with this.

I had this same problem with my module. I took a look at A3\functions_f\Modules\fn_moduleExecute.sqf, And that part of the script is activated by setting

isDisposable = 1;

I set it to 0 and it worked without an error.

  • Like 1

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

×