Jump to content
Vandeanson

Create custom EdenEditor Modules vs. CBA Settings for Addon

Recommended Posts

Gentlemen,

 

I finally got around to turn a script collection into a addon, ready to be uploaded to steam.

I however need to provide the user with a ingame/eden editor module interface so the user can adjust the settings of the script/addon before i can release the addon in order to make it customizable.

E.g. disable feature 1 from spawning, increasing the amount of times feature 2 spawns, define classnames for an array and so on.

 

I have unsuccessfully tried to wrap my head around this wiki:

 

https://community.bistudio.com/wiki/Modules

 

I get the example from the wiki above to work in Eden Editor, however, I get quite lost when trying to adapt this example or create a new module from scratch for my addon.

 

What do I want to do:

Let the addon user define variables in Eden Editor that will then be executed accordingly in the features of my addon according to these settings.

I want to have a "module - mask" per feature that lets the user change or set variables that have so far been defined and altered in a settings.sqf. (see below spoiler)

 

Spoiler


/*
L O B B Y
Adjust your personal settings
*/

/*Section 1: General*/




//VD_Debug_Hints_Allowed = false; //for mission making - throws hint at you if something is not right - WIP, currently applicable for VD_SW_SpawnerMrkr.sqf

VD_SpawnMinDist = 700; //the closest any site will spawn to any player

VD_SpawnMaxDist = 30000;//the furhest away from a player any site will spawn

VD_UptimeFix = 2500; // fix time before a site is despawned and respawned

VD_UptimeRnd = 1000; // random time added after fix time has expired until site despawn and respawn. e.g. additional time would be between 0 and 1000 seconds.

VD_DeletionSaveZone = 900; //a site will not despawn as long as any player is XYZ meters close

/*Section 1.1: Random Player Loadouts*/
//Random Player Equipment
VD_AllowRandomPlayerLoadout = true; // randomly equips every player using VD_Player_Equipper form VD_Functions.sqf. at mission start: TRUE = activated, false = not activated
VD_AllowRandomPlayerLoadoutRespawn = true; // randomly equips every player using VD_Player_Equipper form VD_Functions.sqf. at respawn: TRUE = activated, false = not activated


VD_PLMapChance = 80;
VD_PLRadioChance = 100;
VD_PLBinocularChance = 40;

VD_PLVestChance = 80;
VD_PLBackpackChance = 40;
VD_PLHeadgearChance = 50;

VD_PLRifleChance = 10;
VD_PLRifleAmmo = 1;
VD_PLRifleAmmoAdd= 3; // as a fix amount of additional mags or a random amount up to 3; (random 3)

VD_PLRifleMuzzleChance = 20;
VD_PLRifleOpticChance = 20;
VD_PLRiflePointerChance = 20;
VD_PLRifleUnderbarrelChance = 20;

VD_PLPistolChance = 80;

VD_PLPistolAmmo = 1;
VD_PLPistolAmmoAdd = 3; // as a fix amount of additional mags or a random amount up to 3; (random 3)

VD_PLPistolMuzzleChance = 10;
VD_PLPistolOpticChance = 10;
VD_PLPistolPointerChance = 10;

VD_PLItemChance = 60;
VD_PLItemsCount = 3;

VD_PLCustomItems = [];
VD_PLCustomItemChance = 100;
VD_PLCustomItemsCount = 1; // as a fix amount to spawn or a random amount up to 3 if you enter it like this: (random 3)

VD_PLMoneyChance = 50;
VD_PLMoneyAmount = 15; // as a fix amount of money to spawn or a random amount up to 15 if you enter it like this: (random 15)

VD_PLGrenadeChance = 30;
VD_PLGrenadeAmount = 1;// as a fix amount to spawn or a random amount up to 3 if you enter it like this: (random 3)


VD_PLExplosiveChance = 5;
VD_PLExplosiveAmount = 1;//
/*Section 1.2: Black list areas (IMPORTANT)*/
//exclude areas from automated placement of sites on land (Bandit Camp, Crashsites, Hideouts, Animalspawner, feral dog spawner, horse spawner)
//Place markers area markers F6/Markers -> Areas: both shapes are ok. Cover the area on LAND where you want no Bandit Camp, Crashsites, Hideouts, Animalspawner, feral dog spawner, horse spawner to spawn and use one of the below marker names (!!)
//for maps like chernarus, where a lot of land is empty, cover that land in order to avoid that sites spawn there, see picture:
VD_Land_Blacklist_Area = [];
//... = []; empty brackets means that you want to place NO marker
//
//exclude areas from automated placement of Ship Wrecks at shores. not that even the smalles lake inland is considered a valid place for the shipwreck placement, hence you need to cover that area with below blacklist markers!
//Place markers area markers F6/Markers -> Areas: both shapes are ok. Cover the area on LAND where you want no Bandit Camp, Crashsites, Hideouts to spawn and use one of the below marker names (!!)
VD_Coast_Blacklist_Area = [];
//... = []; empty brackets means that you want to place NO marker
//
// DO NOT FORGET TO TURN DOWN THE MARKERS "ALPHA" TO 0% - else the markers are visible on the map. Also you best place these markers LAST when making a mission, else they might disturb you when navigating on a map.
//IF YOU PLACE LESS MARKERS THEN THE 10 ABOVE, that is a PROBLEM since last patch - only list markers here that are also placed on the map!!!!. If you place more than the  markers listed here, or name them wrong - the sites will spawn in the unwanted areas anyway!
// leave empty, if you need no blacklist areas

