Reyhard/Sandbox/Character Gear Creation/Headgear/Prefab Configuration – User

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "overriden" to "overridden")
 
Line 55: Line 55:


* [[Arma Reforger:Data Modding Basics#Using .22Override in....22 function|Override in]] your addon '''{{Link|enfusion://ResourceManager/~ArmaReforger:Configs/EntityCatalog/US/US_InventoryItems.conf|US_InventoryItems.conf}}'''
* [[Arma Reforger:Data Modding Basics#Using .22Override in....22 function|Override in]] your addon '''{{Link|enfusion://ResourceManager/~ArmaReforger:Configs/EntityCatalog/US/US_InventoryItems.conf|US_InventoryItems.conf}}'''
* Open overriden file and locate '''Clothing''' section inside of it
* Open overridden file and locate '''Clothing''' section inside of it
* Add new entry to '''Entities''' list by clicking on '''+ button''' on the right side
* Add new entry to '''Entities''' list by clicking on '''+ button''' on the right side
* Assign your prefab to '''Entity Prefab''' field
* Assign your prefab to '''Entity Prefab''' field

Latest revision as of 14:36, 9 November 2023

Previous part - Asset Preparation
💬
Overview

This chapter covers following topics:

  • Helmet prefab creation & configuration
  • Adding headgear to arsenal
  • Testing & diagnosing issues with helmets

Prefab Setup

Creating Prefab

First step in this process will be inheriting Headgear_Base.et or duplicate one of existing helmets like Helmet_PASGT_01.et. When inheriting from Headgear_Base.et, few more steps will be required but those are listed later. Because of that, it might be faster & simpler to duplicate some prefab.

Also, don't forget to properly organize your prefab - it is quite useful to have base prefab with _base suffix, since its clear in such setup which file was used as parent for sub sequential child prefabs, which change slightly materials or mesh.

In this article, Enfusion links are used. With those links it is possible to open specific resource just by simply clicking on that link. Enfusion links has to be manually activated in Workbench options (Workbench -> Options -> Workbench -> Register "enfusion://" protocol) before it can be used]

Tweaking BaseLoadoutClothComponent

BaseLoadoutClothComponent content

Once you have new prefab for your helmet, open it in for example Prefab Edit Mode and start with tweaking things located in BaseLoadoutClothComponent

  • Enable PhysicsOnWearEnabled & AnimateCollidersOnWear properties
  • Assign item model to ItemModel in BaseLoadoutClothComponent & to property Object in MeshOjbect component
  • Assign worn model to WornModel
  • Change SoundInt parameter to 120
    • This parameter is responsible for additional sounds that are being played certain type of headgear is worn. For instance if you wear harness, you can hear some extra metal rattle when moving through the landscape. See Character SoundInfo Signals Reference page for more info

If you inherited from Headgear_Base.et prefab, then you would also need to tweak following things:

  • Change AreaType parameter in BaseLoadoutClothComponent to LoadoutHeadCoverArea
    • This will tell the game that this item should be assigned to head gear slot in inventory menu
  • Tweaking drop item sound in SCR_SoundDataComponent from Items_Drop_Clothes.acp to Items_Drop_Helmet.acp
    • Changes the sound which is being played when item is placed on the ground
  • Tweak position of default action context in ActionsManagerComponent
Default action context position after tweak in ActionsManagerComponent
Tip: You can find details how to create variants of headgear with different material on following page.

Inventory Configuration

InventoryItemComponent content

Configuration of inventory is quite similar compared to weapon, therefor it is suggested to take a look at Weapon Creation page for details regarding how each of those params are working. Below is list of things which were adjusted in InventoryItemComponent on base Sample Helmet prefab:

  • Item Display Name
    • Name - controls in game display name
    • Description - description of the item visible in in-game inventory menu
  • Item Phys Attributes
    • Weight was changed to 3.5 [kg] to be more or less in line with real life helmet
    • Size Setup Strategy was changed to Manual
    • Item Dimensions were changed to X:27, Y:25, Z:20 to more or less correspond to its actual dimensions
    • Item Volume was set to 2500
  • PeviewRenderAttributes in Custom Attributes section:
    • Camera Orbit Angles& FOV values are basically copy paste from Helmet_PASGT_01.et and only Camera Distance To Item was adjusted so that whole helmet fits the preview image in the inventory

Vanilla helmets are using 2x1 slots and once those tweaks are completed, it should look like that in game:

Sample Helmet in inventory menu

Adding to Arsenal

Process of adding headgear to the crates is very similar to the one described on Weapon Creation page. There are few differences though - notable different labels are used. So in short, if you intend to add helmet to i.e. existing US arsenal box, then perform following steps:

  • Override in your addon US_InventoryItems.conf
  • Open overridden file and locate Clothing section inside of it
  • Add new entry to Entities list by clicking on + button on the right side
  • Assign your prefab to Entity Prefab field
  • Add new SCR_ArsenalItem (Arsenal Data) entry to Entity Data List array by clicking on + button on the right side
  • Change Item Type in Arsenal Data to HEADWEAR

If everything went fine, you should end up with something like on the picture below

armareforger-new-headgear-arsenal-crate.png

Testing & Diags

Once you done all above steps, you can proceed with testing helmet in play mode. Place helmet prefab somewhere on the map in World Editor and then verify that everything works. Below is list some of the common problems

Helmet is not moving with character

Check that helmet has exactly 163 bones in total (dummies + real bones) - not more nor less - it has to be exactly 163.

Verify that Armature is called Armature and there are no extra dummy objects nor skeletons in your 3D software

Helmet colliders doesn't seem to work

You can check if item is correctly skinned by turning on following diagnostics

Physics → Show bodies - change it to one of non-disabled values, flat-mesh is usually quite good to verify it. You can also use Left Alt + 6 on numpad shortcut to toggle show bodies modes.

Physics → Show layer → FireGeometry - this tell the engine to only show colliders which are interacting FireGeometry layer

Physics → Show simulation state → All - toggles visibility of non active colliders like gear ones.

If helmet is not following character, then make sure that it is properly parented to skeleton via Relations and that colliders are active in BaseLoadoutClothComponent

I cannot store helmet in the inventory

Check Item Dimensions and Item Volume of the item - perhaps item is too large for any of the available containers that you are wearing