Jump to content

Recommended Posts

Hey, does anyone know any good examples or very clear tutorials on how macros work?

 

I want to be able to call a Cfg group file, and have it automatically dissect the units and plug em into the addRespawnInventory function.

That way, when i want to give people load outs on multiplayer, all i have to do is plug in the group files, and they will automatically take the vehicle names from the units in the groups, and plug and chug them into the function.

Perhaps it will also have to call em out in the init file as well so that they load up.

 

Perhaps its all over my head, but i'm surprised i haven't found a forum topic on this. Im sure many people have wanted to plug in a group cfg so that they didn't have to tediously insert each vehicle class one by one. Maybe i'm just bad at searching the forums.

Share this post


Link to post
Share on other sites
6 minutes ago, hank kelley said:

Hey, does anyone know any good examples or very clear tutorials on how macros work?

 

Good reading @ community Wiki and BISim Wiki

Share this post


Link to post
Share on other sites

Yeah, Id say.... but they have an external link that explains a lot better than the wiki that uses examples, but unfortunately i still don't know how to make sense of most of it. I was wondering if anyone has done anything similar to what i want to do, and had a working example?

Share this post


Link to post
Share on other sites

Here are some macros I'm using for a config for a near future release of mine:

 

#define UNIFORM_MODEL "\JSHK_contam_suits\uniforms\models\jshk_contam_nbc_suit.p3d"
#define UNIFORM_CONTAINER_CLASS "Supply10"
#define UNIFORM_MASS 80
#define UNIFORM_PICTURE "\JSHK_contam_suits\uniforms\data\jshk_contam_suit_invIcon.paa"

#define UNIFORM_DISPLAY_NAME(CAMO) *JSHK* NBC Suit (##CAMO##)
#define Q_UNI_DN(CAMO) QUOTE(UNIFORM_DISPLAY_NAME(CAMO))

#define UNIFORM_CLASS(NAME) JSHK_contam_soldier_##NAME
#define Q_UNI_UC(NAME) QUOTE(UNIFORM_CLASS(NAME))

#define UNIFORM_TEXTURE(CAMO) \JSHK_contam_suits\uniforms\data\jshk_contam_nbc_suit_##CAMO##_co.paa
#define Q_UNI_UT(CAMO) QUOTE(UNIFORM_TEXTURE(CAMO))

#define NEW_UNIFORM(CAMO,NAME) \
	class JSHK_contam_suit_##CAMO##: JSHK_contam_suit_mtp \
	{ \
		scope = 2; \
		scopeCurator = 2; \
		displayName = Q_UNI_DN(NAME); \
		hiddenSelectionsTextures[] = { Q_UNI_UT(CAMO) }; \
		class ItemInfo: UniformItem	\
		{ \
			uniformClass = Q_UNI_UC(CAMO); \
			containerClass = UNIFORM_CONTAINER_CLASS; \
            mass = UNIFORM_MASS; \
		}; \
	};

class UniformItem;
class Uniform_Base;
class JSHK_contam_suit_mtp: Uniform_Base
{
	author = AUTHOR;
	scope = 2;
	scopeCurator = 2;
	displayName = Q_UNI_DN(MTP);
	picture = UNIFORM_PICTURE;
	model = UNIFORM_MODEL;
	hiddenSelections[] = {"camo"};
	hiddenSelectionsTextures[] = { Q_UNI_UT(mtp) };
	class ItemInfo: UniformItem
	{
		uniformClass = Q_UNI_UC(mtp);
		containerClass = UNIFORM_CONTAINER_CLASS;
		mass = UNIFORM_MASS;
	};
};

NEW_UNIFORM(m81,M81);
NEW_UNIFORM(mc,MC);
//etc...


Basically allows me to add a whole new uniform with a new texture without having to write out another class. I follow some naming conventions with my texture files to accomplish this as well.

Share this post


Link to post
Share on other sites

You either don't really understand what macros are, using incorrect terminology or trying to solve your problem using wrong tools. In either way, read up more so you can formulate what is that you want more clearly

Share this post


Link to post
Share on other sites
11 hours ago, killzone_kid said:

You either don't really understand what macros are, using incorrect terminology or trying to solve your problem using wrong tools. In either way, read up more so you can formulate what is that you want more clearly

 

You are right, wrong terminology. Do i create another thread? All i need is way to create an array with the vehicle = "unit name" in the group config files. 

 

 

this is what i have set up so far 

loadouts = ["LIB_US_rifleman","LIB_US_medic","LIB_US_AT_soldier"];

and then ill do a foreach magic variable to create classes for the respawn inventory function.

 

So yeah id like to beable to just give em a cfgGroup path.

 

Also working on this, then ill try and plug it into loadouts. 

// V does return all the units.
configs = "true" configClasses (configfile >> "CfgGroups" >> "Indep" >> "LIB_US_ARMY" >> "Infantry" >> "LIB_US_infantry_squad"); 

// V doesn't work, but i want it to find the vehicle class.
{ vehicleNames = configProperties [ x >> "vehicle","true",true];} foreach configs;

 

Share this post


Link to post
Share on other sites
configs = "true" configClasses (configfile >> "CfgGroups" >> "Indep" >> "LIB_US_ARMY" >> "Infantry" >> "LIB_US_infantry_squad"); 
loadouts = [];
{loadouts pushBack getText (_x >> 'vehicle')} forEach configs;

Using the code above, your variable "loadouts" becomes an array of vehicle classes from config entry defined in "configs"

I hope this helps

  • Like 1

Share this post


Link to post
Share on other sites

 

 

Awesome! It helped a lot! So i found a function that looks promising, is there anyway to trap its return into a variable? 

[(configfile >> "CfgGroups" >> "Indep" >> "LIB_US_ARMY" >> "Infantry"),1, true, false] call BIS_fnc_returnChildren;

You saved me from having to do individual groups, this would add a whole faction into the spawn menu if i could get it to work.

Share this post


Link to post
Share on other sites
50 minutes ago, hank kelley said:

would add a whole faction into the spawn menu if i could get it to work.

 

Try this to extract class names of the whole faction

configs = [
	(configFile >> "CfgGroups" >> "Indep" >> "LIB_US_ARMY" >> "Infantry"),
	1,
	false
] call BIS_fnc_returnChildren select {inheritsFrom _x isEqualTo (configFile >> "Man")};

loadouts = [];
{loadouts pushBack getText (_x >> 'vehicle')} forEach configs;

 

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, Nikander said:

 

Try this to extract class names of the whole faction


configs = [
	(configFile >> "CfgGroups" >> "Indep" >> "LIB_US_ARMY" >> "Infantry"),
	1,
	false
] call BIS_fnc_returnChildren select {inheritsFrom _x isEqualTo (configFile >> "Man")};

loadouts = [];
{loadouts pushBack getText (_x >> 'vehicle')} forEach configs;

 

 

Yup, worked perfectly! Thanks for your help.

  • 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

×