/*Section 1.3: AI*/


VD_AIMapChance = 10;
VD_AIRadioChance = 20;
VD_AIBinocularChance = 5;

VD_AIVestChance = 100;
VD_AIBackpackChance = 100;
VD_AIHeadgearChance = 100;

VD_AIRifleChance = 20;
VD_AIRifleAmmo = 1;
VD_AIRifleAmmoAdd= 3; // as a fix amount of additional mags or a random amount up to 3; (random 3)

VD_AIRifleMuzzleChance = 5;
VD_AIRifleOpticChance = 5;
VD_AIRiflePointerChance = 5;
VD_AIRifleUnderbarrelChance = 5;

VD_AIPistolChance = 100;

VD_AIPistolAmmo = 1;
VD_AIPistolAmmoAdd = 3; // as a fix amount of additional mags or a random amount up to 3; (random 3)

VD_AIPistolMuzzleChance = 5;
VD_AIPistolOpticChance = 5;
VD_AIPistolPointerChance = 5;

VD_AIItemChance = 50;
VD_AIItemsCount = 3;

VD_AICustomItems = [];
VD_AICustomItemChance = 100;
VD_AICustomItemsCount = 1; // as a fix amount to spawn or a random amount up to 3 if you enter it like this: (random 3)

VD_AIMoneyChance = 50;
VD_AIMoneyAmount = 15; // as a fix amount of money to spawn or a random amount up to 15 if you enter it like this: (random 15)

VD_AIGrenadeChance = 50;
VD_AIGrenadeAmount = 1;// as a fix amount to spawn or a random amount up to 3 if you enter it like this: (random 3)


VD_AIExplosiveChance = 50;
VD_AIExplosiveAmount = 1;// as a fix amount to spawn or a random amount up to 3 if you enter it like this: (random 3)



/*Section 2: Site specific settings*/



/*Section 2.1: Hideouts*/

VD_HO_AmountOfSpawns = 8; //amount of sites to spawn, set to 0 to disable
VD_HO_Spawn_Array = ["VD_HO_Spawn_1", "VD_HO_Spawn_2", "VD_HO_Spawn_3", "VD_HO_Spawn_4", "VD_HO_Spawn_5", "VD_HO_Spawn_6", "VD_HO_Spawn_7", "VD_HO_Spawn_8", "VD_HO_Spawn_9","VD_HO_Spawn_10","VD_HO_Spawn_11","VD_HO_Spawn_12","VD_HO_Spawn_13","VD_HO_Spawn_14","VD_HO_Spawn_15","VD_HO_Spawn_16","VD_HO_Spawn_17","VD_HO_Spawn_18","VD_HO_Spawn_19","VD_HO_Spawn_20"];
VD_HO_DistanceCheck = 700;
VD_JBDOG_PatrolDogChanceHO = 0;
VD_JBDOG_GuardDogChanceHO = 40;
VD_IEDAmountHO = 3;
VD_IEDChanceHO = 50;
/*Section 2.2: Crashsites*/

VD_CS_AmountOfSpawns = 8; //amount of sites to spawn, set to 0 to disable
VD_CS_spawnDistToOtherCS = 1000; // set mimimum distance in meters required between sites

VD_CS_Spawn_Array = ["VD_CS_Spawn_1", "VD_CS_Spawn_2", "VD_CS_Spawn_3", "VD_CS_Spawn_4", "VD_CS_Spawn_5", "VD_CS_Spawn_6", "VD_CS_Spawn_7", "VD_CS_Spawn_8", "VD_CS_Spawn_9","VD_CS_Spawn_10","VD_CS_Spawn_11","VD_CS_Spawn_12","VD_CS_Spawn_13","VD_CS_Spawn_14","VD_CS_Spawn_15","VD_CS_Spawn_16","VD_CS_Spawn_17","VD_CS_Spawn_18","VD_CS_Spawn_19","VD_CS_Spawn_20"];


/*Section 2.3: Basebuilding EDN Fortification*/
//removed, to be preplaced

/* Section2.4: Bandit Camp:*/

VD_BC_MrkrArray = ["VD_BC_Mrkr_1","VD_BC_Mrkr_2","VD_BC_Mrkr_3","VD_BC_Mrkr_4","VD_BC_Mrkr_5","VD_BC_Mrkr_6","VD_BC_Mrkr_7","VD_BC_Mrkr_8","VD_BC_Mrkr_9","VD_BC_Mrkr_10","VD_BC_Mrkr_11"];
VD_BC_CampSpawnAmountRnd = 8; //amount of sites to spawn at random positions (no markers), set to 0 to disable
VD_BC_CampSpawnAmountMrkr = 0; //amount of sites to spawn at preplaced markers, set to 0 to disable
VD_BC_DistanceCheck = 800;
VD_IEDAmountBC = 5;
VD_IEDChanceBC = 50;
VD_JBDOG_PatrolDogChanceBC = 40;
VD_JBDOG_GuardDogChanceBC = 20;

