Jump to content
Sign in to follow this  
drunken officer

I can not throw my addon grenade!

Recommended Posts

First of all, i searched inside this form, but i didnt get the right answer.

I wanna add a flashbang. Model is okay. The flashbang is in my geat, but i cant throw it. And i dont find my mistake. :confused:

Here are me Settings:

CfGAmmo

class cfgAmmo
{
class Default;
class Grenade;
class GrenadeHand;			
class ammo_flashbang : GrenadeHand
	 {

		model= "wug\blendgranate.p3d";		
		typicalspeed = 39;
		hit=1;indirectHit=1;indirectHitRange=1;

		deflecting=10;
		explosionTime=5;
};
};

CfgMagazines

class CfgMagazines
{
class Default;
class CA_Magazine : Default
{
	scope = protected;
	value = 1;  //Magazine With Small Value Will Faster Disepear On The Ground
	displayName = ""; //Displayed In Action Menu
	model="\ca\weapons\mag_univ.p3d"; //Model Of Magazine On Ground
	picture="";//"\ca\Weapons\Data\m_m16"; //Picture In Gear?
	modelSpecial = "";  //Model Of Special Magazine Like A Mortar
	useAction = false;
	useActionTitle = "";  //Displayed In Action Menu
	reloadAction = ManActReloadMagazine;  //Animation Of Magazine Reloading
	ammo = "";  //Name Of Ammo From CFGAmmo
	count = 30; //Count Of Bullets In One Magazine
	type = WeaponSlotItem; //How Many Slots Magazine Takes (In Gear)
	initSpeed = 900;  //Initional speed of bullet
	selectionFireAnim = "zasleh"; //ToDo: wrong place?
	nameSound=""; //Sound In Radio (Commander in tank)
	maxLeadSpeed = 23;  //ToDo: wrong place?
};
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-*-*-*-*-*-*-*-*THROW MAGAZINES*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
class HandGrenade: CA_Magazine {};	
class Flashbang: HandGrenade
{
model= "wug\blendgranate.p3d";
scope = 2;
ammo=ammo_flashbang;	
displayName = "$STR_granate";
descriptionShort = "Ii is a flashbang";
picture="\wug\grafik\blendgranate\icon_grenade_ca.paa";
	};
};

Config.CPP

#include "basicDefines.hpp"
#include "CfgAmmo.hpp"
#include "CfgMagazines.hpp"
class cfgWeapons
{
class Default;
class GrenadeLauncher;	
class Throw: GrenadeLauncher
{
         muzzles[] = {[b]mymuzzle[/b], HandGrenadeMuzzle, HandGrenadeTimedMuzzle, SmokeShellMuzzle, SmokeShellRedMuzzle, SmokeShellGreenMuzzle};
};
       class ThrowMuzzle : GrenadeLauncher {};	
class [b]mymuzzle[/b] : ThrowMuzzle
	{
		magazines[] = {[u]Flashbang[/u]};
	};

class HandGrenade: GrenadeLauncher
{
	scope = private;
	cursor = \ca\Weapons\Data\t_select;
	cursoraim = \ca\Weapons\Data\clear_empty;
	cursorSize = 1;
	autoAimEnabled=false;

	ammo=GrenadeHand;
	displayName=$STR_DN_HAND_GRENADE;
	nameSound="handgrenade";
	initSpeed=22;
	reloadMagazineSound[]={\ca\Weapons\Data\Sound\z_sinus,db-70,1};	// reload HandGrenade
	maxLeadSpeed = 7;
	reloadTime=0;
	magazineReloadTime=0;
	count=1;
	sound[]={,db-70,1};


};

class Flashbang: HandGrenade
{
	autoAimEnabled=false;

	ammo=ammo_flashbang;
	displayName="AMMO Flashbang";
	nameSound="";
	};

};

Can anybody help me?

Share this post


Link to post
Share on other sites

Discussed here - Whilst it's for A3, the same principles apply.

