Creating Events - Dungeons-of-Kathallion/Bane-Of-Wargs GitHub Wiki

Table Of Contents

Introduction

Events are a key part of Bane Of Wargs. They're used to make the plot progress and enable missions and dialogs to have more possibilities. Events are located in the data/events.yaml data file. You can find many examples of events here. Events are invisible from the player, unlike missions, but they do affect the player and the game as much as them. The goal of events is to trigger specifics actions, only if the player meets all the required conditions: for example, only if the player is at a specific map zone or at a specific date.

Events are often used within missions, to make it progress and also make it more complex. Events can have two state: offered or done. Note that some events can be triggered at an infinite amount and others an unique time.

Test Event:
  repeat: False
  source:
    map zone:
    - Badlands
    - Gerud Desert Valleys
    date: 09-04-1192
  actions:
    run dialog: "Test Dialog"

This event will be triggered if the player is present in the map zone "Badlands" or "Gerud Desert Valleys", at any time of the date of 4th September, year 1192. When triggered, it'll run the dialog "Test Dialog". Events can become very complex and you'll see on the game vanilla data that events and missions work together and are dependent to each others in the plot. Here's a full definition of an event.

<event id>:
  repeat: <true | false(bool)>
  source:  # the more you have keys, the more checks there are
    map point: <map point ids(list)>
    map zone: <map zone ids(list)>
    region: <map zone types(list)>
    date: <MM-DD-YY(str)>
    player attributes: <custom attributes(list)>
    has items: <items id(list)>
    has missions offered: <missions id(list)>
    has missions active: <missions id(list)>
    random: <percentage(float)>
  actions:
    fail mission: <mission ids(list)>
    run dialog: <dialog id(str)>
    add attributes: <custom attributes(list)>
    give item: <item ids(list)>
    remove item: <item ids(list)>
    player health: <health change(int)>
    player max health: <health change(int)>
    player gold: <gold change(float)>
    player exp: <exp change(float)>
    enemy spawn: <enemy pool list(str)>
    use drink: <drink ids(list)>
    add to diary:
      known zones: <map zones id(list)>
      known enemies: <enemies id(list)>
      known npcs: <npcs id(list)>
    remove to diary:
      known zones: <map zones id(list)>
      known enemies: <enemies id(list)>
      known npcs: <npcs id(list)>
    run scripts:
      - script 0:
        arguments: <arguments(list)>
        script name: <script in scripts dir(str)>
      - script 1:
      [...]

Basic Events Characteristics

The event must be unique. Each event has an identifier, and no event should have the same. While triggering or running checks on events, events are stored in alphabetical order (more specifically, ASCII lexical ordering), meaning that the events that have the same conditions will be triggered by alphabetical order.

repeat: <true| false(bool)>

This parameter determines if the defined event can be triggered multiple times at an infinite amount, or triggered once in the player's journey. But you can specify how many time it can be repeated.

source:
  map point: <map point ids(list)>
  map zone: <map zone ids(list)>
  region: <map zone types(list)>
  date: <MM-DD-YY(str)>
  player attributes: <custom attributes(list)>
  has items: <items id(list)>
  has missions offered: <missions id(list)>
  has missions active: <missions id(list)>
  random: <percentage(float)>

This dictionary contains the conditions that are required to be met in order of the event to be triggered. You can have every of the condition types at the same time or neither, or a few of them, or a single one, it's up to you!

  • map point // here you will list every map point digit that are good for the player to be on in order for the event to be triggered.
  • map zone // here you will list every map zone id that are good for the player to be on in order for the event to be triggered.
  • region // here you will list every map zone type that are good for the player to be on in order for the event to be triggered.
  • date // the date that the player must be on in order for the event to be triggered using the US format: <month>-<day>-<year>.
  • player attributes // the list of custom attributes that the player must have in order to trigger the mission.
  • has items // the list of items id the player's inventory must contain in order to trigger the event.
  • has missions offered // the list of missions id the player must have been offered in order to trigger the event.
  • has missions active // the list of missions id the player must have active in order to trigger the event.
  • random // the percentage of chance added for the event to be triggered, if all other conditions are good.
actions:
  fail mission: <mission ids(list)>
  run dialog: <dialog id(str)>
  player health: <health change(int)>
  player max health: <health change(int)>
  player gold: <gold change(float)>
  player exp: <exp change(float)>
  enemy spawn: <enemy pool list(str)>

Events actions are basically the same as dialogs actions, but events have some more actions that are possible to have:

  • fail mission // here you will list every missions id that will get failed if the event gets triggered. Note that if you specify a mission that the player doesn't have, it'll just skip it. Also note that the 'to fail' conditions of the mission won't be ran, but the 'on fail' triggers will.
  • run dialog // here you will enter a dialog id to run when the event gets triggered.
  • player health // here you will enter the player's health modification to run when the event gets triggered. Use positive values for additions and negative values for subtractions.
  • player max health // here you will enter the player's max health modification to run when the event gets triggered. Use positive values for additions and negative values for subtractions.
  • player gold // here you will enter the player's gold modification to run when the event gets triggered. Use positive values for additions and negative values for subtractions.
  • player exp // here you will enter the player's experience points# modification to run when the event gets triggered. Use positive values for additions and negative values for subtractions.
  • enemy spawn // here you will enter an enemy pool list to be spawned when the event gets triggered.

Characteristics Shared With Dialogs

actions:
  add attributes: <custom attributes(list)>
  give item: <item ids(list)>
  remove item: <item ids(list)>
  use drink: <drink ids(list)>
  add to diary:
    known zones: <map zones id(list)>
    known enemies: <enemies id(list)>
    known npcs: <npcs id(list)>
  remove to diary:
    known zones: <map zones id(list)>
    known enemies: <enemies id(list)>
    known npcs: <npcs id(list)>
  run scripts:
    - script 0:
      arguments: <arguments(list)>
      script name: <script in scripts dir(str)>
    - script 1:
    [...]

As you might have noticed, event actions share many common characteristics:

  • add attributes // Here you will list all the custom attributes that'll be added the player if this event gets triggered.
  • give item // Here you will list all items that will be given to the player. Note that if the player doesn't have enough inventory slots, the items will still be given.
  • remove item // Here you will list all items that should be removed from the player inventory if the player has one or more in his inventory. Note that if the player doesn't own some of these items, it'll skip them.
  • use drink // Here you will list all drinks the player will consume. It does the same action that when you buy a drink at an hostel or an npc.
  • add to diary:
    • known zones // Here you will list all zones to be added to the player diary.
    • known enemies // Here you will list all enemies to be added to the player diary.
    • known npcs // Here you will list all npcs to be added to the player diary.
  • remove to diary:
    • known zones // Here you will list all zones to be removed from the player diary. Note that if the player doesn't already have some of these in its knowledge, it'll skip them.
    • known enemies // Here you will list all enemies to be removed from the player diary. Note that if the player doesn't already have some of these in its knowledge, it'll skip them.
    • known npcs // Here you will list all npcs to be removed from the player diary. Note that if the player doesn't already have some of these in its knowledge, it'll skip them.
  • run scripts // here you'll enter the list of dictionaries that'll be used to run custom scripts, which are located in the script/ directory.
    • script <digit> // digit can go from 1 to 120.
      • arguments // here you'll enter the list of arguments, which are game re-usable variables. Don't put this key if your script doesn't require any arguments.
      • script name // the name of the script file, which's in the script/ directory. Find a full guide on custom scripting here.
⚠️ **GitHub.com Fallback** ⚠️