/*Section2.5: Ship Wrecks*/

/*note that SW spawn even in the smallest puddle, not only on the coast where it makes sense, depending on your map, you might want to use markers only instead*/

/*place ALL markers below at the coast of your map, add more markers in this array (following the format) if you want to spawn more wrecks - amount of markers should always be double of spawned wrecks! The script finds suitable places near the marker, hence marker placement must not be 100% exact*/

VD_SW_MrkrArray = ["VD_SW_Mrkr_1","VD_SW_Mrkr_2","VD_SW_Mrkr_3","VD_SW_Mrkr_4","VD_SW_Mrkr_5","VD_SW_Mrkr_6","VD_SW_Mrkr_7","VD_SW_Mrkr_8","VD_SW_Mrkr_9","VD_SW_Mrkr_10","VD_SW_Mrkr_11","VD_SW_Mrkr_12","VD_SW_Mrkr_13","VD_SW_Mrkr_14","VD_SW_Mrkr_15","VD_SW_Mrkr_16","VD_SW_Mrkr_17","VD_SW_Mrkr_18","VD_SW_Mrkr_19","VD_SW_Mrkr_20"];

VD_SW_SpawnAmountRnd = 8;// set number: amount of Shipwrecks that should spawn randomly
VD_SW_MaxDistance = 20000; //
VD_SW_DistanceCheck = 300; //minumum distances between each wreck (if set too high, wrecks might not be able to spawn)

VD_SW_SpawnAmountMrkr = 0;// set number: amount of Shipwrecks that should spawn at placed markers - I recommend to always place double amount of markers as desired shipwrecks, to ensure changing spawnpositions at respawn. Hence, if you have more than or nearly 20 wrecks spawning, you should add additional markers to the array "VD_SW_MrkrArray" above and place the additional markers in your map

/*Section 2.6: Trader Camp*/
VD_TC_Spawn = true; //set to false if TC should spawn on a random position without marker placement, set to TRUE to spawn on markers. REQUIRES marker placement!
VD_TC_DistanceCheck = 1500; // minimum distance to any other camps, specially BC and Hideouts, required for automated TC placmenet without markers

//add or remove markers here (one marker = TC refreshes at the same place). multiple Markers will make the site change position from time to time
VD_TC_MarkerArray = ["VD_TC_Mrkr_1","VD_TC_Mrkr_2","VD_TC_Mrkr_3","VD_TC_Mrkr_4","VD_TC_Mrkr_5","VD_TC_Mrkr_6","VD_TC_Mrkr_7"];

/*Section 2.7: Huntable Animals*/

VD_AS_AmountOfSpawns = 4;

/*Section 2.8: Rideable Horses*/
/*Requirements:
Scripts: VD_DBO_Horse_Spawner.sqf
Mods: DBO_Horses on steam
*/

VD_DBO_Horses_AmountOfSpawns = 0; //amount of horses to spawn, set to 0 to disable

/*Section 2.9: Feral dog pack by JBDOG*/
VD_AllowJBDOG = false; // enable jbdog scripts
VD_JBDOG_AmountOfSpawns = 1;
VD_JBDOG_AggroDist = 300; // range from which dogs can aggro and start chasing you could also be 50+ random 300 or so

/*Section 2.20: Helicopter Spawns*/
VD_Heli_AmountOfSpawns = 3;
VD_Helicopters = ["I_Heli_light_03_unarmed_F","B_Heli_Transport_01_F","B_Heli_Attack_01_dynamicLoadout_F","B_Heli_Light_01_F","B_Heli_Light_01_dynamicLoadout_F","B_Heli_Transport_03_F"];

/*Section 2.21: Boat Spawns*/
VD_Boat_AmountOfSpawns = 6;
VD_Boats = ["I_Boat_Armed_01_minigun_F","C_Boat_Civil_01_F","C_Scooter_Transport_01_F","C_Boat_Transport_02_F","C_Boat_Civil_01_rescue_F","C_Boat_Civil_01_police_F"];



VD_Plane_AmountOfSpawns = 2;
VD_Planes = ["C_Plane_Civil_01_F"];
VD_PlaneMarkers = ["VD_PlaneMrkr_1","VD_PlaneMrkr_2","VD_PlaneMrkr_3","VD_PlaneMrkr_4","VD_PlaneMrkr_5","VD_PlaneMrkr_6","VD_PlaneMrkr_7"];

/*Section 2.22: Zombie Infection*/
VD_InfectionScript = true;
VD_Infection_Chance = 50;

/*Section 2.23: Medical sites*/
VD_Medical_AmountOfSpawns = 5;
VD_Med_Spawn_Array = ["VD_Med_Mrkr_1","VD_Med_Mrkr_2","VD_Med_Mrkr_3","VD_Med_Mrkr_4","VD_Med_Mrkr_5","VD_Med_Mrkr_6","VD_Med_Mrkr_7","VD_Med_Mrkr_8","VD_Med_Mrkr_9","VD_Med_Mrkr_10","VD_Med_Mrkr_11"];
VD_Med_Spawn_ArrayBL = [];

