Data Modding Basics – Arma Reforger

From Bohemia Interactive Community
Jump to navigation Jump to search
(added links)
No edit summary
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{TOC|side}}
{{TOC|side}}


= Content modability overview =
= Content Moddability Overview =
 
 
== Can Be Replaced ==


== Can be replaced ==
This means that certain resource can be fully replaced. Usually such resources are created manually by creating same asset with same GUID
This means that certain resource can be fully replaced. Usually such resources are created manually by creating same asset with same GUID


Line 10: Line 12:
Variant of ''Model.xob'' from ArmaReforger is created in Addon1 via '''''Override in "Addon1" addon...'''''. This new file share same GUID of original file and can contain completely different mesh}}
Variant of ''Model.xob'' from ArmaReforger is created in Addon1 via '''''Override in "Addon1" addon...'''''. This new file share same GUID of original file and can contain completely different mesh}}


== Can be modified ==
 
== Can Be Modified ==
 
Certain elements of the resource can be modified while rest of them is kept
Certain elements of the resource can be modified while rest of them is kept


Line 17: Line 21:
Vehicle_Base.et is copied from ArmaReforger to Addon1 with exactly same GUID as original file via '''''Override in "Addon1"''''' action. Copy of Vehicle_Base.et, located in Addon1, contain only changes introduced in this addon and those changes are later applied to original prefab.}}
Vehicle_Base.et is copied from ArmaReforger to Addon1 with exactly same GUID as original file via '''''Override in "Addon1"''''' action. Copy of Vehicle_Base.et, located in Addon1, contain only changes introduced in this addon and those changes are later applied to original prefab.}}


== Can be inherited from ==
 
A new resource can inherit from existing file
== Can Be Inherited From ==
 
A new resource can inherit from an existing file:
{{Feature|informative|
{{Feature|informative|
'''Example:'''
'''Example:'''


Inherited version of ArsenalConfig_BLUEFOR.conf is created via '''''Create Inherited File''''' or '''''Inherit in "Addon1"''''' option. This new file has unique ID and inherits all data from its parent.}}
Inherited version of ArsenalConfig_BLUEFOR.conf is created ''via'' '''''Create Inherited File''''' or '''''Inherit in "Addon1"''''' option. This new file has unique ID and inherits all data from its parent.}}
 


== Modability table ==
== Moddability table ==


