Jump to content
Mickyleitor

Is the "+=" an accepted code in Arma 3?

Recommended Posts

Hi guys,

I'm trying get to work a custom grenade but I've to change the code base of the Arma 3 and I'm not very convinced to do that as It would cause compatiblity issues.

I've add another muzzle parameter under "Throw" class to get it work for all units on Arma 3. But I don't want to redefine the whole muzzle parameter, I want ADD another muzzle paramater.

So i'm wondering if Arma 3 accept the "+=" operation as C++ language do. My custom cfgweapons config file would be like this:

class Throw: GrenadeLauncher {
muzzles[] += {"CUSTOM_GRENADE"};
       class ThrowMuzzle;
class CUSTOM_GRENADE: ThrowMuzzle
{
		magazines[] = {"CUSTOM_GRENADE_MAGAZINE"};
       };
};

I've tested with this code but It doesn't work (It throw no errors during binarize process) and I'm wondering if the problem came in "CUSTOM_GRENADE_MAGAZINE" config or in the "+=" operation.

Edited by Mickyleitor

Share this post


Link to post
Share on other sites
Hi guys,

I'm trying get to work a custom grenade but I've to change the code base of the Arma 3 and I'm not very convinced to do that as It would cause compatiblity issues.

I've add another muzzle parameter under "Throw" class to get it work for all units on Arma 3. But I don't want to redefine the whole muzzle parameter, I want ADD another muzzle paramater.

So i'm wondering if Arma 3 accept the "+=" operation as C++ language do. My custom cfgweapons config file would be like this:

class Throw: GrenadeLauncher {
muzzles[] += {"CUSTOM_GRENADE"};
       class ThrowMuzzle;
class CUSTOM_GRENADE: ThrowMuzzle
{
		magazines[] = {"CUSTOM_GRENADE_MAGAZINE"};
       };
};

I've tested with this code but It not work (It throw no errors during binarize process) and I'm wondering if the problem came in "CUSTOM_GRENADE_MAGAZINE" config or in the "+=" operation.

It does work but I don't believe it can be binarized at the moment.

Share this post


Link to post
Share on other sites
It should work, Pettka even gave example somewhere on dev branch forum using +=

I stand corrected, then :)

Share this post


Link to post
Share on other sites

Latest version pboProject had no problems converting array+= into binary code for use by the in-game engine.

similarly, in the bis tools, bis binarise, (actually, convertfilechg) was updated to do same.

others are also quite correct that the engine could only accept plain Jane text configs with this syntax until the recent past.

I have in fact, not tested the binary version fully in the engine (except a little in the dev version), so it would be a nice confirmation to have from somebody that it does in fact work!!!

Either way, you ladies need the latest steam tools, or latest Mikero dePbo.dll to get this magic to happen.

Edited by Mikero

Share this post


Link to post
Share on other sites

Doing some researches ... It unfortunately doesn't work for me.. Can someone from BI developer confirm this??

Edited by Mickyleitor

Share this post


Link to post
Share on other sites

It works just fine for me :confused2:. Are you really defining the needed "required addons"( where the original array its defined, in your example with the throw weapon something like requiredAddons[] = {"A3_Weapons_F"}; ) before doing the += ?, because if not, it's obviously not gonna work ^^

Edited by columdrum

Share this post


Link to post
Share on other sites

I was doing the exact same thing as OP this morning, when i first did the config for the Australian F1 / F3 Grenades there was talk about += in configs for arrays. But i never heard anything about it since, doing an update of most of our mod, i was messing around and think i have managed to get it to work, you can find the whole config below, be aware that i had tried this exact config with a slightly old version of pboProject and it did not work, so please update to the latest version first.

class CfgPatches {

class adfu_weapon_f1 {
	units[] = {};
	weapons[] = {};
	requiredVersion = 0.100000;
	requiredAddons[] = {"A3_Weapons_F"};
};
};

class CfgWeapons 
{
class GrenadeLauncher ;
class Throw: GrenadeLauncher 
{
	class ThrowMuzzle;

	muzzles[] += {"ADF_F1_Muzzle"};

	class ADF_F1_Muzzle: ThrowMuzzle
	{
		magazines[] = {"ADF_F1_GRENADE"};
	};
};
};


class CfgAmmo 
{
/*extern*/ class GrenadeHand;
class ADF_F1_Grenade_A: GrenadeHand {
	model = "\adfu_weapon_f1\ADF_F1_Grenade";
	soundHit1[] = {"adfu_weapon_f1\sound\f1_grenade", 5.162278, 1, 1400};
	multiSoundHit[] = {"soundHit1", 1.000000};
};
};

class CfgMagazines 
{
/*extern*/ class CA_Magazine;
class ADF_F1_GRENADE: CA_Magazine {
	mass = 6;
	scope = 2;
	value = 1;
	displayName = "ADF F1 Grenade";
	picture = "\adfu_weapon_f1\ui\gear_f1_grenade_ca.paa";
	model = "\adfu_weapon_f1\ADF_F1_Grenade_Item";
	type = 256;
	ammo = "ADF_F1_Grenade_A";
	count = 1;
	initSpeed = 22;
	nameSound = "handgrenade";
	maxLeadSpeed = 7;
	sound[] = {"", 0.000316, 1};
	descriptionShort = "Australian Fragmentation Grenade";
	displayNameShort = "F1 Grenade";
};
};

replace the parts as needed to suit your own mod, and then launch the game, you can either test it by adding a magazine of the new grenade to your player, and you should be able to throw it, or you can open the debug console: in execute, type "muzzles = getArray (configfile >> "CfgWeapons" >> "Throw" >> "muzzles");" and in a watch window type "muzzles" and click execute, you should get and array in the watch window that has your grenades at the end.

XDruA.jpg

Share this post


Link to post
Share on other sites
Latest version pboProject had no problems converting array+= into binary code for use by the in-game engine.

similarly, in the bis tools, bis binarise, (actually, convertfilechg) was updated to do same.

others are also quite correct that the engine could only accept plain Jane text configs with this syntax until the recent past.

I have in fact, not tested the binary version fully in the engine (except a little in the dev version), so it would be a nice confirmation to have from somebody that it does in fact work!!!

Either way, you ladies need the latest steam tools, or latest Mikero dePbo.dll to get this magic to happen.

Yep it binarizes fne and works fine with the latest version of depbo

Share this post


Link to post
Share on other sites
It works just fine for me . Are you really defining the needed "required addons"( where the original array its defined, in your example with the throw weapon something like requiredAddons[] = {"A3_Weapons_F"}; ) before doing the += ?, because if not, it's obviously not gonna work ^^

Damnnn That's my mistake!! I forgot add the "A3_Weapons_F" on the required Addons parameter! :p :p Now it works well!!

Thank all of you guys, you have helped me a lot :D:D

Share this post


Link to post
Share on other sites
Damnnn That's my mistake!! I forgot add the "A3_Weapons_F" on the required Addons parameter! :p :p Now it works well!!

Thank all of you guys, you have helped me a lot :D:D

I did the same thing for about 5 attempts, :confused:

Share this post


Link to post
Share on other sites

Is there a -= operator?
How does one go about removing just one item from an array (in config entries...I know how to do this in SQL), without having to redefine the whole thing?

Share this post


Link to post
Share on other sites
On 14.7.2018 at 2:01 PM, lawman_actual said:

Is there a -= operator?

No.

On 14.7.2018 at 2:01 PM, lawman_actual said:

without having to redefine the whole thing

Can't.

  • Thanks 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

×