/*Section 2.24: JBODG Scripts*/


/*Section 3: blacklist weapons or items or equipment from the loot arrays, enter as = ["classnameofitem","lastclassname"]; MIND THE COMMA!
Or exclude defined groups of items, e.g. Vanilla items or Mod specific items*/

//Remove Vanilla Weapons:

VD_NoVanillaPistols = false; //set to true to not spawn vanilla weapons
VD_NoVanillaRifles = false; //set to true to not spawn vanilla weapons
VD_NoVanillaLaunchers = false; //set to true to not spawn vanilla weapons

VD_NoVanillaVests = false;
VD_NoVanillaBackpacks = false;
VD_NoVanillaHeadgears = false;
VD_NoVanillaGoggles = false;
VD_NoVanillaUniforms = false;

//remove Ravaged Vanilla weaponState

VD_NoRavagedRifles = false; //set to true to not spawn ravaged vanilla equipment (sorry EO...;)

VD_NoRavageVests = false;
VD_NoRavageBackpacks = false;
VD_NoRavageHeadgears = false;
VD_NoRavageGoggles = false;
VD_NoRavageUniforms = false;

//IFA3

VD_NoLIBRifles = false;
VD_NoLIBPistols = false;
VD_NoLIBLaunchers = false;

VD_NoLIBGoggles = false;
VD_NoLIBUniforms = false;
VD_NoLIBBackpacks = false;
VD_NoLIBHeadgears = false;
VD_NoLIBVests = false;

//CUP

VD_NoCUPLaunchers = false;
VD_NoCUPRifles = false;
VD_NoCUPPistols = false;

VD_NoCUPVests = false;
VD_NoCUPBackpacks = false;
VD_NoCUPHeadgears = false;
VD_NoCUPGoggles = false;
VD_NoCUPUniforms = false;


//weaponS
VD_WeaponArrayRiflesBlacklist = [];
VD_WeaponArrayPistolsBlacklist = ["hgun_Pistol_Signal_F","CHR_FlashLight","CHR_FlashLight_Night"];
VD_WeaponArrayLaunchersBlacklist = [];

//Equipment
VD_EquipmentVestsBlacklist = [];
VD_EquipmentUniformsBlacklist = [];
VD_EquipmentBackpacksBlacklist = ["Horse_bergen","Horse_bergenru","horse_tack"];
VD_EquipmentHeadgearsBlacklist = [];
VD_EquipmentGogglesBlacklist = [];

//weapon attachments
VD_EquipmentMuzzlesBlacklist = [];
VD_EquipmentOpticsBlacklist = [];
VD_EquipmentFlashlightsBlacklist = [];
VD_EquipmentBipodsBlacklist = [];

/*Section 4: manually add classnames to Arrays*/

//Weapons
VD_WeaponArrayRiflesAdditional = [];
VD_WeaponArrayPistolsAdditional = [];
VD_WeaponArrayLaunchersAdditional = [];

//Equipment
VD_EquipmentVestsAdditional = [];
VD_EquipmentUniformsAdditional = [];
VD_EquipmentBackpacksAdditional = [];
VD_EquipmentHeadgearsAdditional = [];
VD_EquipmentGogglesAdditional = [];
//weapon attachments
VD_EquipmentMuzzlesAdditional = [];
VD_EquipmentOpticsAdditional = [];
VD_EquipmentFlashlightsAdditional = [];
VD_EquipmentBipodsAdditional = [];

/*Section 5: overwrite Arrays*/

//Weapons
VD_WeaponArrayRiflesReplace = [];
VD_WeaponArrayPistolsReplace = [];
VD_WeaponArrayLaunchersReplace = [];

//Equipment
VD_EquipmentVestsReplace = [];
VD_EquipmentUniformsReplace = [];
VD_EquipmentBackpacksReplace = [];
VD_EquipmentHeadgearsReplace = [];
VD_EquipmentGogglesReplace = [];
//weapon attachments
VD_EquipmentMuzzlesReplace = [];
VD_EquipmentOpticsReplace = [];
VD_EquipmentFlashlightsReplace = [];
VD_EquipmentBipodsReplace = [];

		VD_Settings_Rdy = true;


/*Dynamic Simulation: FPS saver, AI units will only become active if player is XYZ meters close or within view distance (scoped and non scoped)*/
enableDynamicSimulationSystem true; // dont change, FPS saver
DynSimDistManual = false; // set true if you want to define the distance from AI to player for dynamic simulation enabling yourself below
                          // set false if you want AI to become active in view distance, considers if you are looking through a scope and if there is fog)
DynSimDistManualRange = 2000; // if DynSimDistManual = true, this number is the distance to the player where the AI becomes active (in meters)

 

 

As an example for the feature that spawns Banditcamps:

 

the below variables need to pass on as true, false or representing a number, so once a feature is executed, it can access these variables with the desired values.

 

Spoiler

