Jump to content
Sign in to follow this  
Jastreb

Rifle muzzle attachment as a weapon with magazines

Recommended Posts

Hello. Let me frist start by explaining what I want to achieve.

 

There are some armies in the world, using rifle grenades. Ours is one of them. The way this functions with old types of grenades is:

 

  • Remove the muzzle top from the rifle
  • Attach a new muzzle attachment which will serve to mount rifle grenades
  • Bring up the rifle grenade sight on the rifle
  • Arm the grenade and mount it on the attachment we previously placed on the rifle
  • Insert a special ammo ( blank type of ammo with higher gunpowder filling )
  • Aim and fire

 

Transfered to the game, this will be way to comlicated to achieve if not mostly impossible, so I figured to shorten it and create few things first, such as:

 

  • Modelling the muzzle attachement ( done )
  • Modelling the actual rifle grenades  ( in the works no problem there )
  • Configuring the rifle grenades as UGL ammo with some adjustments ( already done needs tweaking )
  • Configuring the muzzle attachment as a weapon, which will be used to fire these greandes ( PROBLEM! )

The way I figured it to work is, once you mount the attachment to the muzzle it should bring the rifle grenade sight up, and switch the rifle to Rifle Grenade firing mode. But I have tried to configure the muzzle attachment as a weapon with no success. If I inherit from Inventory_Item_Base it will simply do nothing, so either I am missing some steps, or this is the wrong way of doing it.

 

This way would be perfect for operation, to bring it as close to the real thing, but it is very hard especially with lack of documentation and BI config which is a bit erratic.

 

 

First things first, is how do I create a weapon if possible to be in the muzzle slot and be able to fire my magazines?

 

Second thing is how do I create a fire mode in the rifle so when I mount the muzzle attachment it switches to the new fire mode and bring the sight up?

 

Third is how do I make actual models of rifle grenades show up in the place of the muzzle attachment and dissapear once fired? ( Fired EH comes to mind )

 

 

So far I have made ammo, magazines, rifle is done ( model, textures and config except the rifle grenade thing ) including rifle grenade sight, rifle grenades ar ein the works and it will be fine, muzzle attachment model is made, so how do I proceed with this?

 

 

I know some communities have this working, by a configuring the rifle grenade to be actual muzzle attachment, but that might work for me with the new type of grenades where aiming sight is on the actual grenade, but not for the old type as described above.

 

Any ideas or pointers, working examples are much appreciated.

Share this post


Link to post
Share on other sites

First things first, is how do I create a weapon if possible to be in the muzzle slot and be able to fire my magazines?

Currently that's not possible. The muzzle slot is exclusively for silencers/ compensators unfortunately.  Technically you can alter the firing sound, and ammo ballistic properties and basic damage value.

See the BIWiki entry for more details. You could try to define a different magazine in "class MagazineCoef" for the muzzle attachement, i somehow doubt that it would be that easy however. Also, AmmoCoef might offer even more possibilities, it hasn't been tested yet afaik.

 

Idk how capable scripts are in regards to weapon attachements. Can they detect them? If so, i would run a script that detects if the special thing is not attached and turn the Magazines for a regulary defined UGL into items that can't be used, by the UGL, but are identical in appearance.  When it detects the thing on the weapon it turns the non-usable magazines into usable magazines (by adding/removing the items in question)... It's hacky, but this is the only solid solution to make use of the attachement.

 

A more stable and less hacky way would be to merge the attachement into the weapon and then Hide it whenever the UGL is not selected. You don't have the manual process of adding/removing it, but at least it's not a hacky solution like the above. Plus the AI will be able to use it that way without further headache.

Share this post


Link to post
Share on other sites

I made them work in Arma 2 by using the modelSpecial command within the cfgMagazine for the rifle grenade magazine class. Then adding this class name to the list of magazines the rifle can fire. 

 

Another solution, is to make the rifle grenade a muzzle in the same way a UGL is. Again using modelSpecial to load a model of the rifle with the grenade at the end. 

 

However, my experience with the modelSpecial command for rifles in Arma 3 has been unsuccessful, but maybe it's been fixed since I last tried :)

 

Just don't mix up the modelSpecial command like I did ;) 

Share this post


Link to post
Share on other sites

AFAIK there are limitation with using modelspecial in that the weapon model is a static proxy and stops supporting various model.cfg animations, so it might not be the best solution in all applications

https://forums.bistudio.com/topic/171566-problem-with-floaty-weapon-parts/

 

I think R3F and Purple both developed some script-based solution for using rifle grenades with the muzzle slot on their respective FAMAS addons.

