Jump to content
Sign in to follow this  
charon productions

Inheritance of a throw weapon class problem

Recommended Posts

I try to inherit from the throw class, which worked perfectly fine in Arma2, but Arma3 won`t allow it.

While in Arma2 it is simply possible to have a minimal config like :

class CfgPatches {
class Customthrow {
	units[] = {""};
	weapons[] = {"Customthrow"};
	requiredAddons[] = {"CAWeapons", "CAWeapons2"};
};	
};

class CfgWeapons {
class Default;
class Throw;
class GrenadeLauncher;
class Customthrow: Throw {
	displayName = "Custom Throw";
};
};

and the unit would show true on a hasweapon-check.

In arma3 alpha a player hasweapon-check shows false (if i manually addweapon it to the unit) :

class CfgPatches {
class Customthrow {
	units[] = {""};
	weapons[] = {"Customthrow"};
	requiredAddons[] = {"A3_Data_F","A3_weapons_f"};
};	
};

class CfgWeapons {
class Default;
class Throw;
class GrenadeLauncher;
class Customthrow: Throw {
	displayName = "Custom Throw";
};
};

Even if i copy the entire section of the original weapon config and just give it a new name it won`t work.

class CfgWeapons {
class Default;
class Throw;
class GrenadeLauncher;
class Customthrow: GrenadeLauncher {
	scope = 2;
	autoAimEnabled = 0;
	cursor = "EmptyCursor";
	cursorAim = "throw";
	value = 0;
	type = 0;
	displayName = "$STR_DN_THROW";
	canDrop = 0;
	textureType = "semi";
	muzzles[] = {"HandGrenadeMuzzle"};

	class ThrowMuzzle: GrenadeLauncher {
		cursor = "EmptyCursor";
		cursorAim = "throw";
		sound[] = {"", 0.000316, 1};
		reloadSound[] = {"", 0.000316, 1};
		aiDispersionCoefX = 6;
		aiDispersionCoefY = 6;
		reloadTime = 0;
		magazineReloadTime = 0;
		enableAttack = 0;
		showEmpty = 0;
		autoReload = 1;
		modelOptics = "";
		minRange = 10;
		minRangeProbab = 0.200000;
		midRange = 45;
		midRangeProbab = 0.900000;
		maxRange = 60;
		maxRangeProbab = 0.030000;
		keepInInventory = 1;
	};

	class HandGrenadeMuzzle: ThrowMuzzle {
		magazines[] = {"HandGrenade"};
	};
};
};

Most addon-makers would use the standard throw weapon for new grenades, i was just wondering why this does not work anymore.

Share this post


Link to post
Share on other sites

Well perhaps they somehow fixed the most annoying thing with throw so you instead just define the mag add say its "throwable", want to do some grenades but making custom throw have nice ofp days been problems.

Sorry no help, but I will also try later.

Share this post


Link to post
Share on other sites

think you sold inherite this

class Throw: GrenadeLauncher

