-
Notifications
You must be signed in to change notification settings - Fork 5
Modifying Existing Content
Trainworks Reloaded provides limited support for modifying existing game content.
The following content types can be modified directly through the framework:
- Cards
- CardUpgrades
- Challenges
- Characters
- Clans
- Relics of all types
- Scenarios
Content types not included in this list cannot be modified directly.
To modify an existing item, you must use its internal ID as the id in your JSON definition.
For example, the internal ID of Firestarter is:
StarterFireStarter
The default Mod Template includes an example that modifies this card.
The following definition replaces several properties on Firestarter:
{
"$schema": "https://github.com/Monster-Train-2-Modding-Group/Trainworks-Reloaded/releases/latest/download/schema.json",
"cards": [
{
"id": "StarterFireStarter",
"override": "replace",
"cost": 0,
"names": {
"english": "Gas Cannister",
"chinese": "气罐",
"french": "Le Starter of Fire"
},
"descriptions": {
"english": "Deal [effect0.power] damage",
"chinese": "造成 [effect0.power] 点伤害。",
"french": "Inflige <nobr>[effect0.power] DGT</nobr>"
},
"card_art": "@Gasoline",
"effects": ["@DealFiveDamage"],
"traits": ["@Consume"]
}
],
"sprites": [
{
"id": "Gasoline",
"path": "textures/card_art/gas.png"
}
],
"game_objects": [
{
"id": "Gasoline",
"type": "card_art",
"extensions": {
"card_art": {
"sprite": "@Gasoline"
}
}
}
],
"effects": [
{
"id": "DealFiveDamage",
"name": "CardEffectDamage",
"target_mode": "drop_target_character",
"target_team": "both",
"param_int": 5
}
]
}Only the properties included in the JSON are changed. Properties that are not specified retain their original values.
For example, this definition does not specify Firestarter's rarity or clan, so those properties remain unchanged.
The override property tells Trainworks Reloaded how to apply the values in your JSON definition to the existing item.
Two modes are supported:
"override": "replace"
In replace mode, every property specified in the JSON replaces the original value of that property.
For list properties such as effects and traits, the original list is replaced by the new list.
Properties omitted from the JSON are left unchanged.
"override": "append"
In append mode:
- Values specified for list properties are appended to the existing list.
- Values specified for non-list properties replace the original value.
- Properties omitted from the JSON are left unchanged.
This distinction is most important for properties such as:
effectstraitssubtypes- Other properties represented by JSON arrays
Because the example uses:
"override": "replace"
it makes the following changes to Firestarter:
- Changes its cost from 1 Ember to 0 Ember.
- Changes its name from Firestarter to Gas Canister.
- Replaces its description.
- Replaces its original effects with a single effect that deals 5 damage.
- Replaces its traits with a list containing Consume.
- Replaces its card art with the
GasolineCard Art GameObject.
The original effects list is not preserved because replace mode replaces list properties in their entirety.
Suppose the card used:
"override": "append"
and its English description was changed to:
{
"descriptions": {
"english": "Deal [effect0.power] damage, then apply [pyregel] [effect1.status0.power]. Then deal another [effect2.power] damage."
}
}The resulting changes would be:
- The cost would change from 1 Ember to 0 Ember.
- The name would change from Firestarter to Gas Canister.
- The description would be replaced because
descriptionsis not a list property. - Consume would be appended to the card's existing traits.
-
DealFiveDamagewould be appended after the card's two original effects. - The card art would be replaced with the
GasolineCard Art GameObject.
The resulting effect order would be:
- Firestarter's first original effect.
- Firestarter's second original effect.
-
DealFiveDamage.
This ordering is important because effect placeholders such as [effect0.power], [effect1.status0.power], and [effect2.power] refer to effects by their position in the final list.
Important
append only appends values to list properties. It does not merge ordinary objects or localized text one field at a time. Non-list properties are replaced with the values supplied by the override.
The clone_id property creates a new item based on an existing item instead of modifying the original.
When cloning content:
-
idis the internal ID of the new item. -
clone_idis the internal ID of the existing item to copy. -
overridecontrols how the properties in the new definition are applied to the cloned data.
For example:
{
"id": "MyMod_GasCanister",
"clone_id": "StarterFireStarter",
"override": "replace",
"cost": 0,
"names": {
"english": "Gas Canister"
}
}This creates a new card named MyMod_GasCanister using Firestarter as its starting point. The original Firestarter card remains unchanged.
Any properties not specified in the clone definition are inherited from the original item.
Items not included in the supported list at the beginning of this page cannot be modified or cloned directly through the framework.
Unsupported types include:
- CardEffects
- CardUpgradeMasks
- RelicEffects
- Other lower-level definitions that are referenced by supported content
There are currently no plans to support overriding these types directly.
As a workaround, find the item that uses the unsupported definition and recreate the necessary data in your mod. The exported Monster Train 2 GameData repository contains the game's data in JSON format, making it easier to locate and copy the relevant definitions.
For example, instead of attempting to modify an existing CardEffect directly, you can:
- Find the original card in the exported GameData.
- Copy the effect's values into a new CardEffect definition in your mod.
- Modify the new effect as needed.
- Override the card's
effectsproperty so that it references your new effect.
This approach leaves the original CardEffect unchanged while allowing the supported parent item to use your customized version.