Scenario editing

From Of Life and Land Wiki
Jump to navigation Jump to search
EditorScenario.png

In the scenario file(s) (ScenarioDescription(*).json in your scenario folder) you can define all quests, events, story elements, progression states and the intro sequence.

Loader intro

You find the intro definition in: ScenarioDescription.json > LoaderIntro

In "Scene" you can select which intro scene logic should be used. Currently there is only "res://Data/UI/MainMenu/WorldLoader/Overlay/Kerzoven/KerzovenLoaderOverlay.tscn". The "Data" is passed to the scene.

KerzovenLoaderOverlay.tscn data entry
Entry key Type Description
Icon string (path to a texture.) Which icon to show next to the text box
Character string (path to a texture.) Which character or texture to show above the text box
Map string (path to a texture.) Which map or texture to show on the right side
Text string (path to a texture.) Which text to display (translatable)

Scenario state

You find the intro definition in: ScenarioDescription.json > ScenarioState

"Active" contains an array of currently active quest keys.

Fill this with quests you want to have active at game start (tutorial? main scenario? timers? etc.)

Scenarios

You find the intro definition in: ScenarioDescription.json > Scenarios OR in any ScenarioDescription***.json file (*** can be anything).

All scenario entries in all files are combined to one data model. This way you can have a file for the main quest and another for story events and another for side quests etc.

Scenario entry
Entry key Type Description
Condition Condition entry Data for the trigger
Key string Identifier to be triggered by other results or conditions.
Result (optional) array of result entries What happens if the condition is fulfilled.
OnFailed (optional) array of result entries What happens if the condition is failed.
Visibility string (enum flags) Sets visibility flags for QuestLog (shows in the journal quest log) and or MainTask (shows in the box on the right side).

Conditions

Almost all conditions require a "Title", "Text" and a "Description". Depending on the settings, they are shown in the quest journal and on the right quest tracker. Almost all condition support an optional priority to be listed higher in the small quest window on the right side.

Placement of the "Title", "Text" and a "Description"
Condition types
#EndGamePause
#CheckDay
#ConstructBuilding
#DemoEnd
#TaskCollection
#UnlockDiplomacy
#DiscoverRegion
#CreateItem
#AcceptTask
#ReallocationTask
#StateExpression


EndGamePause

True if the game is not paused

Entry key Type Description
Title string Which text to display (translatable)
Text string Which text to display (translatable)
Description string Which text to display (translatable)
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.


CheckDay

True if the specified day has been reached.

Entry key Type Description
Title string Which text to display (translatable). You get an optional String.Format {0} argument with the days left. "Wait {0} days."
Text string Which text to display (translatable). You get an optional String.Format {0} argument with the days left. "Wait {0} days."
Description string Which text to display (translatable). You get an optional String.Format {0} argument with the days left. "Wait {0} days."
Image (optional) string (texture path) Image shown next to the "Text"
Day number Fixed day to reach. To use relative time points, set this to a negative number and provide RelativeDays.
RelativeDays (optional) number If Day is a negative number: How many days to reach after the entry got activated.

For example if Day is -1 and RelativeDays is 1 and the entry is activated the first time at day 17, it will trigger in day 18.

FailsOnCondition (optional) boolean If set to true, this condition will fail the quest when the day was reached.
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.

ConstructBuilding

True if one of the given buildings was built by the player.

A TaskCollection with 3 ConstructBuilding subtasks shown as a MainTask."
Entry key Type Description
Text string Which text to display (translatable)
Image (optional) string (texture path) Image shown next to the "Text"
IDs array of numbers (building ID) which buildings are targeted. First one generates the text.
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.

DemoEnd

Never true. No data.


TaskCollection

True if all specified conditions are true.

Entry key Type Description
Title string Which text to display (translatable)
Text string Which text to display (translatable)
Description string Which text to display (translatable)
Image (optional) string (texture path) Image shown next to the "Text"
Condition array of Conditions Yes, this is recursive.
This way you can add as many conditions as you like.
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.

UnlockDiplomacy

True if the player unlocked the given right

Entry key Type Description
DiplomacyRight string (diplomacy right) Which right needs to be unlocked
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.


DiscoverRegion

True if the player discovered the given region.

Entry key Type Description
Map string (map file name) The map to discover. For example Tablelands.bin
RegionHint (optional) string (is translated) Helps to hint which region to discover: "Discover Tablelands (Desert)" where Desert is the translated RegionHint.
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.

CreateItem

A TaskCollection with two subtasks: ConstructBuilding and CreateItem.

True if the player created the given amount of items since this quest is active.

Entry key Type Description
Text string Which text to display (translatable)
Image (optional) string (texture path) Image shown next to the "Text"
ItemID Number Item ID to create
ItemCount Number How many items need to be created
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.

AcceptTask

True if the player accepted this task.

Entry key Type Description
TaskTitle string Which text to display (translatable)
TaskText string Which text to display (translatable)
Description string Which text to display (translatable)
Rejectable (optional) boolean Set this to true if this task can be rejected. This will fail the task.
Image (optional) string (texture path) Image shown next to the "Text"
Question (optional) string Text shown above the accept button
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.