VD_SpawnMinDist = 700; //the closest any site will spawn to any player
VD_SpawnMaxDist = 30000;//the furhest away from a player any site will spawn
VD_UptimeFix = 2500; // fix time before a site is despawned and respawned
VD_UptimeRnd = 1000; // random time added after fix time has expired until site despawn and respawn. e.g. additional time would be between 0 and 1000 seconds.
VD_DeletionSaveZone = 900; //a site will not despawn as long as any player is XYZ meters close
VD_BC_CampSpawnAmountRnd = 8; //amount of sites to spawn at random positions (no markers), set to 0 to disable
VD_BC_DistanceCheck = 800;
VD_IEDAmountBC = 5;
VD_IEDChanceBC = 50;
VD_JBDOG_PatrolDogChanceBC = 40;
VD_JBDOG_GuardDogChanceBC = 20;

 

 

Ideally i am looking for a template with a few options to enter a number, and a few options for true/false and one or two to enter a string (classnames, or marker names for arrays).

Any help, insights or link to alternative guides is greatly appreciated!=)

 

cheers

Vd

  • Like 1

Share this post


Link to post
Share on other sites

It's  a lot of settings. If you're not opposed to having cba as a dependency for your mod maybe you'd be better of using cba settings. As for modules use the 3den attributes to add fields and options 

  • Like 1

Share this post


Link to post
Share on other sites

@Mr H.

 

Good opportunity to thank you, one of your forum posts along with some guidance from george floros helped me greatly to turn my script package into a steam addon yesterday morning;)

 

Thanks for the hint regarding CBA - i am not familiar with it and will dig into it.

It is indeed a lot of settings, but I intend to have one module per feature, that would hold 3-5 settings/attributes, similar like the ones in the ravage mod. But then again - i might not see the full implications of such a thing yet=)

 

will post any progress i may make with modules or CBA here.

 

cheers

vd

  • Like 2

Share this post


Link to post
Share on other sites

here's the guide for cba settings:
https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System
 

A few extra info on that:
1) If you want the settings to show up from the editor and onward you need to have "cba_main" in your required addon in the cfg patches
It will look something like that:

class CfgPatches {
	class MRHMilsimTools{
		units[] = {}; //
		weapons[] = {}; //
		requiredVersion = 0.1; //
		requiredAddons[] = {"cba_main"};
		version = 1.16.5;
		versionStr = "1.16.5";
		versionAr[] = {1,16,5};
		versionDesc = "MRH Milsim Tools";
		versionAct = "call compile preProcessFileLineNumbers '\MRHMilSimTools\about.sqf'";
		author = "Mr H.";
		url = "https://mrhmilsimtools-arma3-mod.wikia.com/wiki/MRHMilsimTools_ARMA3_Mod_Wiki";
	};
		
		
};

2) You need to call the function containing the settings from a preprocessed file so call it like this from your config.cpp

class Extended_PreInit_EventHandlers
{
   class MRHMilsimTools_CBA_Settings
   {
      init = "call compile preProcessFileLineNumbers '\MRHMilSimTools\Functions\SettingsPreInit\CBASettings.sqf'";
   }; 
   class MRHMilsimTools_CBA_Settings_keybinds
   {
      init = "call compile preProcessFileLineNumbers '\MRHMilSimTools\Functions\SettingsPreInit\CBAKeys.sqf'";
   };    
	   
};

3) You will then need to write a function that parses all these settings to make them the variables you neet, this is very easy to do.

////////////////////If you go the modules way:
 

    class Logic;
    class Module_F: Logic { class ArgumentsBaseUnits { class Units; }; class ModuleDescription { class AnyBrain; }; };

    class MRH_SAT_POSANDSPEEDINIT_MODULE: Module_F {
        scope = 2;
        displayName = $STR_MRH_MODULESATPARAMSDISPLAYNAME;
        author = "Mr. H";
        category = "Satellite";

        function = "MRH_fnc_InitFromModule";//aremplir
        functionPriority = 1;
        isGlobal = 2;
        isTriggerActivated = 0;

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

        // Module arguments
        class Arguments {


            class SatSpeed {
                displayName = $STR_MRH_SATSPEEDDISPLAYNAME;
                description = $STR_MRH_SATSPEEDSETTINGDESCRIPTION;
				//tooltip = "Vitesse de déplacement du satellite en km/h(défaut 100kmh)";
                defaultValue = "100";
            };

        };

        class ModuleDescription: ModuleDescription {
            description = $STR_MRH_MODULEDESCRIPTION;
			sync[] = {"LocationArea_F"}; 
						class LocationArea_F
			{
				description[] = { // Multi-line descriptions are supported
					"First line",
					"Second line"
				};
				position = 1; // Position is taken into effect
				direction = 0; // Direction is taken into effect
				optional = 1; // Synced entity is optional
				duplicate = 0; // Multiple entities of this type can be synced
				synced[] = {"AnyBrain"}; // Pre-define entities like "AnyBrain" can be used. See the list below
			};
            
        };
    };

this worked in my satellite mode, it added a line to set up the satellite's speed in the modules attributes. However this was a while ago, if I where to do it now I would use a class attributes something like that:

