Weapon Suppressor Creation – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{Messagebox|'''Overview''' This tutorial covers following topics: * Preparing the 3D model and ensuring correct orientation. * Configuring the suppressor as an accessory in the game. * Creating the suppressor prefab and configuring its components. * Integrating the suppressor with a weapon.|💬|#CDF}}{{Feature|informative|This tutorial guides you through the process of creating a custom suppressor (muzzle attachment) for a weapon in Arma Reforger . The steps are struc...")
 
No edit summary
Line 10: Line 10:


== Prerequisites ==
== Prerequisites ==
* Basic understanding of '''Enfusion Engine'''  and '''Arma Reforger'''  modding.
* Basic understanding of '''Enfusion Engine'''  and '''Arma Reforger'''  modding.
* Access to a 3D modeling tool that can export '''FBX'''  files.
* Access to a 3D modeling tool that can export '''FBX'''  files.
Line 21: Line 20:
----
----


= Structure Preparation =
== Structure Preparation ==
While sticking to official structure is not mandatory and there are no engine restrictions asset wise about it, it is recommended to follow guidelines listed here - [[Arma Reforger:Directory Structure|Data (file) structure]] - to ensure that all automation plugins are parsing your assets correctly and make it later easy to navigate.
While sticking to official structure is not mandatory and there are no engine restrictions asset wise about it, it is recommended to follow guidelines listed here - [[Arma Reforger:Directory Structure|Data (file) structure]] - to ensure that all automation plugins are parsing your assets correctly and make it later easy to navigate.



Revision as of 09:02, 5 December 2024

💬
Overview

This tutorial covers following topics:

  • Preparing the 3D model and ensuring correct orientation.
  • Configuring the suppressor as an accessory in the game.
  • Creating the suppressor prefab and configuring its components.
  • Integrating the suppressor with a weapon.
This tutorial guides you through the process of creating a custom suppressor (muzzle attachment) for a weapon in Arma Reforger . The steps are structured similarly to the Weapon Optic Creation tutorial and cover asset preparation, configuration, and integration with a weapon.
📥
Sources files for this tutorial can be found on Arma Reforger Samples Github repository

Prerequisites

  • Basic understanding of Enfusion Engine and Arma Reforger modding.
  • Access to a 3D modeling tool that can export FBX files.
  • Familiarity with scripting in Enforce Script .
  • A mod tag or identifier (e.g., SampleMod_NewWeapon) for naming conventions.
  • Required tools and software:
    • Enfusion Workbench .
    • Enfusion Blender Tools (EBT) (optional but recommended for Blender users).

Structure Preparation

While sticking to official structure is not mandatory and there are no engine restrictions asset wise about it, it is recommended to follow guidelines listed here - Data (file) structure - to ensure that all automation plugins are parsing your assets correctly and make it later easy to navigate.

Therefore, your first task will be preparing following file structure

Preparing the Suppressor Asset

Model Orientation

Ensuring proper model orientation is crucial for correct attachment and in-game behavior. According to the Arma Reforger: FBX Import guidelines:

  • Blender and 3ds Max Users :
    • The model should point along the positive Y-axis .
  • Maya Users :
    • The model should point along the positive Z-axis .

If importing a model from another source (e.g., Arma 3), you may need to rotate it by 90 degrees to align correctly.

Object Naming

Follow these naming conventions to ensure proper import and functioning:

  • Level of Detail (LOD) Suffixes :
    • Use _LOD0, _LOD1, etc., to indicate different LODs.
    • Example: Suppressor_LOD0, Suppressor_LOD1.

Proper naming ensures that the engine correctly interprets your model's components during the import process. For a full list of naming conventions and detailed explanations, refer to the Arma Reforger: FBX Import - Naming Conventions page.

Adding Snap Points

Snap points are essential for correctly attaching the suppressor to weapons. For suppressor, it will be necessary to only add one empty object - snap_weapon. This can be achieved in those few steps:

  1. Create an Empty Object :
    • In Blender, add an Empty object of type Plain Axes .
    • Place it at the point where the suppressor will attach to the weapon.
  2. Name the Empty Object :
    • Set the name to snap_weapon.
  3. Align the Empty Object :
    • Ensure the empty object's orientation matches the weapon's attachment point.
    • The forward direction (front) should align along:
      • Positive Y-axis in Blender/3ds Max.
      • Positive Z-axis in Maya.
  4. Check Orientation :
    • Verify that the snap_weapon aligns accurately with the suppressor's model.

For detailed guidance, see Weapon Slots and Bones .

Collision Mesh

Creating an efficient collision mesh optimizes performance and ensures accurate physical interactions.

Choosing Collider Shape

Select the appropriate collider shape based on your suppressor's geometry. The collision mesh doesn't have to be a specific type; you can choose from various collider shapes depending on what best fits your suppressor:

  • Common Collider Types :
    • Box Collider
    • Convex Collider
    • Cylinder Collider
    • Sphere Collider
    • Capsule Collider
    • TriMesh Collider
  • Naming Colliders :
    • Name your colliders with appropriate prefixes to indicate their type.
    • While specific prefixes like UBX_, UCX_, etc., are typically used, focus on selecting the collider that best suits your model's shape.

Simplifying the Collider

  • Keep It Simple : Use the simplest shape that accurately represents the suppressor.
  • Performance Consideration : Simplified colliders reduce computational overhead.
  • Avoid Complex Meshes : Complex collision meshes can negatively impact performance.

Assigning Layer Preset and Game Material

Assign appropriate properties to your collider:

  • Layer Preset : ItemFireView
    • This layer preset is appropriate for weapon attachments and ensures correct interactions in the game.
  • Game Material : weapon_metal.gamemat
    • This material provides appropriate physical properties and sound effects for metal weapon components.
How to Assign
  1. In Your 3D Software :
  2. In Enfusion Workbench Import Settings :
    • If not set in the 3D software, you can assign them during import.
    • In the Import Settings , select your collider.


Exporting the Model

Export your model to the FBX format suitable for Enfusion.

  • Using Enfusion Blender Toolkit (EBT) FBX Exporter (Optional):
    • Simplifies export and ensures compatibility.
    • Automatically registers FBX in Workbench and enables "Export Scene Hierarchy".
  • Without EBT :
    • Manually register Import & Register file
    • Manually enable "Export Scene Hierarchy" in export settings.
    • Ensure export settings align with Enfusion requirements.

Creating the Attachment Script Class

Define the attachment type by creating a script class, ensuring compatibility with weapons.

Setting Up Your Script Directory

Organize scripts within your mod:

Naming Conventions

  • Script File : SampleMod_NewWeapon_Attachments_muzzle.c.
  • Class Names :
    • Attachment Config Class: AttachmentMuzzle65_39Class.
    • Attachment Class: AttachmentMuzzle65_39.

Creating the Script File

  1. Create the File :
    • In Muzzles/, create SampleMod_NewWeapon_Attachments_muzzle.c.
  2. Define the Classes :

class AttachmentMuzzle65_39Class {} AttachmentMuzzle65_39Class AttachmentMuzzle65_39Source; class AttachmentMuzzle65_39 : AttachmentMuzzle { };

Recompiling Scripts

After creating the script, recompile the game scripts:

  • In Script Editor :
    • Use Compile and Reload Scripts (⇧ Shift + F7).
  • In World Editor :
    • Use Reload Game Scripts (Ctrl + R).

Texturing the Suppressor

Apply textures to give your suppressor the desired appearance.

Creating Enfusion Materials

  • After Import :
    • Enfusion Materials (.emat files) are created in the Data folder.
    • Named based on material names in your 3D software.
    • Use MatPBRMaterial shader by default.

Assigning Textures

  1. Prepare Textures :
    • Use a tool like Substance Painter to create PBR textures.
    • Export Preset :
      • Use the BCR+NMO preset from GitHub:
      • Substance Export Profiles .
  2. Import Textures into the Game :
    • Place exported textures (e.g., Suppressor_BCR.tiff, Suppressor_NMO.tiff) in your mod's Data directory.
  3. Assign Textures to Materials :
    • In Enfusion Workbench, open the .emat files.
    • Assign textures to corresponding fields:
  4. Verify Material Settings :
    • Adjust properties like Metallic , Roughness , and Specular as needed.

Testing the Textures

  • Preview the Model :
    • Use Enfusion Workbench to ensure textures appear correctly.
  • Check for Issues :
    • Look for texture stretching, UV mapping errors, or material issues.
  • Adjust as Necessary :
    • Make corrections in your 3D software or texture editor if needed.

Creating the Suppressor Prefab

Inherit from Base Suppressor Prefab

Create a new prefab by inheriting from the base suppressor:

  • Base Prefab :
    • Prefabs/Weapons/Core/Suppressor_base.et.
  • Create New Prefab :
    • Inherit from Suppressor_base.et.
    • Name it appropriately, e.g., YourSuppressor_base.et.

Edit the Suppressor Prefab

Configure components within your new prefab.

Configure MeshObject

  • Assign your suppressor's mesh to the MeshObject component.

Configure InventoryItemComponent

  • Item Display Name :
    • Set the name displayed in the inventory.
  • Storage Properties :
    • Adjust weight, size, and physical attributes.
  • Preview Render Attributes :
    • Configure inventory preview visibility.

Configure WeaponAttachmentAttributes

In Custom Attributes of InventoryItemComponent:

  • WeaponAttachmentAttributes is already inherited from the base prefab.
  • Set Attachment Type :
    • Assign AttachmentMuzzle65_39.
    • This parameter controls where the suppressor can be attached.

Configure SCR_WeaponAttachmentSuppressor Component

  • Attachment Type :
    • Ensure it's set to AttachmentMuzzle65_39.
  • Adjust Properties :
    • Muzzle Speed Coefficient :
      • Modify as needed (suppressors can affect velocity).
    • Muzzle Dispersion Factor :
      • Adjust for accuracy changes.
    • Extra Obstruction Length :
      • Adjust this value to reflect the added length of the suppressor.
      • Note : This will increase Weapon Obstruction values defined in the weapon's WeaponComponent. It affects how the suppressor impacts the weapon's handling, particularly in confined spaces.
    • Recoil Coefficients :
      • Adjust recoil when suppressor is attached.

Configure SCR_MuzzleEffectComponent

  • Particle Effect :
    • Assign appropriate muzzle flash or smoke effects.
  • Effect Position :
    • Create EntitySlotInfo (e.g., "position").
    • Adjust Offset to match suppressor's end.
  • Reset On Fire :
    • Disable if not needed.

Configure Attachment Obstruction (Optional)

The SCR_WeaponAttachmentObstructionAttributes is already inherited from the parent suppressor prefab, so you do not need to add it manually. If you wish to configure obstruction attributes:

  • Navigate to SCR_WeaponAttachmentObstructionAttributes :
    • In the prefab's Custom Attributes , locate SCR_WeaponAttachmentObstructionAttributes .
  • Adjust Parameters as Needed :
    • Obstructed Attachment Types :
      • List attachment types that cannot be mounted at the same time as this one.
    • Required Attachment Types :
      • List attachment types that must be present for this one to be attachable.
      • Example description: "Types of attachments required for this one to be attachable e.g., M9 Bayonet requires A2 flash hider for mounting."

Adjust ActionsManagerComponent (Optional)

  • Adjust Action Positions :
    • Modify Offset to align actions with the suppressor.

Localization

  • Localize Asset :
    • Create localization entries for proper in-game display.

Integrating the Suppressor with a Weapon

Configure the Weapon's Muzzle Component

Open the weapon prefab to which the suppressor will attach.

Add AttachmentSlotComponent

  • Add Child Component :
    • Attach AttachmentSlotComponent to the weapon's MuzzleComponent.
  • Configure :
    • Pivot ID :
      • Set to weapon's muzzle slot (e.g., slot_barrel_muzzle).
    • Child Pivot ID :
      • Set to snap_weapon.
    • Attachment Type :
      • Assign AttachmentMuzzle65_39.
    • Show in Inspection :
      • Enable this option.

Add SCR_WeaponStatsManagerComponent

  • Add Component :
    • Attach SCR_WeaponStatsManagerComponent to manage weapon stats.
  • Configuration :
    • No additional setup unless customizing stats.

Update WeaponSoundComponent

  • Add Suppressed Sounds :
    • Update WeaponSoundComponent with suppressed firing sounds.

Testing Your Suppressor

Thorough testing ensures functionality aligns with expectations.

  • Attachment Verification :
    • Attach and detach the suppressor.
  • Alignment Check :
    • Confirm correct alignment with the weapon's muzzle.
  • Functionality Test :
    • Fire the weapon with the suppressor.
    • Check muzzle effects, sounds, recoil, and accuracy.
  • Attachment Obstruction Test :
    • Verify incompatible attachments cannot be mounted simultaneously.
  • Required Attachments Test :
    • Ensure required attachments are necessary for mounting.
  • Inventory Inspection :
    • Confirm the suppressor's name and preview display correctly.