ReallocationTask

True if the player delivered the material.

Entry key Type Description
Title string Which text to display (translatable)
Text string Which text to display (translatable)
Description string Which text to display (translatable)
Image (optional) string (texture path) Image shown next to the "Text"
Entries array of reallocations Reallocation data
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.

Reallocation entry (items)

Used to reallocate items (move items to the community centre to solve this task)

Entry key Type Description
ID integer constant 0 for items
ItemId integer Item ID to reallocate (see Items)
StepsDone integer 0 default / scenario starting point. This is later overwritten by the engine
TotalSteps integer How many items should be reallocated?

Reallocation entry (time)

Used to work at the community centre (required, community activity)

Entry key Type Description
ID integer constant 2 for time
StepsDone integer 0 default / scenario starting point. This is later overwritten by the engine
TotalSteps integer How much work must be done? 1 step is about 30 simulated minutes

StateExpression

True if the expression results in true.

Entry key Type Description
Title (optional) string Which text to display (translatable)
Text (optional) string Which text to display (translatable)
Description (optional) string Which text to display (translatable)
Image (optional) string (texture path) Image shown next to the "Text"
FailsOnCondition (optional) boolean If the expression results in true, this condition fails instead of resulting in done.
Expression ST expression expression to check.
Priority (optional) number low numbers have high priority, high numbers low priority. 0 is the default. Defines the order in the right small quest box.

Results

All entries in "Result" are triggered right after each other.

Condition types
#EventEntry
#PlaySound
#ActivateEntry
#ModifyImmigrants
#ForceImmigration
#ScenarioAchievement
#AssignmentExpression
#ModifyGold
#ItemReward
#ApplyDynamicEffect
#CustomRain
#CustomTemperature


EventEntry

Adds a event entry to the event list

Entry key Type Description
EventType string (enum) Defines in which areas it is shown (Story, Warning, Decision)
Title string Which title to display (translatable)
Text string Which text to display (translatable)
Subtext (optional) string Which additional text to display (translatable)
Image string (texture path) Image shown next to the "Text"
AsPopup boolean true will open the event window as a popup
IsNew boolean Set by the game. False if the player has read the event


PlaySound

Plays a predefined sound from the Shorts or Clicks list.

Entry key Type Description
Sound string (enum Shorts or Clicks) Sound file to play by enum


ActivateEntry

Activates another entry with the given key

Entry key Type Description
Entry string Which entry to activate


ModifyImmigrants

Adds the given number to the event immigration calculation

Entry key Type Description
Modification Number Adds to the event immigration


ForceImmigration

Directly adds a new person or animal to the game to players faction.

Entry key Type Description
DaysAlive (optional) Number How many days the new person has been alive. Instance default if not given.
DynamicID (optional) Number ID to spawn. Default human if not given.

ScenarioAchievement

Unlocks a scenario achievement with the given key.

Entry key Type Description
Key string Unlocks a scenario achievement type


AssignmentExpression

Assigngs a value or a boolean according to the given expression.

Entry key Type Description
Expression ST expression The assignment to execute.


ModifyGold

Used to give or remove Gold from the player.

Entry key Type Description
Amount integer How much gold to add or remove.


ItemReward

Used to give a item to the player. It is added to a community centre. If none exists, the reward is lost.

Entry key Type Description
ItemID integer Which item you want to reward the player.
Count integer How man y items you want to add.


ApplyDynamicEffect

Applies an effect to the defined dynamic objects (buff / debuff)

Entry key Type Description
EffectID (optional) integer Effect ID to apply. Default is Joyful.
FrameDuration (optional) integer Number of simulation frames this effect is active. Default is 1 day (144000).
Map (optional) string Map file name to apply the buff. If no map is given the effect is applied to all maps.
Targets (optional) integer array (Animals id) Applies the buff to all targets with the given IDs. Default is [ 9 ], humans only.


CustomRain

Changes the rain pattern of a map to a new one, or resets it to map default.

Entry key Type Description
Map string Map file name to modify.
Data (optional) integer array ([28], one for each day per year) The amount or rain per 0.1l x 40 x number per day per tile (4l x number per day).

"4" is already a good amount of water every few days. "8" can create local floods depending on the soil, river-ways and plants. Have a look at the existing rain patterns in the editor to get a feel for which climate / map needs how much water.

If data is not given, the map rain will fall back to the default map rain (set in the map editor)


CustomTemperature

Changes the temperature generator data of a map to a new one, or resets it to map default.

Entry key Type Description
Map string Map file name to modify.
Data (optional) float array ([4], generator arguments) Arguments for the environment temperature generator of the map.

In the world editor you can play around with the values and see graphically how the environment temperature is generated in a year. Have a look at the existing temperature generator arguments in the editor to get a feel for which climate / map needs what environment temperature.

If data is not given, the generator will fall back to the default map generator arguments (set in the map editor)