Jump to content
Sign in to follow this  
Michael LeMay

Custom module function not working.

Recommended Posts

I'm trying to create a custom module, but when I place it nothing happens. I also don't know what I'm supposed to put for curatorInfoType, here's my config.cpp:

class CfgPatches
{
	class NAK_Modules
	{
		units[] = {"NAK_spawnUnit"};
		requiredVersion = 1.0;
		requiredAddons[] = {"A3_UI_F","A3_UI_F_Curator","A3_Functions_F","A3_Functions_F_Curator","A3_Modules_F","A3_Modules_F_Curator","A3_Modules_F_Bootcamp_Misc"};
		weapons[] = {};
	};
};
class CfgFactionClasses
{
	class NO_CATEGORY;
	class NAK: NO_CATEGORY
	{
		displayName = "NAK";
	};
};
class CfgVehicles
{
	class Logic;
	class Module_F: Logic
	{
		class AttributesBase
		{
			class Default;
			class Edit;					// Default edit box (i.e., text input field)
			class Combo;				// Default combo box (i.e., drop-down menu)
			class Checkbox;				// Default checkbox (returned value is Boolean)
			class CheckboxNumber;		// Default checkbox (returned value is Number)
			class ModuleDescription;	// Module description
			class Units;				// Selection of units on which the module is applied
		};
		// Description base classes, for more information see below
		class ModuleDescription
		{
			class AnyPlayer;
			class AnyBrain;
			class EmptyDetector;
		};
	};
	class NAK_spawnUnit: Module_F
	{
		// Standard object definitions
		scope = 2; // Editor visibility; 2 will show it in the menu, 1 will hide it.
		scopeCurator = 2;
		displayName = "Spawn Unit"; // Name displayed in the menu
		category = "NAK";
		icon = "NAK_spawnUnit\media\naksquad.paa";
		vehicleClass = "Modules";
		side = 7;

		// Name of function triggered once conditions are met
		function = "NAK_fnc_spawnUnit";
		// 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 global execution, 2 for persistent global execution
		isGlobal = 1;
		// 1 for module waiting until all synced triggers are activated
		isTriggerActivated = 1;
		// 1 if modules is to be disabled once it is activated (i.e., repeated trigger activation won't work)
		isDisposable = 0;
		// 1 to run init function in Eden Editor as well
		is3DEN = 0;

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

		// Module attributes, uses https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes#Entity_Specific
		class Attributes: AttributesBase
		{
			// Arguments shared by specific module type (have to be mentioned in order to be present)
			class Units: Units
			{
				property = "NAK_spawnUnit_Units";
			};
			// Module specific arguments
			class UnitType: Edit {
				property = "NAK_spawnUnit_UnitType";
				displayName = "Unit Type";
				tooltip = "Put unit class here";
				defaultValue = "B_Soldier_F";
			};
			class ModuleDescription: ModuleDescription{}; // Module description should be shown last
		};

		// Module description. Must inherit from base class, otherwise pre-defined entities won't be available
		class ModuleDescription: ModuleDescription
		{
			description[] = 
			{ 
				"Use this module to spawn a unit."
			};							 // Short description, will be formatted as structured text
			sync[] = {}; // Array of synced entities (can contain base classes)
		};
	};
};
class CfgFunctions
{
	class NAK
	{
		class NAK
		{
			file = "\NAK_spawnUnit\functions";
			class spawnUnit{};
		};
	};
};

And here's my function:

// Argument 0 is module logic.
_logic = param [0,objNull,[objNull]];
// Argument 1 is list of affected units (affected by value selected in the 'class Units' argument))
_units = param [1,[],[[]]];
// True when the module was activated, false when it is deactivated (i.e., synced triggers are no longer active)
_activated = param [2,true,[true]];
// Module specific behavior. Function can extract arguments from logic and use them.
if (_activated) then {
	 // Attribute values are saved in module's object space under their class names
	hint "Hello";
};
hint "Hello";
// Module function is executed by spawn command, so returned value is not necessary, but it is good practice.
true

For now, I'm just trying to get it to hint Hello. Sorry if this is in the wrong forum. Here's my file structure:

NAK_Modules (folder)

@NAK_Modules (folder)

addons (folder)

NAK_spawnUnit (folder)

config.cpp (file)      functions (folder)      media (folder)

                                  fn_spawn.sqf (file)    naksquad.paa (file)

Share this post


Link to post
Share on other sites

What exactly happens and what doesn't? Does your module appear in the list of modules?

Try to config it with the parameter

isTriggerActivated = 0;

 

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
Sign in to follow this  

×