Action Editor - voxraygames/worldbuilding GitHub Wiki

See also: Quest markers

To start editing actions, first add game entities to the world that these actions are to be used with, in particular NPCs and a "player start" entity. These entities have an "action" identifier that you will use to attach actions. You can have multiple NPCs with the same action identifier: this will cause them all to have the same shared dialogue.

For the NPCs you can use any idea that make sense to you, but for the player start, use the player_spawn action id:

screenshot-2023-06-12-11-30-09

The action editor has a list of "hosts" in the top left (things that may contain actions, attached to NPCs etc) that is initially empty. Click on Add to get a lit of templates to use. Besides Empty (if you already know what you want), there are ones that are pre-populated for use as player spawn, quest, or workbench craftables. Add these to your list as you see fit. Then select a host, and make sure it contains the same id as you used in the entity.

screenshot-2023-06-27-13-14-20

Each host contains a list of actions, which you can fill in next. Similar to hosts, the list of actions has Add and Delete buttons below it. Select an action to get an action editor window to the right. Each action has:

  • An ID, which in this case is used if you want to refer to this action from other actions.
  • A prompt, which is typically what the player says to initiate the action.
  • A Response, the reply from the NPC, you almost always want to set this but can be empty.
  • A summary of the response, which will be shown on the HUD if this is the start of a quest.
  • "Available" is checked if this action is initially available when the player encounters the NPC. If it is unchecked, it means this action will become available as a consequence of some prior action.
  • "Repeatable" means the action stays available after having been triggered once, which is typically not the case. May be useful to implement specialized shop/machine mechanics.
  • "Initiate by" is how this action is initiated by the player. Typically that is by clicking the button in dialog, but you can also have actions that initiate on level load, or when the player approaches, interacts, or completes objectives in the world.
  • "Give XP" for doing this action.
  • Require items, which will check if the player has these items, and remove them from their inventory when the action is triggered. The action will cannot be started if the player doesn't have the items.
  • "Require where" to specify if they are expected in the player inventory or elsewhere.
  • "Require world change" for kill monster quests etc.
  • Give Items: a list of items to give to the player. Load these items in the editor inventory (using e), then back in the action editor use the "Add Item from current inventory slot".
  • Activate Next Action, which when left with blank ids, will activate the next action in the list. Optionally, you can use the id fields to specify an action that is not the next in the list, allowing for more complex quest structures, and even activating new quests with different NPCs. If you do not want this to activate any action, put - in the first field.

The host with id player_spawn is is an action where "Initiate By" has been set to "Level Start", and this same id has been used in a player spawn entity. You can use the "Give Items" to give the player starting items, and "Response" to give the player an intro text.

All the "craftable" hosts allow the level designer to customize what is available for crafting at each bench (by editing the Craftable/Vendor Items list). It is a good idea to add the default templates to your host list for a new level if you intend to have workbenches in it. Note these hosts have ids starting with workbench_, and similarly the corresponding workbench models have those ids in their interact metadata property. It must have this id prefix to use the crafting UI instead of a dialog UI.

Similar to workbenches, there are presets for vendors that you can add and change. These too have a required prefix vendor_ and will give a shopping specific UI. It is possible to make a host BOTH have dialog and also be a vendor. Simply make sure both the host name and the action that specifies the shoppable items starts with the same vendor_ id, then add other actions for dialog (and be sure to mark one of them as available). Interacting with this host will start with the available dialog, but also provide a Shop button to start the shop UI. If the host has no available dialog actions they'll launch directly into the shop upon interaction. Best to place the vendor_ action first so dialog doesn't accidentally go into it.

Note that if you add "procedural" item like a gun to a workbench as a craftable, the player will be able to craft it only with exactly the attributes you specify, so pick attributes that make sense, and/or provide multiple such items.

See also Model Metadata on how to specify from what something gets crafted.