Grenade is like any other weapon, it needs an ammo, a magazne and a weapon - Therefore you need to create a custom throw weapon for your grenade, OR (but not advisable) alter the current 'throw' weapon to use your magazines.

Share this post


Link to post
Share on other sites

Thx for the link. I learned a bit more. But i've still the same problem.

CfGAmmo - i think this one is okay

I load my class from GrenadeHand

class cfgAmmo
{
class Default;
class Grenade : Default {};
class GrenadeHand : Grenade {};			
class [u]ammo_flashbang[/u] : GrenadeHand 
	 {
		scope = 1;
		model= "wug\blendgranate.p3d";		
		//typicalspeed = 39;
		hit=1;
		indirectHit=1;
		indirectHitRange=1;

		deflecting=10;
		explosionTime=5;

		visibleFire = 0.5;
		audibleFire = 0.05;
		visibleFireTime = 1;
		fuseDistance = 5;
};
};[/spoiler]

CfGMagazine, same here. I load my own magazine class from HandGrenade, called flashbang

class CfgMagazines
{
class Default;
class CA_Magazine : Default	{};	
       class HandGrenade: CA_Magazine {};	
       class Flashbang : HandGrenade
{
model= "wug\blendgranate.p3d";
ammo= "[u]ammo_flashbang[/u]";	
displayName = "$STR_granate";
descriptionShort = "It is a flashbang";
picture="\wug\grafik\blendgranate\icon_grenade_ca.paa";
	};
};[/spoiler]

Config.cpp

I load my muzzle class from the arma class

#define private        0
#define protected        1
#define public        2

#define true    1
#define false    0

#include "basicDefines.hpp"
#include "CfgAmmo.hpp"
#include "CfgMagazines.hpp"

class CfgPatches
{
    class dofwaffen
    {
        units[] = {};
        weapons[] = {};
        requiredVersion = 1.0;
	 requiredAddons[] = {};
    };

};
class cfgWeapons
{
class Default;

class GrenadeLauncher : Default {};
class Throw	 : GrenadeLauncher  {};  // ** Throw is the weaponclass for grenades
class Flashbang_Throw : Throw / ** create a own class of throw
{
	displayname = "Throw";
	muzzles[] = {"Flashbang_Muzzle"};	// **adding muzzle	
	class Flashbang_Muzzle : GrenadeLauncher // **loading-creating muzzle
	{
                aidispersioncoefx = 6;
		aidispersioncoefy = 6;
		autoreload = 1;
		cursor = "EmptyCursor";
		cursoraim = "throw";
		enableattack = 0;
		keepininventory = 1;
		magazinereloadtime = 0;
		maxrange = 60;
		maxrangeprobab = 0.03;
		midrange = 45;
		midrangeprobab = 0.9;
		minrange = 10;
		minrangeprobab = 0.2;
		modeloptics = "";
		reloadsound[] = {"", 0.000316228, 1};
		reloadtime = 0;
		showempty = 0;
		sound[] = {"", 0.000316228, 1};	
                magazines[] = {"Flashbang"}; //loading magclass, definied in cfgmagazines
	};
};
};

I cant find my mistake. It a worst thing...

Edited by Drunken Officer

Share this post


Link to post
Share on other sites

Messiah,

the link helped me alot. bBut i've one question about handgrenades.

You wrote, that the player have to add the "weapon" (custom throw class) and the "magazin", called in cfgMagazine.

You'll need to add the weapon 'Crg_Toxin_Throw' to the solider, as well as the magazine 'Crg_Toxin'.

but when i'm adding a arma2 grenade to the ammobox, i'm only add the magazine. Is there a private weapon linked to the grenads?

So it's very import, because the most missionhoster, only add "magazines".

Share this post


Link to post
Share on other sites

I assume you got the above working then?

The throw weapon, for some odd reason, is linked to the units. You are unable to add it like a normal weapon. So you'd have to create a custom unit (explained in the same link) that uses your throw 'weapon' or alter the existing throw weapon, but that could possibly cause complications with a lot of other things.

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  

×