class Attributes // Entity attributes have no categories, they are all defined directly in class Attributes
		{
			 class UseDefaultAceActions
                {
                    //--- Mandatory properties
                    displayName = $STR_MRH_MRHMiscItems_scannerUseAceACAttr; // Name assigned to UI control class Title
                    tooltip = $STR_MRH_MRHMiscItems_scannerUseAceACAttrToolTip; // Tooltip assigned to UI control class Title
                    property = "MRH_BS_useActions"; // Unique config property name saved in SQM
                    control = "CHECkBOX"; // UI control base class displayed in Edit Attributes window, points to Cfg3DEN >> Attributes
                    expression = "_this setVariable ['MRH_BS_UseCustomActions',_value]";
                    defaultValue = "false";
                    unique = 0; // When 1, only one entity of the type can have the value in the mission (used for example for variable names or player control)
                    validate = "none"; // Validate the value before saving. Can be "none", "expression", "condition", "number" or "variable"
                    condition = "object"; // Condition for attribute to appear (see the table below)
                    typeName = "BOOL"; // Defines data type of saved value, can be STRING, NUMBER or BOOL. Used only when control is "Combo", "Edit" or their variants
                };

more documentation on that: https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Attributes



 

  • Thanks 2

Share this post


Link to post
Share on other sites

Again: cba settings is much easier and has many other advantages over modules for the record when ACE3 switched from modules to cba for all their settings I went on their github and complained, after extensive use I now realize that I was a fool and they were right ;-)

  • Thanks 2

Share this post


Link to post
Share on other sites

@Mr H.

 

Thanks for the explanations - I d say I will then benefit from your experience and put my time into CBA;)

 

Much appreciated!

 

cheers

vd

Share this post


Link to post
Share on other sites

Hi @Mr H. 

 

I am pretty sure along with your examples plus the information in the wiki, I have all the pieces to get what I want to do.

Maybe I lack knowledge about some of the basics about how config.cpp works, hence i am still struggling to put the pieces together=D

 

I have the following code in config.cpp:

Spoiler

class CfgPatches {
    class VD_Apocalypse {
        class VDA {
        requiredAddons[] = {"cba_main"};
        author[] = {"Vandeanson"};
        authorUrl="https://forums.bohemia.net/profile/1147633-vandeanson/";
    };
};
};

class CfgFunctions {
        class VD_Apocalypse {
        class VDA {
            class Init {
                file = "\VDA\init.sqf";
                postInit = 1;
            };
        };
};
};

class Extended_PreInit_EventHandlers{
    class VD_Apocalypse {
        class VDA {
      CommyMission = "call compile preProcessFileLineNumbers '\VDA\CBASettings.sqf'";};
};
};
 

 

My main addon initializes properly at mission start. (init.sqf)

But the example script from the CBA wiki seems not to work. I am pretty sure that I have the structure under class Extended_Preinit_EventHandlers wrongfully adapted to my addon.

"CommyMission = " is taken from the CBA wiki - should this represent something relative to my addon or can this be any description?

 

The CBASettings.sqf; contains following code from the CBA wiki example:

 

Spoiler

[
    "Commy_ViewDistance", // Internal setting name, should always contain a tag! This will be the global variable which takes the value of the setting.
    "SLIDER", // setting type
    "View Distance", // Pretty name shown inside the ingame settings menu. Can be stringtable entry.
    "My Mission Settings", // Pretty name of the category where the setting can be found. Can be stringtable entry.
    [200, 15000, 5000, 0], // data for this setting: [min, max, default, number of shown trailing decimals]
    nil, // "_isGlobal" flag. Set this to true to always have this setting synchronized between all clients in multiplayer
    {
        params ["_value"];
        setViewDistance _value;
    } // function that will be executed once on mission start and every time the setting is changed.
] call CBA_Settings_fnc_init;

 

 

from the BI wiki entry for CfgPatches, i thought i had the parents and sub folders structure/classes right (i tested quite a couple different variations)- but since it is not working, i guess not =D

 

my addon folder structure is as following:

under VD_Apocalypse:

Addons (folder)

meta.cpp

mod.cpp

key (empty folder)

xyz.jpg (just logos)

 

under Addons:

VDA.pbo

 

any .sqf mentioned in the code above is part of the pbo - no further subfolders yet.

Not sure if that gives you enough information - but if you can spot where i am going wrong, some advise is greatly appreciated.

 

Thank you and BR

VD

 

Edit: ah sh*t, that code in the spoiler must be terrible to read, sorry for that!

Edited by Vandeanson

Share this post


Link to post
Share on other sites
8 hours ago, Vandeanson said:

Edit: ah sh*t, that code in the spoiler must be terrible to read, sorry for that!

Yeah it is ;-) I think your issue is in the way you define the preinit eh

Try this:

class Extended_PreInit_EventHandlers
{
   class VD_Apocalypse
   {
      init = "call compile preProcessFileLineNumbers '\VDA\CBASettings.sqf'";
   }; 
       
	   
};

Also you can have a look here,

https://github.com/MisterHLunaticwraith/MRHMilsimTools/tree/master/Addons/MRHMilsimTools

it's the github rep for my mod,reverse engineering is the way to go! (that's what I did at first, I spent a lot of time browsing ace 3's github to see how they did it, and I still do)

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@Mr H.

