Generic encounters

Let's take a look at the available encounter types and their associated properties. Their controllers can be found in stonehearth/services/server/game_master/controllers/encounters.

Wait encounters

Wait

An encounter that waits for the specified length of game time before triggering its out edges.

Wait for time of day

An encounter that waits until a given game time of day before triggering its out edges.

Wait for event

An encounter that waits for an event on an entity (or entitites) before triggering its out edges.

Wait for net worth

An encounter that waits for the player to reach a specified net worth before triggering its out edges.

Wait for requirements met

An encounter that waits until a set of requirements is satisfied before triggering its out edges.

Gate encounters

Generator

A generator that triggers edges after a delay, optionally repeating in a loop.

Item threshold

An encounter that waits until a threshold is satisfied before triggering its out edges. The threshold will be compared with the item count from the player's storages, as long as those items match certain materials or URIs.

Flag encounters

Counter

An encounter that counts the number of times it runs and saves this information in the user-specified ctx.ctx_registration_variable.

If it manages to run X times, it produces its success out edge. Otherwise, it produces its failure out edge. Both are specified in the out_edges field in the "counter_info".

Set counters

Updates the values of campaign-wide counters which are used for gating encounters via the "counter" can_start check.

icon Don't confuse these counters with the "counter" encounter. They have different purposes.

Utility encounters

Destroy entity

An encounter that destroys specific entities.

Script

An encounter that does nothing but run the associated script (which is created as a controller).

Dialog encounters

Bulletin

An encounter that displays a notification bulletin.

Dialog Tree

An encounter that displays a dialog tree whose choices eventually lead to potentially different out edges.

Shop

An encounter that displays a shop menu with a given set of items for sale.

Delivery quest

An encounter that represents a persistent quest notification that can be completed or abandoned.

Collection quest

An encounter that shows a dialog asking for items.

Reward encounters

Donation dialog

An encounter that generates items and give them to the player via a dialog.

Donation

An encounter that generates items and drops them by the player's camp standard. If you want to have also some dialog for informing the player, you might want to use the donation dialog encounter instead.

Unlock recipe

An encounter that unlocks recipes for the player.

Town progression encounters

Town upgrade choice

An encounter that shows a dialog to choose a town upgrade and optionally the town's name.

Town upgrade

An encounter that grants a town bonus and/or replaces the banner or hearth. The hearthlings (and optionally some NPCs) will gather around the item to upgrade, it will be changed (granting the town bonus), the town tier will increase, and then the hearthlings and NPCs will celebrate for a while (using the "celebration" track from their sound constants). NPCs will depart and despawn once the celebration ends.

Most of the fields are optional, so this can also be used to issue a celebration around an item.

City tier achieved

An encounter that shows a dialog celebrating the player's ascendance to a new tier of city.

This encounter type was used before celebrations were implemented in the game. So in practice, it does more or less the same than the town upgrade encounter. Here, a notification will open a normal dialog message first, and when the player proceeds, the city tier success dialog will appear.

City tier quest

An encounter that shows the requirements needed to get to the next level of city tier. The notification persists in the bulletin list until one of the sets is satisfied. Button to check requirements, if met, will call the herald back immediately and triggers new out edge. If the herald automatically detects that the set is satisfied, the notification goes away.

This is the old implementation of the tier upgrade quest, where 3 possible paths/requirement sets are presented in the same window, so that the player can try to fulfill any of them at any given moment.

Citizen encounters

Add citizen

Adds a new citizen to the town, either of the player's population or of another race/faction. They will spawn close to the town and will walk to the banner first.

icon Mind that once added to the player's town, you won't be able to retrieve the original population of the citizen by code. They will be considered to have the same population/faction than the player's town, even if their appearance is different (e.g. rabbits, orcs).

Reembarkation

An encounter to generate an embarkation crew composed of up to 3 citizens and up to 10 items to reuse in a new game (if the player chooses a town progression item, it will carry the town bonus with it).

It will also include unlocked crops (for the "stonehearth:jobs:farmer" job) and unlocked crafting recipes from any crafting job, but these have conditions to be unlocked in new games (if you choose a reembarkation crew from a different kingdom, the recipes must already exist in the current kingdom's recipe indexes and the job URI of the crafter must also match, otherwise they can't be unlocked).

The citizens will keep their job, level and equipment, but beware that embarking with high level combat units might increase the combat difficulty on early game.

The reembarkation can be postponed (kept in the bulletin list or not), but once the player has clicked on "Depart", the crew will be saved to a file and a celebration around the banner will begin. When the celebration ends the selected citizens will depart the town forever and the selected items will also disappear from inventory. Players can always go back to a previous savefile if they don't want those citizens to depart.

Dispatch quest

An encounter that represents a quest to dispatch a citizen out of the town for some duration.

Raid encounters

Create camp

An encounter that creates an NPC camp made up of mobs and / or items.

Create mission

An encounter that starts a mission undertaken by NPCs. E.g. wandering around or pillaging.

City raid

A raid, which is just a group of missions started at the same time at the previous enemy location (set by a create camp encounter or a create mission encounter). Unlike the create mission encounter, this encounter does not do a search for a place to spawn the encounter.