Share this post


Link to post
Share on other sites

Currently that's not possible. The muzzle slot is exclusively for silencers/ compensators unfortunately.  Technically you can alter the firing sound, and ammo ballistic properties and basic damage value.

See the BIWiki entry for more details. You could try to define a different magazine in "class MagazineCoef" for the muzzle attachement, i somehow doubt that it would be that easy however. Also, AmmoCoef might offer even more possibilities, it hasn't been tested yet afaik.

 

Idk how capable scripts are in regards to weapon attachements. Can they detect them? If so, i would run a script that detects if the special thing is not attached and turn the Magazines for a regulary defined UGL into items that can't be used, by the UGL, but are identical in appearance.  When it detects the thing on the weapon it turns the non-usable magazines into usable magazines (by adding/removing the items in question)... It's hacky, but this is the only solid solution to make use of the attachement.

 

A more stable and less hacky way would be to merge the attachement into the weapon and then Hide it whenever the UGL is not selected. You don't have the manual process of adding/removing it, but at least it's not a hacky solution like the above. Plus the AI will be able to use it that way without further headache.

 

The first thing is way to hacky and probably wont work, because I already tried few things and it is not showing any progress towards what I want with it.

 

For the second one, there is this: https://community.bistudio.com/wiki/weaponAccessories, so I should run this to check for accessories and if "rifle_grenade_acc" ( my new attachment ) is not present on the rifle then I should remove the mags out of the UGL to disable firing, and perhaps add a notification which is going to be displayed only in recruit and regular game modes, that he is missing that attachement. Once the attachment is present, magazines are available and weapon can be fired. Problem is this recuires a script to run in loops which is not very good for performance. That and configuring UGL to do what I want it to do once selected.

 

Merging it into the weapon is a good path to take. I guess it cant be configured as attachement in this case and will show on the weapon once UGL fire mode is selected.

 

I made them work in Arma 2 by using the modelSpecial command within the cfgMagazine for the rifle grenade magazine class. Then adding this class name to the list of magazines the rifle can fire. 

 

Another solution, is to make the rifle grenade a muzzle in the same way a UGL is. Again using modelSpecial to load a model of the rifle with the grenade at the end. 

 

However, my experience with the modelSpecial command for rifles in Arma 3 has been unsuccessful, but maybe it's been fixed since I last tried :)

 

Just don't mix up the modelSpecial command like I did ;)

 

That can be problematic with rifles. It is used for launchers, but with rifles it might bugout. I will try it though.

 

AFAIK there are limitation with using modelspecial in that the weapon model is a static proxy and stops supporting various model.cfg animations, so it might not be the best solution in all applications

https://forums.bistudio.com/topic/171566-problem-with-floaty-weapon-parts/

 

I think R3F and Purple both developed some script-based solution for using rifle grenades with the muzzle slot on their respective FAMAS addons.

 

 

Yeah I have seen the R3F solution, but with it, you cant add magazines into the inventory since rifle greandes are configured as attachments, and since there is no configured weapon for them the magazines simply dont show up. In VA that is. I might be able to add them via script to players inventory, and for each firing, player has to open inventory and move the rifle grenade to attachment slot. Some might say this is realistic, I say it is hacky. But it works...

 

 

 

Ok. Thank for bursting my bubble lads. :D

 

This not going as I wanted so I will try to mix and steer until I get what I wanted. No doubt, it will require scripting along with proper configuration. Shame, I wanted to make it purely on the config level without hacks and scripting loops.

Share this post


Link to post
Share on other sites

 Problem is this recuires a script to run in loops which is not very good for performance. That and configuring UGL to do what I want it to do once selected.

 

Does it need to run in loops or can you get it to run on an eventhandler so that the script triggers only when something like an InventoryClosed or Take event occurs?

 

I would imagine these would be the events where the change between a player's weapon having a muzzle attachment or not would happen. But I'm no scripter so I have no idea if this cuts down on looping checks or is a good way to do it in general.

Share this post


Link to post
Share on other sites

In your place I would put a model of mortar in the rifle .p3d file itself and just name it's selection "_mortar". Then I would create ammo/magazines based on standard grenades for grenade launcher and do tricks with model.cfg and config.cpp to make mortar show up in your barrel every time you switch to "mortar fire mode" (single, burst, full auto, mortar ..). When you are out of mortars, then "ammoRandom" in combination with hide animation(s) should help with hiding it even when you select "mortar fire mode".

 

I know it's not really helpful, but it's just what I would try ..

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  

×