that fixed it;) thanks!

Sliders are working well. I am now trying to figure out how to set and change arrays.

 

Im trying this with the EDITBOX, the user should enter classnames that are stored in VD_Helicopters.

 

my script (_heli = selectrandom VD_Helicopters createvehicles....)  will then spawn a heli.

 

I used your EDITBOX scripts, but i get an error when trying to use selectrandom VD_Helicopters.

hint str VD_Helicopters returns "I_Heli_light_03_unarmed_F,B_Heli_Transport_01_F" - for an array i think it should return ["I_Heli_light_03_unarmed_F,B_Heli_Transport_01_F"].

 

Spoiler

            [
                "VD_Helicopters",     // Unique setting name. Matches resulting variable name <STRING>
                "EDITBOX", // Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING>
                "Helicopters (['classname1', 'classname2'])",       // Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
                "VDA Helicopter Sites Settings",    // Category for the settings menu + optional sub//category <STRING, ARRAY>
                "I_Heli_light_03_unarmed_F,B_Heli_Transport_01_F",
                true/*
                ,    // 1: all clients share the same setting, 2: setting can't be overwritten (optional, default: 0) <ARRAY>
                {
                  params ["_value"];
                  VD_Helicopters = _value;
                  }      // Script to execute when setting is changed. (optional) <CODE>*/
            ] call CBA_Settings_fnc_init;

 

 

I am actually not sure, what else the above code should return, other than an array. but since my script suddenly fails now - something must be off =D

 

Any help would be appreciated=)

 

cheers vd

 

Share this post


Link to post
Share on other sites

Yes i did the same for the helis but edit boxes return STRINGS so you have to convert them to arrays

it's fairly simple:
 

TAG_convert_strings {
params ["_string"];

_resultingArray = _string splitString ",";
_resultingArray
};

["heli1,heli2,heli3"] call TAG_convert_strings;
//Result: ["heli1","heli2","heli3"]

note that in the editbox classnames should be written separated by comas but without quotes

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@Mr H.

 

thanks a thousand!

 

I have tried to insert it right into the _script of the CBA Settings fnc init params - I assumed it needs to take the "string" VD_Helicopters and turn it into an Array right away, but i get a generic error.

Where did you put your code in your script?

Spoiler

            [
                "VD_Helicopters",     // Unique setting name. Matches resulting variable name <STRING>
                "EDITBOX", // Type of setting. Can be "CHECKBOX", "EDITBOX", "LIST", "SLIDER" or "COLOR" <STRING>
                "Helicopters (['classname1', 'classname2'])",       // Display name or display name + tooltip (optional, default: same as setting name) <STRING, ARRAY>
                "VDA Helicopter Sites Settings",    // Category for the settings menu + optional sub//category <STRING, ARRAY>
                "I_Heli_light_03_unarmed_F,B_Heli_Transport_01_F",
                true,    // 1: all clients share the same setting, 2: setting can't be overwritten (optional, default: 0) <ARRAY>
                {
                  params ["_value"];


                  TAG_convert_strings {
                  params ["_string"];

                  _resultingArray = _string splitString ",";
                  _resultingArray
                  };

                  VD_Helicopters = _value call TAG_convert_strings;


                  }      // Script to execute when setting is changed. (optional) <CODE>*/
            ] call CBA_Settings_fnc_init;

 

 

Again, thanks for your time - getting this to work has been a quite exciting milestone for me so far!

 

cheers

vd

 

EDIT:

 

Well this is odd - the first line below - when used in the debug console - i get no error and i get the desired array.

...

VD_Helicopters = VD_Helicopters splitString ",";

_Helicopter = selectrandom VD_Helicopters createVehicle _SiteSpawn;

...

 

If I put the same line into the .sqf that spawns the helis  - I get an error message, that the line VD_Helicopters = VD_Helicopters splitString ","; expected a string, but got an array, which i understand, but funny enough it will still turn VD_Helicopters into an array, despite the error message.

 

EDIT 2:

 

got it;)

 

Spoiler

            [
                "VD_Helicopters",    
                "EDITBOX", 
                "Helicopters (['classname1', 'classname2'])",   
                "VDA Helicopter Sites Settings",   
                "I_Heli_light_03_unarmed_F,B_Heli_Transport_01_F",
                true,  
                {
                  VD_Helicopters = VD_Helicopters splitString ",";

                  }      
            ] call CBA_Settings_fnc_init;

 

 

I am sooo happy right now - thanks for helping me figuring this out!

 

I absolutely agree with your earlier statement - CBA Settings are pretty damn nice - and once the initial hurdles are overcome - it is super easy to set up categories with multiple settings!

 

cheers

vd

Edited by Vandeanson
  • Like 1

Share this post


Link to post
Share on other sites
45 minutes ago, Vandeanson said:

I absolutely agree with your earlier statement - CBA Settings are pretty damn nice - and once the initial hurdles are overcome - it is super easy to set up categories with multiple settings!


And there's many more stuff cba does that people don't know about. Since something like 50 % of mods require it there's a good chance that almost all players who use a modded version of arma have it and if they don't it's a very small download.

 

