-
Notifications
You must be signed in to change notification settings - Fork 3
Yaml Anchors
Yaml anchors are a feature of the YAML language. They allow us to create dictionaries with default values than be re-used while creating new dictionaries, so we don't repeat same code over and over. This is particularly used while creating upgrade-able weapons items. But it can also be used in other cases like map zones or map points.
You can create an anchor by doing this:
generic weapon: &generic_weapon
display name: "Generic Weapon"
gold: 8.7
[...]
By doing this, it will create a new key called 'generic weapon', but it will also create an anchor named 'generic_weapon'. You can after re-use this template by creating a new dictionary key like this:
generic weapon upgrade 2:
<<: *generic_weapon
new attribute: "this is a new attribute"
[...]
Now like this, the 'generic weapon upgrade 2' key will have a key 'new attribute' but it will also inherit the 'generic_weapon' anchor keys. So the 'generic weapon upgrade 2' dictionary actually looks like this for the parser:
generic_weapon_upgrade_2 = {
"new attributes": "this is a new attribute",
"display name": "Generic Weapon",
"gold": 8.7
}
- Running The Game
- Gameplay Guide
- GitHub Discussions
- Building Source Code
- Game Preferences
- The Game Folder
- The World Of Bane Of Wargs
- Game Timeline Plot
- Yaml Syntax
- Creating Mods
- Creating Starts
- Creating Map Points
- Creating Enemies
- Creating Enemies Categories
- Creating Map Zones
- Creating Items
- Creating Drinks
- Writing Dialogs
- Creating Missions
- Creating Events
- Creating NPCS
- Creating Mounts
Additional Knowledge