{

class ThrowMuzzle: GrenadeLauncher

{

};

class MyCustomGrenadeMuzzle: ThrowMuzzle

{

---------- Post added at 09:19 ---------- Previous post was at 09:15 ----------

should instead shold

sorry my funny engliz)

Share this post


Link to post
Share on other sites

Thanks for the answers. The throw class is one of the few peculiar classes in the config. I believe that it pulls some code from core configs, for example the actual handanim for throwing something is not

part of the config definition. Because a grenadelauncher, that throw inherits from, has to my knowledge different hand anims.

So just inheriting from throw class does not 'build' a complete throw weapon, some other stuff seems to be needed to make it a full throw weapon.

Share this post


Link to post
Share on other sites

Please post the complete config - aka also the unit config.

Share this post


Link to post
Share on other sites

hmm from work i can see you have Inheritance

class Throw;

class GrenadeLauncher;

but actual inheritance of a3

class Throw: GrenadeLauncher

so already you have broke Bis inheritance tree maybe with this parsing (sorry can only guess at work )?

thats lowest i can get it , maybe you can get even less but it should work in theory

class GrenadeLauncher;

class Throw : GrenadeLauncher

{

class ThrowMuzzle :GrenadeLauncher

{};

};

class MyThrow: Throw

{

scope = 1;

autoAimEnabled = 0;

cursor = "EmptyCursor";

cursorAim = "throw";

value = 0;

type = 0;

displayName = "Throw";

canDrop = 0;

textureType = "semi";

muzzles[] = {"HandGrenade_Stone","HandGrenadeMuzzle","MiniGrenadeMuzzle","SmokeShellMuzzle","SmokeShellYellowMuzzle","SmokeShellGreenMuzzle","SmokeShellRedMuzzle","SmokeShellPurpleMuzzle","SmokeShellOrangeMuzzle","SmokeShellBlueMuzzle","ChemlightGreenMuzzle","ChemlightRedMuzzle","ChemlightYellowMuzzle","ChemlightBlueMuzzle"};

class ThrowMuzzle: ThrowMuzzle

{

};

};

Edited by Thromp

Share this post


Link to post
Share on other sites
;2356023']Please post the complete config - aka also the unit config.

I am adding the weapon to a rifleman in the editor.

Mission and addon that exhibits the issue: http://www.sendspace.com/file/h8yb6o

init of the rifleman(player):

removeallweapons this; player addweapon "Customthrow"

Ammo and magazine not implemented' date=' because in Arma2 it works with just the weapon.

Have however run ofc tests with grenade magazines and ammo which didn`t work either.

The script line :

player sidechat format ["Player hasweapon Customthrow : %1",player hasweapon "Customthrow"];

should return true, but it returns false.

Maybe the throw class was changed to final or it's constructors to private (inadvertently)?

I am however able to inherit from the throwmuzzle class [b']inside[/b] the original throw class

adding custom grenade magazines (like everybody does their grenade addons).

Just inheritance from the class throw seems to be impossible. Having to hack the original throw class

will make any kind of throwable/grenade addons automatically incompatible.

Edited by Charon Productions

Share this post


Link to post
Share on other sites
// Test config to get custom throw weapon to work
class CfgPatches {
class YouTag_Customthrow_Cfg {
	units[] = {""};
	weapons[] = {"Customthrow"};
	requiredAddons[] = {"A3_Data_F","A3_weapons_f"};
};	
};

class CfgWeapons {
class Default;
class GrenadeLauncher;
class Throw: GrenadeLauncher
{
	class ThrowMuzzle: GrenadeLauncher
	{
	};
	class Customthrow: ThrowMuzzle 
	{
		displayName = "Custom Throw";
	};
};
};

Share this post


Link to post
Share on other sites
// Test config to get custom throw weapon to work
class CfgPatches {
class YouTag_Customthrow_Cfg {
	units[] = {""};
	weapons[] = {"Customthrow"};
	requiredAddons[] = {"A3_Data_F","A3_weapons_f"};
};	
};

class CfgWeapons {
class Default;
class GrenadeLauncher;
[b]class Throw: GrenadeLauncher[/b]
{
	class ThrowMuzzle: GrenadeLauncher
	{
	};
	class Customthrow: ThrowMuzzle 
	{
		displayName = "Custom Throw";
	};
};
};

Nikita, this would not create a new weapon. It would 'hack' the original config's throw class, overwriting it with the new content.

The throw class needs to be inherited to create a new class that can contain custom muzzles/magazines.

And this does not work like in Arma2 anymore. So the question is how does it work (if the constructor hasn't been changed to private that is)?

Share this post


Link to post
Share on other sites

Hi the config i posted works ,

i guess what your saying is that in Arma2 you could use the command this removeweapon "throw" and then this addweapon " mythrow",

however in Arma 3 regardless of default throw or custom throw , it is no longer possible to reinstate a weapon of this type ,.

i added the cofig i posted to a unit and it does give the custom throw , so i guess thats the only way now , i never tested in A2 so cant verify that you could remeove and add throw via inits .

so in summary if you use the config i gave you and simply change the muzzle to a custom one and add to a units config your new throw will work , if you want to add in mission editor it will not .

sorry for repating just trying to add clarification only way i saw is to create unit config and add your new throw to

weapons[] = {"MyThrow","Put","Binocular"};

respawnWeapons[] = {"MyThrow","Put","Binocular"};

Edited by Thromp

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  

×