45 minutes ago, Vandeanson said:

I am sooo happy right now - thanks for helping me figuring this out!

No worries! When you publish your mod please share the link here so I can try it!

 

  • Like 2

Share this post


Link to post
Share on other sites
12 hours ago, Mr H. said:

No worries! When you publish your mod please share the link here so I can try it!

 

will do!:slayer:

  • Haha 1

Share this post


Link to post
Share on other sites

good evening @Mr H.

 

The issues keeping me from releasing the mod get fewer and fewer=)

In the script version of my project, I had the following in my mission folder:

 

initplayerlocal.sqf

Spoiler

params["_player","_isJIP"];

//___________Infection script
_player setVariable ["VanD_CurePill", 0];
0 = [_player] execVM "\VDA\VD_Script_Pack\VD_Infection\VanD_AddAction_Cure.sqf";

_player addEventHandler ["Dammaged",
{
	params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"];
if (VD_Infection_Chance >= random 100 && _shooter isKindOf VD_InfectionInstigator && {!(_unit getVariable ["VanD_infected", false])}) then
	{
		[_unit, _thisEventHandler] execVM "\VDA\VD_Script_Pack\VD_Infection\VanD_Infection.sqf";
		[_unit, _thisEventHandler] execVM "\VDA\VD_Script_Pack\VD_Infection\VanD_Shaking.sqf";
	};
}];

_player addEventHandler ["Respawn",
{
	params ["_unit"];
	_player = _unit;
	_player setVariable ["VanD_infected", false, false];
	0 = [_player] execVM "\VDA\VD_Script_Pack\VD_Infection\VanD_AddAction_Cure.sqf";

	_unit addEventHandler ["Dammaged",
	{
		params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"];
	if (VD_Infection_Chance >= random 100 &&_shooter isKindOf VD_InfectionInstigator && {!(_unit getVariable ["VanD_infected", false])}) then
		{
			[_unit, _thisEventHandler] execVM "\VDA\VD_Script_Pack\VD_Infection\VanD_Infection.sqf";
					[_unit, _thisEventHandler] execVM "\VDA\VD_Script_Pack\VD_Infection\VanD_Shaking.sqf";
		};
	}];

}];

_player addEventHandler ["Fired", {_this spawn MEL_FNC_WE}];

 

 

and onplayerrespawn.sqf

Spoiler

player setVariable ["VanD_CurePill", 0];

_Rnd_Respawn = [getPosATL player, 150, 15000, 2, 0, 0.9, 0] call BIS_fnc_findSafePos;
player setpos _Rnd_Respawn;

if (VD_Rnd_LoadoutRespawn) then {player call VD_Player_Equipper};
player addEventHandler ["Fired", {_this spawn MEL_FNC_WE}]; 

 

 

 

I would like to include this into my mod now, so users do not have to update those two files in their mission.

Is this possible? I tried to have both files in the addon folder, but it seems that they wont initialize that way.

 

Would appreciate a word of wisdom here=)

 

cheers

vd

 

EDIT: anything respawn related i can do with a Respawn EH i think. and i think i can replace initplayerlocal with a "Init" EH, just not sure how to add a init EH to config:)

Edited by Vandeanson
EHs seems to be the answer:)

Share this post


Link to post
Share on other sites
8 hours ago, Vandeanson said:

anything respawn related i can do with a Respawn EH i think.

absolutely!

8 hours ago, Vandeanson said:

i think i can replace initplayerlocal with a "Init" EH, just not sure how to add a init EH to config:)

 

Fairly simple:
 

TAG_yourInitFunction

{
	postInit = 1; // this will start your func after player is loaded
};


you can also do it with CBA

https://github.com/CBATeam/CBA_A3/wiki/Extended-Event-Handlers-(new)

  • Like 1

Share this post


Link to post
Share on other sites

@Mr H.

 

thanks!

will play arround with it and see if i get it to work.

would this also consider jip players?

Share this post


Link to post
Share on other sites

 

1 hour ago, Vandeanson said:

@Mr H.

 

thanks!

will play arround with it and see if i get it to work.

would this also consider jip players?

It will init for every client that connects so yes

Share this post


Link to post
Share on other sites
 _shooter isKindOf VD_InfectionInstigator

Are you sure about that line? Doesn't make sens to me...

Share this post


Link to post
Share on other sites

it is the EH that activates the infection of my zombie infection script.

 

the variable stands for ravages zombie ai parent, to define what AI can activate the infection. else any AI that damages you, could trigger the infection

Share this post


Link to post
Share on other sites
1 hour ago, Mr H. said:

 

It will init for every client that connects so yes

perfect, that will make things easier:)

Share this post


Link to post
Share on other sites

Didn't know isKindOf accepted anything but a class string is that what your variable points to?

Share this post


Link to post
Share on other sites

yes, in this case it leads to "zombie" and as of yesterday the test was fine. but to be safe i will doublecheck if hits by other AI is indeed not triggering the script, good point.

Share this post


Link to post
Share on other sites

@Mr H.

 

got it all working now, thanks for your help!

gotta do a last testing phase and then i ll release the mod;)

  • Like 4

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

×