{| class="wikitable"
{| class="wikitable"
|'''Extension'''
! Extension
|'''File Type'''
! File Type
|'''Can be replaced'''
! Can be replaced
|'''Can be modified'''
! Can be modified
|'''Can be inherited from'''
! Can be inherited from
|-
|-
| colspan="1" |
|
'''.et'''  
'''.et'''
|Prefab
| Prefab
|{{Icon|warning}}<ref name="note_table_override" />  
| {{Icon|warning}}<ref name="note_table_override" />
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
|-
|-
| colspan="1" |
|
'''.conf'''  
'''.conf'''
| colspan="1" |Config
| Config
| colspan="1" |{{Icon|warning}}<ref name="note_table_override" />  
| {{Icon|warning}}<ref name="note_table_override" />
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
|-
|-
| colspan="1" |
|
'''.xob'''  
'''.xob'''
|Model
| Model
|{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.emat'''  
'''.emat'''
|Material Definition
| Material Definition
|{{Icon|warning}}<ref name="note_table_override" />  
| {{Icon|warning}}<ref name="note_table_override" />
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
|-
|-
| colspan="1" |
|
'''.edds'''  
'''.edds'''
|Enfusion DDS Texture
| Enfusion DDS Texture
|{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.c'''  
'''.c'''
| colspan="1" |Enforce Script Source
| Enforce Script Source
| colspan="1" |{{Icon|warning}}<ref name="note_table_1" />  
| {{Icon|warning}}<ref name="note_table_1" />
| colspan="1" |{{Icon|warning}}<ref name="note_table_2" />  
| {{Icon|warning}}<ref name="note_table_2" />
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
|-
|-
| colspan="1" |
|
'''.layout'''  
'''.layout'''
| colspan="1" |Layout Definition
| Layout Definition
| colspan="1" |{{Icon|warning}}<ref name="note_table_override" />  
| {{Icon|warning}}<ref name="note_table_override" />
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
|-
|-
| colspan="1" |'''.ptc'''
| '''.ptc'''
| colspan="1" |Particle System Definition
| Particle System Definition
| colspan="1" |{{Icon|warning}}<ref name="note_table_override" />  
| {{Icon|warning}}<ref name="note_table_override" />
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.ent'''  
'''.ent'''
| colspan="1" |World Scene
| World Scene
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.layer'''  
'''.layer'''
| colspan="1" |World Layer
| World Layer
| colspan="1" |{{Icon|checked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.bt'''  
'''.bt'''
| colspan="1" |Behavior tree
| Behavior tree
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|warning}}<ref name="note_table_3" />  
| {{Icon|warning}}<ref name="note_table_3" />
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.anm'''  
'''.anm'''
| colspan="1" |Animation file
| Animation file
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.agf'''  
'''.agf'''
| colspan="1" |Animation graph file
| Animation graph file
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.agr'''  
'''.agr'''
| colspan="1" |Animation graph
| Animation graph
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
|{{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.aw'''  
'''.aw'''
| colspan="1" |Animation Workspace
| Animation Workspace
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.asi'''  
'''.asi'''
| colspan="1" |Animation Set Template
| Animation Set Template
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.pap'''  
'''.pap'''
| colspan="1" |Procedural Animation
| Procedural Animation
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.siga'''  
'''.siga'''
| colspan="1" |Procedural Animation Signal
| Procedural Animation Signal
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.st'''  
'''.st'''
| colspan="1" |String Table
| String Table
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.acp'''  
'''.acp'''
| colspan="1" |Audio component
| Audio component
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.sig'''  
'''.sig'''
| colspan="1" |Signal (Audio)
| Signal (Audio)
| colspan="1" |{{Icon|checked}}  
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|-
|-
| colspan="1" |
|
'''.wav'''  
'''.wav'''
| colspan="1" |Supported audio file format
| Supported audio file format
| colspan="1" |{{Icon|checked}}
| {{Icon|checked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
| colspan="1" |{{Icon|unchecked}}
| {{Icon|unchecked}}
|}
|}


=== Footnotes ===
=== Footnotes ===
<references>
<references>
<ref name="note_table_override">Following assets are always overridden and cannot be fully replaced</ref>
<ref name="note_table_override">Following assets are always overridden and cannot be fully replaced</ref>
Line 198: Line 206:


= Data manipulation =
= Data manipulation =


== Basics ==
== Basics ==
In principle, any file with meta file and unique '''GUID -''' ''global unique identifier -'' can be be overridden or replaced . This means however, that files without meta file have to be modified in different way (scripts ) or cannot be replaced at all.
In principle, any file with meta file and unique '''GUID -''' ''global unique identifier -'' can be be overridden or replaced . This means however, that files without meta file have to be modified in different way (scripts ) or cannot be replaced at all.


Line 206: Line 216:
{{Feature|informative|When replacing assets, engine cares '''only about GUID -''' that means neither '''file name''' or '''location''' doesn't have to be same as source file.}}
{{Feature|informative|When replacing assets, engine cares '''only about GUID -''' that means neither '''file name''' or '''location''' doesn't have to be same as source file.}}


Creating overrides, duplicates or inherited files can be performed from context menu which is available in '''Resource Browser'''. This menu is visible after clicking with '''Right Mouse Button''' on selected asset. Availability of the actions depends on the type of the assets, so for instance models (''XOBs)'' have only ''Navigate to ...'' options.  
Creating overrides, duplicates or inherited files can be performed from context menu which is available in '''Resource Browser'''. This menu is visible after clicking with '''Right Mouse Button''' on selected asset. Availability of the actions depends on the type of the assets, so for instance models (''XOBs)'' have only ''Navigate to ...'' options.


[[Image:armareforger-data-modding-context-menu.png|center]]
[[Image:armareforger-data-modding-context-menu.png|center]]
Line 213: Line 223:
{| class="wikitable"
{| class="wikitable"
|
|
|'''Override'''
| '''Override'''
|'''Replacement'''
| '''Replacement'''
|'''Duplicate'''
| '''Duplicate'''
|'''Inherit'''
| '''Inherit'''
|-
|-
| colspan="1" |'''Description'''
| '''Description'''
|Override creates a new file which shares same GUID as original asset. This action allows to selectively replaces or add new elements to selected asset.
| Override creates a new file which shares same GUID as original asset. This action allows to selectively replaces or add new elements to selected asset.


For instance it is possible to change value
For instance it is possible to change value
Line 226: Line 236:


This action can be performed by selecting '''"Override in '...'"''' action from the '''Addons''' menu.
This action can be performed by selecting '''"Override in '...'"''' action from the '''Addons''' menu.
|Replacement, as name suggest, completely replace original file with the new file.
| Replacement, as name suggest, completely replace original file with the new file.


[[Image:armareforger-data-modding-resource-variant.png]]
[[Image:armareforger-data-modding-resource-variant.png]]
In '''Particle Editor,''' it is possible to use "'''Create variant for '...' addon..."''' action but beside that, in all other cases it user has to create duplicates on his own by ensuring that replacing file has same GUID as original one.
In '''Particle Editor''', it is possible to use "'''Create variant for '...' addon..."''' action but beside that, in all other cases it user has to create duplicates on his own by ensuring that replacing file has same GUID as original one.


This can be done by either copy pasting meta file (if we have access to it) or changing GUID of asset in text editor, so it matches the original file GUID.
This can be done by either copy pasting meta file (if we have access to it) or changing GUID of asset in text editor, so it matches the original file GUID.


'''Prefabs''', '''configs''' and '''layouts cannot be replaced''' - they will be always in override mode.
'''Prefabs''', '''configs''' and '''layouts cannot be replaced''' - they will be always in override mode.
|Duplication creates a new file, with new, unique GUID. Duplicated file contains all the data from the original file (including inheritance) but doesn't modify in any way original file.
| Duplication creates a new file, with new, unique GUID. Duplicated file contains all the data from the original file (including inheritance) but doesn't modify in any way original file.


This action can be performed by selecting '''"Duplicate in '...'"''' action from the '''Addons''' menu.
This action can be performed by selecting '''"Duplicate in '...'"''' action from the '''Addons''' menu.
| colspan="1" |Inherit action creates a new child file which inherits all the data from the parent.
| Inherit action creates a new child file which inherits all the data from the parent.


This action can be performed by selecting '''"Inherit in '...'"''' action from the '''Addons''' menu.
This action can be performed by selecting '''"Inherit in '...'"''' action from the '''Addons''' menu.


Inheritance of '''prefabs''' can be only performed in '''Resource Browser''' attached to '''World Editor'''  
Inheritance of '''prefabs''' can be only performed in '''Resource Browser''' attached to '''World Editor'''
|-
|-
| colspan="1" |'''Where it can be used'''
| '''Where it can be used'''
| colspan="1" |Prefabs, configs, materials and layouts
| Prefabs, configs, materials and layouts
| colspan="1" |Sounds, models, textures, animations, particle effects, world files or behavior trees
| Sounds, models, textures, animations, particle effects, world files or behavior trees
| colspan="1" |Prefabs, configs, materials or layouts
| Prefabs, configs, materials or layouts
| colspan="1" |Prefabs'''*''', configs or layouts
| Prefabs'''*''', configs or layouts
|}
|}






{{Feature|informative|When using [[Arma_Reforger:Startup_Parameters#addons|CLI parameter]] to load addons, '''working addon''' is equal to the last addon listed in addons list.
{{Feature|informative|
When using [[Arma_Reforger:Startup_Parameters#addons|CLI parameter]] to load addons, '''working addon''' is equal to the last addon listed in addons list.


''Example:''
''Example:''
<syntaxhighlight lang="C#">-addons addon2, addon1, NewAddon</syntaxhighlight>
<enforce>-addons addon2, addon1, NewAddon</enforce>
''In above example '''NewAddon''' is current work addon''}}
''In above example '''NewAddon''' is current work addon''
}}
 


== Overriding assets ==
== Overriding assets ==


=== Using "Override in..." function ===
=== Using "Override in..." function ===
"'''Override to..."''' function can be used to modify (override) existing assets like configs, layouyts or prefabs.
"'''Override to..."''' function can be used to modify (override) existing assets like configs, layouyts or prefabs.


Line 267: Line 281:


After this option is clicked, '''Resource Browser''' will create new overridden file in '''working addon''' (retaining original folder structure) and then navigate to '''overridden instance''' of selected asset.}}
After this option is clicked, '''Resource Browser''' will create new overridden file in '''working addon''' (retaining original folder structure) and then navigate to '''overridden instance''' of selected asset.}}
{{Clear}}
{{Clear}}
=== Using "Navigate to..." function ===
=== Using "Navigate to..." function ===
Once you have file in addon which is overriding some data, you can quickly navigate
Once you have file in addon which is overriding some data, you can quickly navigate


==== Navigate to Original ====
==== Navigate to Original ====
[[Image:armareforger-data-modding-navigate-original-action.gif|left]]
[[Image:armareforger-data-modding-navigate-original-action.gif|left]]
{{Feature|informative|'''''Navigate to Original''''' button is available in file context menu only if selected file overridden or replaced in some addon. If selected asset is not overridden in any currently loaded addon then this option will appear greyed out.
{{Feature|informative|'''''Navigate to Original''''' button is available in file context menu only if selected file overridden or replaced in some addon. If selected asset is not overridden in any currently loaded addon then this option will appear greyed out.


After this option is clicked, '''Resource Browser''' will navigate to '''original instance''' of selected asset.}}
After this option is clicked, '''Resource Browser''' will navigate to '''original instance''' of selected asset.}}
{{Clear}}
{{Clear}}
==== Navigate to Override ====
==== Navigate to Override ====
[[Image:armareforger-data-modding-navigate-override-action.gif|left]]
[[Image:armareforger-data-modding-navigate-override-action.gif|left]]
{{Feature|informative|'''''Navigate to Override''''' button is available in file context menu only if selected file overridden or replaced in some addon. If selected asset is not overridden in any currently loaded addon then this option will appear greyed out.
{{Feature|informative|'''''Navigate to Override''''' button is available in file context menu only if selected file overridden or replaced in some addon. If selected asset is not overridden in any currently loaded addon then this option will appear greyed out.
Line 287: Line 301:


In scenario where multiple addons are present and they are overriding same file, '''Navigate to Override''' can be used multiple times until last override is reached.}}
In scenario where multiple addons are present and they are overriding same file, '''Navigate to Override''' can be used multiple times until last override is reached.}}
{{Clear}}
{{Clear}}
==== Navigate to Ancestor ====
==== Navigate to Ancestor ====
Line 295: Line 310:
After clicking that option, '''Resource Browser''' will navigate to the first '''ancestor of overridden instance''' of selected asset.
After clicking that option, '''Resource Browser''' will navigate to the first '''ancestor of overridden instance''' of selected asset.


In scenario where multiple addons are present and they are overriding same file, '''Navigate to Override''' can be used multiple times until last override is reached.
In the scenario where multiple addons are present and they are overriding the same file, '''Navigate to Override''' can be used multiple times until the last override is reached.
}}
}}
{{Clear}}
{{Clear}}
=== Scripts ===
=== Scripts ===
In Enfusion it's possible to modify already existing scripts by using some of special keyword
In Enfusion it's possible to modify already existing scripts by using some of special keyword


Line 306: Line 323:


==== Modded keyword ====
==== Modded keyword ====
<syntaxhighlight lang="C#">modded class SCR_PlayerScoreInfo
<enforce>modded class SCR_PlayerScoreInfo
{
{


}</syntaxhighlight>
}</enforce>


==== Override keyword ====
==== Override keyword ====
<syntaxhighlight lang="C#">modded class SCR_ScoringSystemComponent : SCR_BaseGameModeComponent  
<enforce>modded class SCR_ScoringSystemComponent : SCR_BaseGameModeComponent
{
{
  override void AddSuicide(int playerID) {
override void AddSuicide(int playerID) {
  {
{


  }
}
}</syntaxhighlight>
}</enforce>


==== Super keyword ====
==== Super keyword ====
<syntaxhighlight lang="C#">modded class SCR_ScoringSystemComponent : SCR_BaseGameModeComponent
<enforce>
modded class SCR_ScoringSystemComponent : SCR_BaseGameModeComponent
{
{
  override void AddSuicide(int playerID)
override void AddSuicide(int playerID)
  {
{
      super.AddSuicide(playerID);
super.AddSuicide(playerID);
      // Your example code below
// Your example code below
      AudioSystem.PlaySound("{9BB653FF9E065943}Sounds/Animals/Bos_Taurus/Samples/bawl/bawl_0.wav");
AudioSystem.PlaySound("{9BB653FF9E065943}Sounds/Animals/Bos_Taurus/Samples/bawl/bawl_0.wav");
  }  
}
}</syntaxhighlight>
}
</enforce>


=== Using "Duplicate to..." function ===
=== Using "Duplicate to..." function ===
In '''Resource Browser''' you can quickly create new, duplicated file in project you are currently working on. This file is exact copy of original file and will be used from that point when any part of the game will try use asset with this '''GUID'''. Any changes that you are going to do to that file are going to be applied applied to that copy are not going to be propagated to it.
In '''Resource Browser''' you can quickly create new, duplicated file in project you are currently working on. This file is exact copy of original file and will be used from that point when any part of the game will try use asset with this '''GUID'''. Any changes that you are going to do to that file are going to be applied applied to that copy are not going to be propagated to it.


Line 337: Line 357:
{{Feature|informative|'''Duplicate to "..."''' option is available only for prefabs, layouts or configs.
{{Feature|informative|'''Duplicate to "..."''' option is available only for prefabs, layouts or configs.


After this option is clicked, '''Resource Browser''' will create new duplicated file - with name selected by the user - in '''working addon''' (retaining original folder structure) and then navigate to that duplicate.}}
After this option is clicked, '''Resource Browser''' will create new duplicated file - with name selected by the user - in '''working addon''' (retaining original folder structure) and then navigate to that duplicate.}}
 


{{Clear}}
{{Clear}}
== Inheriting ==  
== Inheriting ==


=== Using "Inherit in..." function ===
=== Using "Inherit in..." function ===
Inheriting from the config files or layouts can be performed via "'''Inherit in...'''" function. After clicking with '''Right Mouse Button''' on appropriate file and then selecting Inherit in function, a new pop up window will appear asking for a new file name. Once name is confirmed, a new file will be created in '''working addon''' with same folder structure as original file. As expected, all of the attributes will be '''inherited from parent file'''.
 
Inheriting from the prefabs, config files or layouts can be performed via "'''Inherit in...'''" function. After clicking with '''Right Mouse Button''' on appropriate file and then selecting Inherit in function, a new pop up window will appear asking for a new file name. Once name is confirmed, a new file will be created in '''working addon''' with same folder structure as original file. As expected, all of the attributes will be '''inherited from parent file'''.


[[Image:armareforger-data-modding-inheriting.png|center]]
[[Image:armareforger-data-modding-inheriting.png|center]]
{{Clear}}
{{Clear}}


=== Using "Inherit Prefab in Addon" function ===
=== Using "Transfer to..." function ===


[[Image:armareforger-data-modding-inherit-in-addon.jpg|right|900px]]
Transfer to function is a functionality for moving data & merging partially overridden files (like prefabs or configs) from current working addon to parent addon. Parent addon need to be unpacked in order to have this functionality working.  
Prefabs are special case since any operations on them require '''World Editor'''. When clicking with right mouse button on prefab in Resource Browser attached to World Editor, there are two additional actions availble in Context Menu - [[Arma_Reforger:Prefabs_Basics#Using_Inherit_Prefab_option|Inherit Prefab]] and '''Inherit Prefab in Addon'''.  


When dealing with read-only files, '''Inherit Prefab in Addon''' is especially useful, since it will create new prefab (with custom name) in current working addon retaining folder structure of original prefab.
{{Feature|important|Warning - currently this functionality is hardcoded to ArmaReforger addon which makes it unusable for modders.}}


{{Clear}}
{{Clear}}
== Replacing assets ==


== Replacing assets ==
Replacing assets means that i.e. AK-74 model can be with a simple gray box and all prefabs which are referencing that AK-74 are going to use that new gray box from now. Such replacement can be performed with sounds, models, textures, animations, particle effects, world files or behavior trees.
Replacing assets means that i.e. AK-74 model can be with a simple gray box and all prefabs which are referencing that AK-74 are going to use that new gray box from now. Such replacement can be performed with sounds, models, textures, animations, particle effects, world files or behavior trees.


[[Image:armareforger-data-modding-resource-variant.png|left]] In '''Particle Editor''' replacement can be performed quite easly by using "'''Create variant for "..." addon..'''." function. This action creates new '''ptc''' file with same '''GUID''' and '''content''' as '''original file'''.
[[Image:armareforger-data-modding-resource-variant.png|left]] In '''Particle Editor''' replacement can be performed quite easily by using "'''Create variant for "..." addon..'''." function. This action creates new '''ptc''' file with same '''GUID''' and '''content''' as '''original file'''.
{{Clear}}
{{Clear}}


Line 368: Line 390:


==== Getting file GUID ====
==== Getting file GUID ====
[[Image:armareforger-data-modding-getting-guid.png|left]]
[[Image:armareforger-data-modding-getting-guid.png|left]]
First step towards creating such replacement would be obtaining GUID - this can be done via '''Copy Resource GUID(s)''' action, available in '''context menu''' after clicking on file with '''Right Mouse Button.'''
First step towards creating such replacement would be obtaining GUID - this can be done via '''Copy Resource GUID(s)''' action, available in '''context menu''' after clicking on file with '''Right Mouse Button.'''
Line 375: Line 396:


{{Clear}}
{{Clear}}
== Replacing script ==
Scripts can be replace each other simply when they are in same relative location with same name.
For instance, to replace [enfusion://ResourceManager/~ArmaReforger:scripts/Game/UserActions/PickupAction.c PickupAction.c] located in base '''ArmaReforger''' data, you would need to create a new script in your addon in same location and with exact name.<syntaxhighlight lang="c#">
MyAddon\scripts\Game\UserActions\PickupAction.c
</syntaxhighlight>
If multiple addons are trying to replace same file, then the last one in the loading chain will be used.


{{GameCategory|armaR|Modding|Tutorials|Assets}}
{{GameCategory|armaR|Modding|Tutorials|Assets}}

Latest revision as of 14:09, 16 August 2024

Content Moddability Overview

Can Be Replaced

This means that certain resource can be fully replaced. Usually such resources are created manually by creating same asset with same GUID

Example: Variant of Model.xob from ArmaReforger is created in Addon1 via Override in "Addon1" addon.... This new file share same GUID of original file and can contain completely different mesh


Can Be Modified

Certain elements of the resource can be modified while rest of them is kept

Example: Vehicle_Base.et is copied from ArmaReforger to Addon1 with exactly same GUID as original file via Override in "Addon1" action. Copy of Vehicle_Base.et, located in Addon1, contain only changes introduced in this addon and those changes are later applied to original prefab.


Can Be Inherited From

A new resource can inherit from an existing file:

Example: Inherited version of ArsenalConfig_BLUEFOR.conf is created via Create Inherited File or Inherit in "Addon1" option. This new file has unique ID and inherits all data from its parent.


Moddability table

Extension File Type Can be replaced Can be modified Can be inherited from

.et

Prefab Warning[1] Checked Checked

.conf

Config Warning[1] Checked Checked

.xob

Model Checked Unchecked Unchecked

.emat

Material Definition Warning[1] Checked Checked

.edds

Enfusion DDS Texture Checked Unchecked Unchecked

.c

Enforce Script Source Warning[2] Warning[3] Checked

.layout

Layout Definition Warning[1] Checked Checked
.ptc Particle System Definition Warning[1] Checked Unchecked

.ent

World Scene Checked Unchecked Unchecked

.layer

World Layer Unchecked Unchecked Unchecked

.bt

Behavior tree Checked Warning[4] Unchecked

.anm

Animation file Checked Unchecked Unchecked

.agf

Animation graph file Checked Unchecked Unchecked

.agr

Animation graph Checked Checked Unchecked

.aw

Animation Workspace Checked Unchecked Unchecked

.asi

Animation Set Template Checked Unchecked Unchecked

.pap

Procedural Animation Checked Unchecked Unchecked

.siga

Procedural Animation Signal Checked Unchecked Unchecked

.st

String Table Checked Unchecked Unchecked

.acp

Audio component Checked Unchecked Unchecked

.sig

Signal (Audio) Checked Unchecked Unchecked

.wav

Supported audio file format Checked Unchecked Unchecked

Footnotes

  1. 1.0 1.1 1.2 1.3 1.4 Following assets are always overridden and cannot be fully replaced
  2. Script files are fully replaced if script in other addon (filesystem) has same path as the one which is supposed to be replaced. For example AIAutotest.c located in $ArmaReforger:scripts\Game\AI\ will be replaced by variant from Addon1 if it is placed in same location and same name in Addon1 file system - $Addon1:scripts\Game\AI\ AIAutotest.c
  3. Usage of modded keyword is required + few other restrictions apply like method in class must not be private in order to allow overloading it
  4. Behavior trees attempts to override each other, instead of replace


Data manipulation

Basics

In principle, any file with meta file and unique GUID - global unique identifier - can be be overridden or replaced . This means however, that files without meta file have to be modified in different way (scripts ) or cannot be replaced at all.

That means that for instance models, textures, layout, prefabs, configs or animations can be replaced using this method.

When replacing assets, engine cares only about GUID - that means neither file name or location doesn't have to be same as source file.

Creating overrides, duplicates or inherited files can be performed from context menu which is available in Resource Browser. This menu is visible after clicking with Right Mouse Button on selected asset. Availability of the actions depends on the type of the assets, so for instance models (XOBs) have only Navigate to ... options.

armareforger-data-modding-context-menu.png
Override Replacement Duplicate Inherit
Description Override creates a new file which shares same GUID as original asset. This action allows to selectively replaces or add new elements to selected asset.

For instance it is possible to change value

It is not possible to remove elements from the overridden asset this way.

This action can be performed by selecting "Override in '...'" action from the Addons menu.

Replacement, as name suggest, completely replace original file with the new file.

armareforger-data-modding-resource-variant.png In Particle Editor, it is possible to use "Create variant for '...' addon..." action but beside that, in all other cases it user has to create duplicates on his own by ensuring that replacing file has same GUID as original one.

This can be done by either copy pasting meta file (if we have access to it) or changing GUID of asset in text editor, so it matches the original file GUID.

Prefabs, configs and layouts cannot be replaced - they will be always in override mode.

Duplication creates a new file, with new, unique GUID. Duplicated file contains all the data from the original file (including inheritance) but doesn't modify in any way original file.

This action can be performed by selecting "Duplicate in '...'" action from the Addons menu.

Inherit action creates a new child file which inherits all the data from the parent.

This action can be performed by selecting "Inherit in '...'" action from the Addons menu.

Inheritance of prefabs can be only performed in Resource Browser attached to World Editor

Where it can be used Prefabs, configs, materials and layouts Sounds, models, textures, animations, particle effects, world files or behavior trees Prefabs, configs, materials or layouts Prefabs*, configs or layouts


When using CLI parameter to load addons, working addon is equal to the last addon listed in addons list.

Example:

-addons addon2, addon1, NewAddon

In above example NewAddon is current work addon


Overriding assets

Using "Override in..." function

"Override to..." function can be used to modify (override) existing assets like configs, layouyts or prefabs.

armareforger-data-modding-override-action.gif
Override to "..." option is available only for prefabs, layouts or configs. If there is already override in working addon, this option will be missing from the context menu. After this option is clicked, Resource Browser will create new overridden file in working addon (retaining original folder structure) and then navigate to overridden instance of selected asset.

Using "Navigate to..." function

Once you have file in addon which is overriding some data, you can quickly navigate

Navigate to Original

armareforger-data-modding-navigate-original-action.gif
Navigate to Original button is available in file context menu only if selected file overridden or replaced in some addon. If selected asset is not overridden in any currently loaded addon then this option will appear greyed out. After this option is clicked, Resource Browser will navigate to original instance of selected asset.

Navigate to Override

armareforger-data-modding-navigate-override-action.gif
Navigate to Override button is available in file context menu only if selected file overridden or replaced in some addon. If selected asset is not overridden in any currently loaded addon then this option will appear greyed out.

After clicking that option, Resource Browser will navigate to the first overridden instance of selected asset.

In scenario where multiple addons are present and they are overriding same file, Navigate to Override can be used multiple times until last override is reached.

Navigate to Ancestor

armareforger-data-modding-navigate-ancestor-action.gif
Navigate to Ancestor button is available in file context menu only if selected file overridden or replaced in some addon. If selected asset is not overridden in any currently loaded addon then this option will appear greyed out.

After clicking that option, Resource Browser will navigate to the first ancestor of overridden instance of selected asset.

In the scenario where multiple addons are present and they are overriding the same file, Navigate to Override can be used multiple times until the last override is reached.

Scripts

In Enfusion it's possible to modify already existing scripts by using some of special keyword

  • modded - keyword used to modify existing scripting class
  • override - keyword to override methods in modded classes
  • super - allows you to invoke content of overridden method

Modded keyword

modded class SCR_PlayerScoreInfo { }

Override keyword

modded class SCR_ScoringSystemComponent : SCR_BaseGameModeComponent { override void AddSuicide(int playerID) { { } }

Super keyword

modded class SCR_ScoringSystemComponent : SCR_BaseGameModeComponent { override void AddSuicide(int playerID) { super.AddSuicide(playerID); // Your example code below AudioSystem.PlaySound("{9BB653FF9E065943}Sounds/Animals/Bos_Taurus/Samples/bawl/bawl_0.wav"); } }

Using "Duplicate to..." function

In Resource Browser you can quickly create new, duplicated file in project you are currently working on. This file is exact copy of original file and will be used from that point when any part of the game will try use asset with this GUID. Any changes that you are going to do to that file are going to be applied applied to that copy are not going to be propagated to it.

armareforger-data-modding-duplicate-action.gif
Duplicate to "..." option is available only for prefabs, layouts or configs. After this option is clicked, Resource Browser will create new duplicated file - with name selected by the user - in working addon (retaining original folder structure) and then navigate to that duplicate.


Inheriting

Using "Inherit in..." function

Inheriting from the prefabs, config files or layouts can be performed via "Inherit in..." function. After clicking with Right Mouse Button on appropriate file and then selecting Inherit in function, a new pop up window will appear asking for a new file name. Once name is confirmed, a new file will be created in working addon with same folder structure as original file. As expected, all of the attributes will be inherited from parent file.

armareforger-data-modding-inheriting.png

Using "Transfer to..." function

Transfer to function is a functionality for moving data & merging partially overridden files (like prefabs or configs) from current working addon to parent addon. Parent addon need to be unpacked in order to have this functionality working.

Warning - currently this functionality is hardcoded to ArmaReforger addon which makes it unusable for modders.

Replacing assets

Replacing assets means that i.e. AK-74 model can be with a simple gray box and all prefabs which are referencing that AK-74 are going to use that new gray box from now. Such replacement can be performed with sounds, models, textures, animations, particle effects, world files or behavior trees.

armareforger-data-modding-resource-variant.png

In Particle Editor replacement can be performed quite easily by using "Create variant for "..." addon..." function. This action creates new ptc file with same GUID and content as original file.

Extreme caution is advised when doing such replacement - tinkering with Workbench generated files in text editor might break those files if you don't know what you are doing

In all other cases, replacing files is slightly more complicated and requires operations outside of Workbench.

Getting file GUID

armareforger-data-modding-getting-guid.png

First step towards creating such replacement would be obtaining GUID - this can be done via Copy Resource GUID(s) action, available in context menu after clicking on file with Right Mouse Button.

Once GUID is obtained, it can be manually typed into meta file of some newly created model. After that action is completed, restart of the Workbench might be necessary.

Replacing script

Scripts can be replace each other simply when they are in same relative location with same name.

For instance, to replace PickupAction.c located in base ArmaReforger data, you would need to create a new script in your addon in same location and with exact name.

MyAddon\scripts\Game\UserActions\PickupAction.c


If multiple addons are trying to replace same file, then the last one in the loading chain will be used.