TODO: document the "npc" structure, used to load NPC template
Often you will want to create new NPCs to either add quests, flavor, or to introduce little known activities to the larger player base. New NPCs are written entirely in JSON, so they are one of the easier places to begin your contributions.
There are two parts to creating a new NPC, apart from any dialogue you may want to add.
First there is the npc_class
which follows the following template.
Format:
{
"type": "npc_class",
"id": "NC_EXAMPLE",
"name": { "str": "Example NPC" },
"job_description": "I'm helping you learn the game.",
"common": false,
"sells_belongings": false,
"bonus_str": { "rng": [ -4, 0 ] },
"bonus_dex": { "rng": [ -2, 0 ] },
"bonus_int": { "rng": [ 1, 5 ] },
"skills": [
{
"skill": "ALL",
"level": { "mul": [ { "one_in": 3 }, { "sum": [ { "dice": [ 2, 2 ] }, { "constant": -2 }, { "one_in": 4 } ] } ] }
}
],
"worn_override": "NC_EXAMPLE_worn",
"carry_override": "NC_EXAMPLE_carried",
"weapon_override": "NC_EXAMPLE_weapon",
"shopkeeper_item_group": [
{ "group": "example_shopkeeper_itemgroup1" },
{ "group": "example_shopkeeper_itemgroup2", "trust": 10 },
{ "group": "example_shopkeeper_itemgroup3", "trust": 20, "rigid": true }
{ "group": "example_shopkeeper_itemgroup3", "trust": 40, "strict": true },
{
"group": "example_shopkeeper_itemgroup4",
"condition": { "u_has_var": "VIP", "type": "general", "context": "examples", "value": "yes" }
}
],
"shopkeeper_consumption_rates": "basic_shop_rates",
"shopkeeper_price_rules": [
{ "item": "scrap", "fixed_price": 10000 },
]
"shopkeeper_blacklist": "test_blacklist",
"restock_interval": "6 days",
"traits": [ { "group": "BG_survival_story_EVACUEE" }, { "group": "NPC_starting_traits" }, { "group": "Appearance_demographics" } ]
}
There are a couple of items in the above template that may not be self explanatory:
"common": false
means that this NPC class will not spawn randomly. It defaults totrue
if not specified."sells_belongings": false
means that this NPC's worn or held items will strictly be excluded from their shopkeeper list; otherwise, they'll be happy to sell things like their pants. It defaults totrue
if not specified. *"shopkeeper_item_group"
is only needed if the planned NPC will be a shopkeeper with a revolving stock of items that change every three in-game days. All of the item overrides will ensure that any NPC of this class spawns with specific items."shopkeeper_consumption_rates"
optional to define item consumption rates for this shopkeeper. Default is to consume all items before restocking"shopkeeper_price_rules"
optional to define personal price rules with the same format as faction price rules (see FACTIONS.md). These take priority over faction rules"shopkeeper_blacklist"
optional to define blacklists for this shopkeeper"restock_interval"
: optional. Default is 6 days
"shopkeeper_item_group"
entries have the following fields:
"group"
: Identifies an item group to include in the possible shop rotation"trust"
: (optional) If the faction's trust with the player is below this value, items in this group will not be available for sale (Defaults to 0)"condition"
: (optional) Checked alongside trust with the avatar as alpha and the evaluating NPC as beta. See Player or NPC conditions."strict"
: (optional) If true, items in this group will not be available for restocking unless the conditions are met. (Defaults to false)"rigid"
: (optional) By default, item groups will be continually iterated until they reach a certain value or size threshold for the NPC. Rigid groups are instead guaranteed to populate a single time if they can, and will not include duplicate reruns. (Defaults to false)"refusal"
: (optional) message to display in UIs (ex: trade UI) when conditions are not met. Defaults to"<npcname> does not trust you enough"
There is a second template required for a new NPC. It looks like this: Format:
{
"type": "npc",
"id": "examplicious",
"//": "The luckiest NPC to never experience the Cataclysm.",
"name_suffix": "examplar",
"class": "NC_EXAMPLE",
"attitude": 0,
"mission": 7,
"chat": "TALK_EXAMPLE",
"faction": "no_faction",
"death_eocs": [ "EOC_DEATH_NPC_TEST" ]
}
This is the JSON that creates the NPC ID that is used to spawn an NPC in "mapgen" (map generation). Attitude is based on the enum in npc.h. The important ones are 0=NPCATT_NULL, 1=NPCATT_TALK", 3=NPCATT_FOLLOW, 7=NPCATT_DEFEND, 10=NPCATT_KILL, and 11=NPCATT_FLEE. Mission is based on the enum in npc.h. The important ones are 0=NPC_MISSION_NUL, 3=NPC_MISSION_SHOPKEEP", and 7=NPC_MISSION_GUARD", 8 = NPC_MISSION_GUARD_PATROL will actively investigate noises". Chat is covered in the dialogue examples below. Faction determines what faction, if any, the NPC belongs to. Some examples are the Free Traders, Old Guard, Marloss Evangelists, and Hell's raiders but could include a brand new faction you create! death_eocs are string effect_on_condition ids and or inline effect_on_conditions (see EFFECT_ON_CONDITION.md). When the npc dies all of these eocs are run with the victim as u and the killer as npc.
You can define the age and height of the NPC in the age
or height
fields in "type": "npc"
.
Field | Description |
---|---|
age |
NPC age |
height |
NPC height (cm) |
Dialogues work like state machines. They start with a certain topic (the NPC says something), the player character can then respond (choosing one of several responses), and that response sets the new talk topic. This goes on until the dialogue is finished, or the NPC turns hostile.
Note that it is perfectly fine to have a response that switches the topic back to itself.
NPC missions are controlled by a separate but related JSON structure and are documented in the missions docs.
Two topics are special:
TALK_DONE
ends the dialogue immediately.TALK_NONE
goes to the previously talked about topic.
If npc
has the follows fields, the game will display a dialogue with the indicated topic instead of default topic.
Field | Default topic ID | Uses for... |
---|---|---|
talk_friend |
TALK_FRIEND |
Talk to a follower NPC |
talk_radio |
TALK_RADIO |
Talk to a follower NPC with two way radios |
talk_leader |
TALK_LEADER |
Talk to an NPC that have 5=NPCATT_LEAD |
talk_stole_item |
TALK_STOLE_ITEM |
Talk to an NPC that have 18=NPCATT_RECOVER_GOODS |
talk_wake_up |
TALK_WAKE_UP |
Talk to a sleeping NPC |
talk_friend_guard |
TALK_FRIEND_GUARD |
Faction camp guard |
talk_mug |
TALK_MUG |
see "success and failure" section |
talk_stranger_aggressive |
TALK_STRANGER_AGGRESSIVE |
see "success and failure" section |
talk_stranger_scared |
TALK_STRANGER_SCARED |
see "success and failure" section |
talk_stranger_wary |
TALK_STRANGER_WARY |
see "success and failure" section |
talk_stranger_friendly |
TALK_STRANGER_FRIENDLY |
see "success and failure" section |
talk_stranger_neutral |
TALK_STRANGER_NEUTRAL |
see "success and failure" section |
NPCs have dialogue depending on the situation.
This dialogue can be customized in "type": "npc"
json entries.
If npc
has one of the following fields, the NPCs will speak the indicated message or snippet instead of the default message.
All messages can be used with snippets.
Any %s
included is automatically replaced by the game, with words depending on the message.
Case use example:
{
"type":"npc",
"...": "rest of fields go here",
"<acknowledged>": "I gotcha fam",
"<camp_food_thanks>": "<food_thanks_custom>"
},
{
"type":"snippet",
"category":"<food_thanks_custom>",
"text": [
"thanks for the grub",
"thanks for the food!",
"itadakimasu!"
]
}
For further information on snippets, see New Contributor Guide: Dialogue
Field | Default messages/snippets | Used for... |
---|---|---|
<acknowledged> |
<acknowledged> |
see data/json/npcs/talk_tags.json |
<camp_food_thanks> |
<camp_food_thanks> |
see data/json/npcs/talk_tags.json |
<camp_larder_empty> |
<camp_larder_empty> |
see data/json/npcs/talk_tags.json |
<camp_water_thanks> |
<camp_water_thanks> |
see data/json/npcs/talk_tags.json |
<cant_flee> |
<cant_flee> |
see data/json/npcs/talk_tags.json |
<close_distance> |
<close_distance> |
see data/json/npcs/talk_tags.json |
<combat_noise_warning> |
<combat_noise_warning> |
see data/json/npcs/talk_tags.json |
<danger_close_distance> |
<danger_close_distance> |
see data/json/npcs/talk_tags.json |
<done_mugging> |
<done_mugging> |
see data/json/npcs/talk_tags.json |
<far_distance> |
<far_distance> |
see data/json/npcs/talk_tags.json |
<fire_bad> |
<fire_bad> |
see data/json/npcs/talk_tags.json |
<fire_in_the_hole_h> |
<fire_in_the_hole_h> |
see data/json/npcs/talk_tags.json |
<fire_in_the_hole> |
<fire_in_the_hole> |
see data/json/npcs/talk_tags.json |
<general_danger_h> |
<general_danger_h> |
see data/json/npcs/talk_tags.json |
<general_danger> |
<general_danger> |
see data/json/npcs/talk_tags.json |
<heal_self> |
<heal_self> |
see data/json/npcs/talk_tags.json |
<hungry> |
<hungry> |
see data/json/npcs/talk_tags.json |
<im_leaving_you> |
<im_leaving_you> |
see data/json/npcs/talk_tags.json |
<its_safe_h> |
<its_safe_h> |
see data/json/npcs/talk_tags.json |
<its_safe> |
<its_safe> |
see data/json/npcs/talk_tags.json |
<keep_up> |
<keep_up> |
see data/json/npcs/talk_tags.json |
<kill_npc_h> |
<kill_npc_h> |
see data/json/npcs/talk_tags.json |
<kill_npc> |
<kill_npc> |
see data/json/npcs/talk_tags.json |
<kill_player_h> |
<kill_player_h> |
see data/json/npcs/talk_tags.json |
<let_me_pass> |
<let_me_pass> |
see data/json/npcs/talk_tags.json |
<lets_talk> |
<lets_talk> |
see data/json/npcs/talk_tags.json |
<medium_distance> |
<medium_distance> |
see data/json/npcs/talk_tags.json |
<monster_warning_h> |
<monster_warning_h> |
see data/json/npcs/talk_tags.json |
<monster_warning> |
<monster_warning> |
see data/json/npcs/talk_tags.json |
<movement_noise_warning> |
<movement_noise_warning> |
see data/json/npcs/talk_tags.json |
<need_batteries> |
<need_batteries> |
see data/json/npcs/talk_tags.json |
<need_booze> |
<need_booze> |
see data/json/npcs/talk_tags.json |
<need_fuel> |
<need_fuel> |
see data/json/npcs/talk_tags.json |
<no_to_thorazine> |
<no_to_thorazine> |
see data/json/npcs/talk_tags.json |
<run_away> |
<run_away> |
see data/json/npcs/talk_tags.json |
<speech_warning> |
<speech_warning> |
see data/json/npcs/talk_tags.json |
<thirsty> |
<thirsty> |
see data/json/npcs/talk_tags.json |
<wait> |
<wait> |
see data/json/npcs/talk_tags.json |
<warn_sleep> |
<warn_sleep> |
see data/json/npcs/talk_tags.json |
<yawn> |
<yawn> |
see data/json/npcs/talk_tags.json |
<yes_to_lsd> |
<yes_to_lsd> |
see data/json/npcs/talk_tags.json |
snip_bleeding |
My %s is bleeding! |
The NPC is bleeding from their %s. |
snip_bleeding_badly |
My %s is bleeding badly! |
The NPC is bleeding badly from their %s. |
snip_wound_bite |
The bite wound on my %s looks bad. |
The NPC's %s was badly bitten. |
snip_wound_infected |
My %s wound is infected… |
The NPC's wound on their %s is infected. |
snip_lost_blood |
I've lost lot of blood. |
The NPC has lost lot of blood. |
snip_bye |
Bye. |
Say at the end of a conversation. |
snip_consume_eat |
Thanks, that hit the spot. |
You gave them some food and the NPC ate it. |
snip_consume_cant_accept |
I don't <swear> trust you enough to eat THIS… |
You gave them some food but the NPC didn't accept it. |
snip_consume_cant_consume |
It doesn't look like a good idea to consume this… |
You gave them some food but the NPC wouldn't eat it. |
snip_consume_rotten |
This is rotten! I won't eat that. |
You gave them some food but the NPC wouldn't eat it because it's rotten. |
snip_consume_med |
Thanks, I feel better already. |
You gave them a drug and the NPC swallowed it. |
snip_consume_use_med |
Thanks, I used it. |
You gave them a drug and the NPC used it. |
snip_consume_need_item |
I need a %s to consume that! |
You gave them a drug but the NPC couldn't use it without a %s (e.g., a syringe). |
snip_consume_nocharge |
It doesn't look like a good idea to consume this… |
You gave them a drug but the NPC couldn't use it because of a lack of charges. |
snip_give_cancel |
Changed your mind? |
You started to give them an item but hit the escape key. |
snip_give_carry |
Thanks, I'll carry that now. |
You gave them an item and the NPC took it. |
snip_give_nope |
Nope. |
You gave them an item but the NPC couldn't take it. First says. |
snip_give_carry_cant |
I have no space to store it. |
You gave an item but NPC couldn't take because no space. |
snip_give_carry_cant_few_space |
I can only store %s %s more. |
You gave an item but NPC couldn't take because few spaces. |
snip_give_carry_cant_no_space |
…or to store anything else for that matter. |
You gave an item but NPC couldn't take because no spaces. |
snip_give_carry_too_heavy |
It is too heavy for me to carry. |
You gave an item but NPC couldn't take because too heavy. |
snip_give_dangerous |
Are you <swear> insane!? |
You gave a dangerous item like active grenade. |
snip_give_to_hallucination |
No thanks, I'm good. |
You gave an item but NPC couldn't take because he/she was in hallucination. |
snip_give_wield |
Thanks, I'll wield that now. |
You gave a weapon and NPC wield it. |
snip_give_weapon_weak |
My current weapon is better than this.\n |
You gave a weapon but NPC didn't take it because it was weaker than current weapons. |
snip_heal_player |
Hold still %s, I'm coming to help you. |
NPC try to heal you. |
snip_pulp_zombie |
Hold on, I want to pulp that %s. |
NPC try to pulp %s. |
snip_radiation_sickness |
I'm suffering from radiation sickness… |
NPC are in radiation sickness. |
snip_wear |
Thanks, I'll wear that now. |
You gave a clothes or armor and NPC wear it. |
Certain entries like the snippets above are taken from the game state as opposed to JSON; they are found in the npctalk function parse_tags. They are as follows:
<yrwp>
| displays avatar's wielded item
<mywp>
| displays npc's wielded item
<u_name>
| displays avatar's name
<npc_name>
| displays npc's name
<ammo>
| displays avatar's ammo
<current_activity>
| displays npc's current activity
<punc>
| displays a random punctuation from: .
, …
, !
<mypronoun>
| displays npc's pronoun
<topic_item>
| referenced item
<topic_item_price>
| referenced item unit price
<topic_item_my_total_price>
| TODO Add
<topic_item_your_total_price>
| TODO Add
<u_val:VAR>
| The user variable VAR
<npc_val:VAR>
| The npc variable VAR
<global_val:VAR>
| The global variable VAR
Keeping track of talk topics and making sure that all the topics referenced in responses are
defined, and all defined topics are referenced in a response or an NPC's chat, is very tricky.
There is a python script in tools/dialogue_validator.py
that will map all topics to responses
and vice versa. Invoke it with
python3 tools/dialogue_validator.py data/json/npcs/* data/json/npcs/Backgrounds/* data/json/npcs/refugee_center/*
If you are writing a mod with dialogue, you can add the paths to the mod's dialogue files.
Each topic consists of:
- a topic id (e.g.
TALK_ARSONIST
) - a dynamic line, spoken by the NPC.
- an optional list of effects that occur when the NPC speaks the dynamic line
- a list of responses that can be spoken by the player character.
- a list of repeated responses that can be spoken by the player character, automatically generated if the player or NPC has items in a list of items.
One can specify new topics in json. It is currently not possible to define the starting topic, so you have to add a response to some of the default topics (e.g. TALK_STRANGER_FRIENDLY
or TALK_STRANGER_NEUTRAL
) or to topics that can be reached somehow.
Format:
{
"type": "talk_topic",
"id": "TALK_ARSONIST",
"dynamic_line": "What now?",
"responses": [
{
"text": "I don't know either",
"topic": "TALK_DONE"
}
],
"replace_built_in_responses": true
}
Must always be there and must always be "talk_topic"
.
The topic id can be one of the built-in topics or a new id. However, if several talk topics in json have the same id, the last topic definition will override the previous ones.
The topic id can also be an array of strings. This is loaded as if several topics with the exact same content have been given in json, each associated with an id from the id
, array. Note that loading from json will append responses and, if defined in json, override the dynamic_line
and the replace_built_in_responses
setting. This allows adding responses to several topics at once.
This example adds the "I'm going now!" response to all the listed topics.
{
"type": "talk_topic",
"id": [ "TALK_ARSONIST", "TALK_STRANGER_FRIENDLY", "TALK_STRANGER_NEUTRAL" ],
"dynamic_line": "What now?",
"responses": [
{
"text": "I'm going now.",
"topic": "TALK_DONE"
}
]
}
The dynamic_line
is the line spoken by the NPC. It is optional. If it is not defined and the topic has the same id as a built-in topic, the dynamic_line
from that built-in topic will be used. Otherwise the NPC will say nothing. See the chapter about dynamic_line
below for more details.
The speaker_effect
is an object or array of effects that will occur after the NPC speaks the dynamic_line
, no matter which response the player chooses. See the chapter about Speaker Effects below for more details.
The responses
entry is an array with possible responses. It must not be empty. Each entry must be a response object. See the chapter about Responses below for more details.
replace_built_in_responses
is an optional boolean that defines whether to dismiss the built-in responses for that topic (default is false
). If there are no built-in responses, this won't do anything. If true
, the built-in responses are ignored and only those from this definition in the current json are used. If false
, the responses from the current json are used along with the built-in responses (if any).
A dynamic line can either be a simple string, or an complex object, or an array with dynamic_line
entries. If it's an array, an entry will be chosen randomly every time the NPC needs it. Each entry has the same probability.
Example:
"dynamic_line": [
"generic text",
{
"npc_female": [ "text1", "text2", "text3" ],
"npc_male": { "u_female": "text a", "u_male": "text b" }
}
]
A complex dynamic_line
usually contains several dynamic_line
entry and some condition that determines which is used. If dynamic lines are not nested, they are processed in the order of the entries below. The possible types of lines follow.
In all cases, npc_
refers to the NPC, and u_
refers to the player. Optional lines do not have to be defined, but the NPC should always have something to say. Entries are always parsed as dynamic_line
and can be nested.
The dynamic line is a list of dynamic lines, all of which are displayed. The dynamic lines in the list are processed normally.
{
"concatenate": [
{
"npc_male": true,
"yes": "I'm a man.",
"no": "I'm a woman."
},
" ",
{
"u_female": true,
"no": "You're a man.",
"yes": "You're a woman."
}
]
}
The line is to be given a gender context for the NPC, player, or both, to aid translation in languages where that matters. For example:
{
"gendered_line": "Thank you.",
"relevant_genders": [ "npc" ]
}
("Thank you" is different for male and female speakers in e.g. Portuguese).
Valid choices for entries in the "relevant_genders"
list are "npc"
and
"u"
.
The dynamic line will be randomly chosen from the hints snippets.
{
"give_hint": true
}
The dynamic line will list all of the possible starting sites for faction camps.
The dynamic line will be chosen from a reason generated by an earlier effect. The reason will be cleared. Use of it should be gated on the "has_reason"
condition.
{
"has_reason": { "use_reason": true },
"no": "What is it, boss?"
}
The dynamic line will be chosen based on whether a single dialogue condition is true or false. Dialogue conditions cannot be chained via "and"
, "or"
, or "not"
. If the condition is true, the "yes"
response will be chosen and otherwise the "no"
response will be chosen. Both the '"yes"
and "no"
responses are optional. Simple string conditions may be followed by "true"
to make them fields in the dynamic line dictionary, or they can be followed by the response that will be chosen if the condition is true and the "yes"
response can be omitted.
{
"npc_need": "fatigue",
"level": "TIRED",
"no": "Just few minutes more...",
"yes": "Make it quick, I want to go back to sleep."
}
{
"npc_aim_rule": "AIM_PRECISE",
"no": "*will not bother to aim at all.",
"yes": "*will take time and aim carefully."
}
{
"u_has_item": "india_pale_ale",
"yes": "<noticedbooze>",
"no": "<neutralchitchat>"
}
{
"days_since_cataclysm": 30,
"yes": "Now, we've got a moment, I was just thinking it's been a month or so since... since all this, how are you coping with it all?",
"no": "<neutralchitchat>"
}
{
"is_day": "Sure is bright out.",
"no": {
"u_male": true,
"yes": "Want a beer?",
"no": "Want a cocktail?"
}
}
The speaker_effect
entry contains dialogue effects that occur after the NPC speaks the dynamic_line
but before the player responds and regardless of the player response. Each effect can have an optional condition, and will only be applied if the condition is true. Each speaker_effect
can also have an optional sentinel
, which guarantees the effect will only run once.
Format:
"speaker_effect": {
"sentinel": "...",
"condition": "...",
"effect": "..."
}
or:
"speaker_effect": [
{
"sentinel": "...",
"condition": "...",
"effect": "..."
},
{
"sentinel": "...",
"condition": "...",
"effect": "..."
}
]
The sentinel
can be any string, but sentinels are unique to each TALK_TOPIC
. If there are multiple speaker_effect
s within the TALK_TOPIC
, they should have different sentinels. Sentinels are not required, but since the speaker_effect
will run every time the dialogue returns to the TALK_TOPIC
, they are highly encouraged to avoid inadvertently repeating the same effects.
The effect
can be any legal effect, as described below. The effect can be a simple string, object, or an array of strings and objects, as normal for objects.
The optional condition
can be any legal condition, as described below. If a condition
is present, the effect
will only occur if the condition
is true.
Speaker effects are useful for setting status variables to indicate that player has talked to the NPC without complicating the responses with multiple effect variables. They can also be used, with a sentinel, to run a mapgen_update
effect the first time the player hears some dialogue from the NPC.
A response contains at least a text, which is display to the user and "spoken" by the player character (its content has no meaning for the game) and a topic to which the dialogue will switch to. It can also have a trial object which can be used to either lie, persuade or intimidate the NPC, see below for details. There can be different results, used either when the trial succeeds and when it fails.
Format:
{
"text": "I, the player, say to you...",
"condition": "...something...",
"trial": {
"type": "PERSUADE",
"difficulty": 10
},
"success": {
"topic": "TALK_DONE",
"effect": "...",
"opinion": {
"trust": 0,
"fear": 0,
"value": 0,
"anger": 0,
"owed": 0,
"favors": 0
}
},
"failure": {
"topic": "TALK_DONE"
}
}
Alternatively a short format:
{
"text": "I, the player, say to you...",
"effect": "...",
"topic": "TALK_WHATEVER"
}
The short format is equivalent to (an unconditional switching of the topic, effect
is optional):
{
"text": "I, the player, say to you...",
"trial": {
"type": "NONE"
},
"success": {
"effect": "...",
"topic": "TALK_WHATEVER"
}
}
The optional boolean keys "switch" and "default" are false by default. Only the first response with "switch": true
, "default": false
, and a valid condition will be displayed, and no other responses with "switch": true
will be displayed. If no responses with "switch": true
and "default": false
are displayed, then any and all responses with "switch": true
and "default": true
will be displayed. In either case, all responses that have "switch": false
(whether or not they have "default": true
is set) will be displayed as long their conditions are satisfied.
"responses": [
{ "text": "You know what, never mind.", "topic": "TALK_NONE" },
{ "text": "How does 5 Ben Franklins sound?",
"topic": "TALK_BIG_BRIBE", "condition": { "u_has_cash": 500 }, "switch": true },
{ "text": "I could give you a big Grant.",
"topic": "TALK_BRIBE", "condition": { "u_has_cash": 50 }, "switch": true },
{ "text": "Lincoln liberated the slaves, what can he do for me?",
"topic": "TALK_TINY_BRIBE", "condition": { "u_has_cash": 5 }, "switch": true, "default": true },
{ "text": "Maybe we can work something else out?", "topic": "TALK_BRIBE_OTHER",
"switch": true, "default": true },
{ "text": "Gotta go!", "topic": "TALK_DONE" }
]
The player will always have the option to return to a previous topic or end the conversation, and will otherwise have the option to give a $500, $50, or $5 bribe if they have the funds. If they don't have at least $50, they will also have the option to provide some other bribe.
The player will have one response text if a condition is true, and another if it is false, but the same trial for either line. condition
, true
, and false
are all mandatory.
{
"truefalsetext": {
"condition": { "u_has_cash": 800 },
"true": "I may have the money, I'm not giving you any.",
"false": "I don't have that money."
},
"topic": "TALK_WONT_PAY"
}
Will be shown to the user, no further meaning.
Text boxes; dialogue in general is a convenient space to sprinkle in descriptive text, something that isn't necessarily being said by any interlocutor but something the player character, npc or speaking entity express, do or generally interact with given a context there are many ways to present this, ultimately is up to the writer, and their preferred style.
Currently you may add a &
as the first character in dialogue, this deletes quotation round the output text, denotes the descriptive nature of the displayed
text, use \"
escaped double quotes to indicate the start of actual dialogue.
Optional, if not defined, "NONE"
is used. Otherwise one of "NONE"
, "LIE"
, "PERSUADE"
, "INTIMIDATE"
, or "CONDITION"
. If "NONE"
is used, the failure
object is not read, otherwise it's mandatory.
The difficulty
is only required if type is not "NONE"
or "CONDITION"
and, for most trials, specifies the success chance in percent (it is however modified by various things like mutations). Higher difficulties are easier to pass. "SKILL_CHECK"
trials are unique, and use the difficulty as a flat comparison.
An optional mod
array takes any of the following modifiers and increases the difficulty by the NPC's opinion of your character or personality trait for that modifier multiplied by the value: "ANGER"
, "FEAR"
, "TRUST"
, "VALUE"
, "AGGRESSION"
, "ALTRUISM"
, "BRAVERY"
, "COLLECTOR"
. The special "POS_FEAR"
modifier treats NPC's fear of your character below 0 as though it were 0. The special "TOTAL"
modifier sums all previous modifiers and then multiplies the result by its value and is used when setting the owed value.
"CONDITION"
trials take a mandatory condition
instead of difficulty
. The success
object is chosen if the condition
is true and the failure
is chosen otherwise.
"SKILL_CHECK"
trials check the user's level in a skill, whose ID is read from the string object skill_required
. The success
object is chosen if the skill level is equal to or greater than difficulty
, and failure
is chosen otherwise.
Both objects have the same structure. topic
defines which topic the dialogue will switch to. opinion
is optional, if given it defines how the opinion of the NPC will change. The given values are added to the opinion of the NPC, they are all optional and default to 0. effect
is a function that is executed after choosing the response, see below.
The opinion of the NPC affects several aspects of the interaction with NPCs:
- Higher trust makes it easier to lie and persuade, and it usually a good thing.
- Higher fear makes it easier to intimidate, but the NPC may flee from you (and will not talk to you).
- Higher value makes it easier to persuade them and to give them orders, it's a kind of a friendship indicator.
- High anger value (about 20 points more than fear, but this also depends on the NPCs personality) makes the NPC hostile and is usually a bad thing.
The combination of fear and trust decide together with the personality of the NPC the initial talk topic (
"TALK_MUG"
,"TALK_STRANGER_AGGRESSIVE"
,"TALK_STRANGER_SCARED"
,"TALK_STRANGER_WARY"
,"TALK_STRANGER_FRIENDLY"
, or"TALK_STRANGER_NEUTRAL"
).
For the actual usage of that data, search the source code for "op_of_u"
.
The failure
object is used if the trial fails, the success
object is used otherwise.
"trial": { "type": "PERSUADE", "difficulty": 0, "mod": [ [ "TRUST", 3 ], [ "VALUE", 3 ], [ "ANGER", -3 ] ] }
"trial": { "type": "INTIMIDATE", "difficulty": 20, "mod": [ [ "FEAR", 8 ], [ "VALUE", 2 ], [ "TRUST", 2 ], [ "BRAVERY", -2 ] ] }
"trial": { "type": "CONDITION", "condition": { "npc_has_trait": "FARMER" } }
"trial": { "type": "SKILL_CHECK", "difficulty": 3, "skill_required": "swimming" }
topic
can also be a single topic object (the type
member is not required here):
"success": {
"topic": {
"id": "TALK_NEXT",
"dynamic_line": "...",
"responses": [
]
}
}
This is an optional condition which can be used to prevent the response under certain circumstances. If not defined, it defaults to always true
. If the condition is not met, the response is not included in the list of possible responses. For possible content see Dialogue Conditions below.
Repeat responses are responses that should be added to the response list multiple times, once for each instance of an item.
A repeat response has the following format:
{
"for_item": [
"jerky", "meat_smoked", "fish_smoked", "cooking_oil", "cooking_oil2", "cornmeal", "flour",
"fruit_wine", "beer", "sugar"
],
"response": { "text": "Delivering <topic_item>.", "topic": "TALK_DELIVER_ASK" }
}
"response"
is mandatory and must be a standard dialogue response, as described above. "switch"
is allowed in repeat responses and works normally.
One of "for_item"
or "for_category"
, and each can either be a single string or list of items or item categories. The response
is generated for each item in the list in the player or NPC's inventory.
"is_npc"
is an optional bool value, and if it is present, the NPC's inventory list is checked. By default, the player's inventory list is checked.
"include_containers"
is an optional bool value, and if it is present, items containing an item will generate separate responses from the item itself.
The effect
field of speaker_effect
or a response
can be any of the following effects. Multiple effects should be arranged in a list and are processed in the order listed.
variable_object
: This is either an object, an arithmetic
expression(see arithmetic below) or array describing a variable name. It can either describe an int or a time duration. If it is an array it must have 2 values the first of which will be a minimum and the second will be a maximum and the value will be randomly between the two. If it is an int default
is a required int which will be the value returned if the variable is not defined. If is it a duration then default
can be either an int or a string describing a time span. u_val
, npc_val
, or global_val
can be the used for the variable name element. If u_val
is used it describes a variable on player u, if npc_val
is used it describes a variable on player npc, if global_val
is used it describes a global variable. If this is a duration infinite
will be accepted to be a virtually infinite value(it is actually more than a year, if longer is needed a code change to make this a flag or something will be needed).
example json:
"effect": [ { "u_mod_focus": { "u_val":"test", "default": 1 } },
{ "u_mod_focus": [ 0, { "u_val":"test", "default": 1 } ] }
{ "u_add_morale": "morale_honey","bonus": -20,"max_bonus": -60, "decay_start": 1,
"duration": { "global_val": "test2", "type": "debug", "context": "testing", "default": "2 minutes" },
{
"u_spawn_monster": "mon_absence",
"real_count": { "arithmetic": [ { "arithmetic": [ { "const":1 }, "+", { "const": 1 } ] }, "+", { "const": 1 } ] }
} ]
Effect | Description |
---|---|
assign_mission |
Assigns a previously selected mission to your character. |
mission_success |
Resolves the current mission successfully. |
mission_failure |
Resolves the current mission as a failure. |
clear_mission |
Clears the mission from the your character's assigned missions. |
mission_reward |
Gives the player the mission's reward. |
Effect | Description |
---|---|
lesser_give_aid |
Removes bleeding from your character's body and heals 5-15 HP of injury on each of your character's body parts. |
lesser_give_aid_all |
Performs lesser_give_aid on each of your character's NPC allies in range. |
give_aid |
Removes all bites, infection, and bleeding from your character's body and heals 10-25 HP of injury on each of your character's body parts. |
give_aid_all |
Performs give_aid on each of your character's NPC allies in range. |
buy_haircut |
Gives your character a haircut morale boost for 12 hours. |
buy_shave |
Gives your character a shave morale boost for 6 hours. |
morale_chat |
Gives your character a pleasant conversation morale boost for 6 hours. |
player_weapon_away |
Makes your character put away (unwield) their weapon. |
player_weapon_drop |
Makes your character drop their weapon. |
Effect | Description |
---|---|
u_mutate , npc_mutate : chance_int , optional use_vitamins: vitamin_bool |
Your character or the NPC will attempt to mutate, with a one in chance_int chance of using the highest category, with 0 never using the highest category, requiring vitamins if vitamin_bool is true(defaults true) |
u_mutate_category , npc_mutate_category : category_str , optional use_vitamins: vitamin_bool |
Your character or the NPC will attempt to mutate in the category category_str , requiring vitamins if vitamin_bool is true(defaults true) |
u_add_effect: effect_string , (one of duration: duration_string , duration: duration_int , duration_variable_object ),(optional target_part: target_part_string , intensity: intensity_int )npc_add_effect: effect_string , (one of duration: duration_string , duration: duration_int , duration_variable_object ), (optional target_part: target_part_string , force: force_bool , intensity: intensity_int or intensity_variable_object ) |
Your character or the NPC will gain the effect for duration_string or the value of the variable described by duration_object see variable_object above, turns at intensity intensity_int (or the value of the variable described by intensity_variable_object see variable_object above) or 0 if it was not supplied. If force_bool is true(defaults false) immunity will be ignored. If target_part is supplied that part will get the effect otherwise its a whole body effect. If target_part is RANDOM a random body part will be used. If duration_string is "PERMANENT" , the effect will be added permanently. |
u_add_bionic: bionic_string npc_add_bionic: bionic_string |
Your character or the NPC will gain the bionic. |
u_lose_bionic: bionic_string npc_lose_bionic: bionic_string |
Your character or the NPC will lose the bionic. |
u_add_trait: trait_string npc_add_trait: trait_string |
Your character or the NPC will gain the trait. |
u_lose_effect: effect_string npc_lose_effect: effect_string |
Your character or the NPC will lose the effect if they have it. |
u_lose_trait: trait_string npc_lose_trait: trait_string |
Your character or the NPC will lose the trait. |
u_add_var, npc_add_var : var_name, type: type_str , context: context_str , either value: value_str or time: true or possible_values: string_array |
Your character or the NPC will store value_str as a variable that can be later retrieved by u_has_var or npc_has_var . npc_add_var can be used to store arbitrary local variables, and u_add_var can be used to store arbitrary "global" variables, and should be used in preference to setting effects. If time is used instead of value_str , then the current turn of the game is stored. If possible_values is used one of the values given at random will be used. |
u_lose_var , npc_lose_var : var_name , type: type_str , context: context_str |
Your character or the NPC will clear any stored variable that has the same var_name , type_str , and context_str . |
u_adjust_var, npc_adjust_var : var_name, type: type_str , context: context_str , adjustment: adjustment_num or adjustment_variable_object |
Your character or the NPC will adjust the stored variable by adjustment_num (or the value of the variable described by adjustment_num see variable_object above). |
set_string_var : type: string or variable object or array of either , target_var: variable_object |
Store string (or the variable described) from set_string_var in the variable object target_var . If an array is provided a random element will be used. |
u_location_variable, npc_location_variable : target_var ,optional min_radius: min_radius_int or min_radius_variable_object ,optional max_radius: max_radius_int or max_radius_variable_object , optional outdoor_only: outdoor_only_bool , optional target_params: assign_mission_target parameters, optional z_adjust: int or variable_object , optional x_adjust: int or variable_object , optional y_adjust: int or variable_object , optional z_override: bool |
If target_params is defined it will be used to find a tile. See the missions docs for assign_mission_target parameters. Otherwise targets a point between min_radius_int ( or min_radius_variable_object )(defaults to 0) and max_radius_int ( or max_radius_variable_object )(defaults to 0) spaces of the target and if outdoor_only_bool is true(defaults to false) will only choose outdoor spaces. The chosen point will be saved to target_var which is a variable_object . z_adjust will be used as the Z value if z_override (defaults false) is true or added to the current z value otherwise. x_adjust and y_adjust are added to the final position. |
barber_hair |
Opens a menu allowing the player to choose a new hair style. |
barber_beard |
Opens a menu allowing the player to choose a new beard style. |
u_learn_recipe: recipe_string |
Your character will learn and memorize the recipe recipe_string . |
npc_first_topic: talk_topic_string |
Changes the initial talk_topic of the NPC in all future dialogues. |
u_add_wet: wet_int npc_add_wet: wet_int or wet_variable_object |
Your character or the NPC will be wet wet_int (or the value of the variable described by wet_variable_object see variable_object above) as if they were in the rain. |
u_make_sound, npc_make_sound: message_string , volume: volume_int , type: type_string ,optional target_var: target_var_object , optional snippet: snippet_bool , optional same_snippet: same_snippet_bool |
A sound of description message_string will be made at your character or the NPC's location of volume volume_int and type type_string . Possible types are: background, weather, music, movement, speech, electronic_speech, activity, destructive_activity, alarm, combat, alert, or order. If target_var is set this effect will be centered on a location saved to a variable with its name. target_var is an object with value ,type and context as string values and a bool global which determines if the variable is global or not. If snippet_bool is true(defaults to false) it will instead display a random snippet from message_string category, if same_snippet_bool is true(defaults to false) it will always use the same snippet and will set a variable that can be used for custom item names(this requires the snippets to have id's set) |
u_mod_healthy, npc_mod_healthy : amount_int or amount_variable_object, cap: cap_int or cap_variable_object |
Your character or the NPC will have amount_int ( or the value of the variable described by amount_variable_object see variable_object above) added or subtracted from its health value, but not beyond cap_int or cap_variable_object . |
u_add_morale: morale_string , (optional bonus: bonus_int ), (optional max_bonus: max_bonus_int or max_bonus_variable_object ), (optional duration: duration_string or duration_variable_object ), (optional decay_start : decay_string or decay_variable_object ), (optional capped : capped_bool )npc_add_morale: morale_string , (optional bonus: bonus_int or bonus_variable_object ), (optional max_bonus: max_bonus_int ), (optional duration: duration_int ), (optionaldecay_start : decay_int ), (optional capped : capped_bool ) |
Your character or the NPC will gain a morale bonus of type morale_string . Morale is changed by bonus_int ( or the value of the variable described by bonus_variable_object see variable_object above) (default 1), with a maximum of up to max_bonus_int (or max_bonus_variable_object ) (default 1). It will last for duration: duration_string time (default 1 hour) or duration_variable_object . It will begin to decay after decay_string time (default 30 minutes) or decay_variable_object . capped_bool Whether this morale is capped or not, defaults to false. |
u_lose_morale: morale_string npc_lose_morale: morale_string |
Your character or the NPC will lose any morale of type morale_string . |
u_add_faction_trust: amount_int u_lose_faction_trust: amount_int |
Your character gains or loses trust with the speaking NPC's faction, which affects which items become available for trading from shopkeepers of that faction. |
u_message, npc_message: message_string , (optional sound: sound_bool ),(optional outdoor_only: outdoor_only_bool ),(optional snippet: snippet_bool ),(optional same_snippet: snippet_bool ,(optional type: type_string ),(optional popup: popup_bool ) |
Displays a message to either the player or the npc of message_string . Will not display unless the player or npc is the actual player. If snippet_bool is true(defaults to false) it will instead display a random snippet from message_string category, if same_snippet_bool is true(defaults to false) it will always use the same snippet and will set a variable that can be used for custom item names(this requires the snippets to have id's set). If sound is true (defaults to false) it will only display the message if the player is not deaf. outdoor_only (defaults to false) only matters when sound is true and will make the message less likely to be heard if the player is underground. Message will display as type of type_string . Type affects the color of message and can be any of the following values: good, neutral, bad, mixed, warning, info, debug, headshot, critical, grazing. enums.h has more info on each types use. If popup_bool is true the message will be in a modal popup the user has to dismiss to continue. You can use any of the Special Custom Entries(defined above). |
u_cast_spell, npc_cast_spell : fake_spell_data , optional true_eocs: eocs_array , optional false_eocs: eocs_array |
The spell described by fake_spell_data will be cast with u or the npc as the caster and u or the npc's location as the target. Fake spell data can have the following attributes: id:string : the id of the spell to cast, (optional hit_self : bool ( defaults to false ) if true can hit the caster, trigger_message : string to display on trigger, npc_message : string for message if npc uses, max_level int max level of the spell, min_level int min level of the spell ). If the spell is cast, then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
u_assign_activity, npc_assign_activity: activity_id_string , duration: duration_string or duration_variable_object ) |
Your character or the NPC will start activity activity_id_string . It will last for duration: duration_string time or duration_variable_object . |
u_teleport, npc_teleport: target_var_object , (optional success_message: success_message_string ), (optional fail_message: fail_message_string ), (optional force: fprce_bool ) |
u or npc are teleported to the destination stored in the variable named by target_var . target_var is an object with value ,type and context as string values and a bool global which determines if the variable is global or not. If the teleport succeeds and success_message is defined it will be displayed, if it fails and fail_message is defined it will be displayed. If force is true any creatures at the destination will be killed and if blocked a nearby spot will be chosen to teleport to instead. |
Effect | Description |
---|---|
start_trade |
Opens the trade screen and allows trading with the NPC. |
give_equipment |
Allows your character to select items from the NPC's inventory and transfer them to your inventory. |
npc_gets_item |
Allows your character to select an item from your character's inventory and transfer it to the NPC's inventory. The NPC will not accept it if they do not have space or weight to carry it, and will set a reason that can be referenced in a future dynamic line with "use_reason" . |
npc_gets_item_to_use |
Allow your character to select an item from your character's inventory and transfer it to the NPC's inventory. The NPC will attempt to wield it and will not accept it if it is too heavy or is an inferior weapon to what they are currently using, and will set a reason that can be referenced in a future dynamic line with "use_reason" . |
u_spawn_item: item_string , (optional count: count_num , optional container: container_string ) |
Your character gains the item or count_num copies of the item, contained in container if specified. If used in an NPC conversation the items are said to be given by the NPC. |
u_buy_item: item_string , (cost: cost_num , optional count: count_num , optional container: container_string , optional true_eocs: eocs_array , optional false_eocs: eocs_array ) |
The NPC will sell your character the item or count_num copies of the item, contained in container , and will subtract cost_num from op_of_u.owed . If the op_o_u.owed is less than cost_num , the trade window will open and the player will have to trade to make up the difference; the NPC will not give the player the item unless cost_num is satisfied. |
u_sell_item: item_string , (optional cost: cost_num , optional count: count_num , optional true_eocs: eocs_array , optional false_eocs: eocs_array ) |
Your character will give the NPC the item or count_num copies of the item, and will add cost_num to the NPC's op_of_u.owed if specified.If cost isn't present, the your character gives the NPC the item at no charge. This effect will fail if you do not have at least count_num copies of the item, so it should be checked with. If the item is sold, then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
u_bulk_trade_accept npc_bulk_trade_accept or u_bulk_trade_accept: quantity_int npc_bulk_trade_accept: quantity_int |
Only valid after a repeat_response . The player trades all instances of the item from the repeat_response with the NPC. For u_bulk_trade_accept , the player loses the items from their inventory and gains the same value of the NPC's faction currency; for npc_bulk_trade_accept , the player gains the items from the NPC's inventory and loses the same value of the NPC's faction currency. If there is remaining value, or the NPC doesn't have a faction currency, the remainder goes into the NPC's op_of_u.owed . If quantity_int is specified only that many items/charges will be moved. |
u_bulk_donate npc_bulk_donate or u_bulk_donate: quantity_int npc_bulk_donate: quantity_int |
Only valid after a repeat_response . The player or NPC transfers all instances of the item from the repeat_response . For u_bulk_donate , the player loses the items from their inventory and the NPC gains them; for npc_bulk_donate , the player gains the items from the NPC's inventory and the NPC loses them. If quantity_int is specified only that many items/charges will be moved. |
u_spend_cash: cost_num , optional true_eocs: eocs_array , optional false_eocs: eocs_array |
Remove cost_num from your character's cash. Negative values means your character gains cash. deprecated NPCs should not deal in e-cash anymore, only personal debts and items. If the cash is spent, then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
add_debt: mod_list |
Increases the NPC's debt to the player by the values in the mod_list .The following would increase the NPC's debt to the player by 1500x the NPC's altruism and 1000x the NPC's opinion of the player's value: { "effect": { "add_debt": [ [ "ALTRUISM", 3 ], [ "VALUE", 2 ], [ "TOTAL", 500 ] ] } } |
u_consume_item , npc_consume_item: item_string , (optional count: count_num ), (optional charges: charges_num ), (optional popup: popup_bool ) |
You or the NPC will delete the item or count_num copies of the item or charges_num charges of the item from their inventory.This effect will fail if the you or NPC does not have at least count_num copies of the item or charges_num charges of the item, so it should be checked with u_has_items or npc_has_items .If popup_bool is true , u_consume_item will show a message displaying the character giving the items to the NPC. It defaults to false if not defined, and has no effect when used in npc_consume_item . |
u_remove_item_with , npc_remove_item_with: item_string |
You or the NPC will delete any instances of item in inventory. This is an unconditional remove and will not fail if you or the NPC does not have the item. |
u_buy_monster: monster_type_string , (optional cost: cost_num , optional count: count_num , optional name: name_string , optional pacified: pacified_bool , optional true_eocs: eocs_array , optional false_eocs: eocs_array ) |
The NPC will give your character count_num (default 1) instances of the monster as pets and will subtract cost_num from op_of_u.owed if specified. If the op_o_u.owed is less than cost_num , the trade window will open and the player will have to trade to make up the difference; the NPC will not give the player the item unless cost_num is satisfied.If cost isn't present, the NPC gives your character the item at no charge. If name_string is specified the monster(s) will have the specified name. If pacified_bool is set to true, the monster will have the pacified effect applied. If the monster is sold, then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
Effect | Description |
---|---|
assign_guard |
Makes the NPC into a guard. If allied and at a camp, they will be assigned to that camp. |
stop_guard |
Releases the NPC from their guard duty (also see assign_guard ). Friendly NPCs will return to following. |
start_camp |
The NPC will start a faction camp with the player. |
recover_camp |
Makes the NPC the overseer of an existing camp that doesn't have an overseer. |
remove_overseer |
Makes the NPC stop being an overseer, abandoning the faction camp. |
wake_up |
Wakes up sleeping, but not sedated, NPCs. |
reveal_stats |
Reveals the NPC's stats, based on the player's skill at assessing them. |
end_conversation |
Ends the conversation and makes the NPC ignore you from now on. |
insult_combat |
Ends the conversation and makes the NPC hostile, adds a message that character starts a fight with the NPC. |
hostile |
Makes the NPC hostile and ends the conversation. |
flee |
Makes the NPC flee from your character. |
follow |
Makes the NPC follow your character, joining the "Your Followers" faction. |
leave |
Makes the NPC leave the "Your Followers" faction and stop following your character. |
follow_only |
Makes the NPC follow your character without changing factions. |
stop_following |
Makes the NPC stop following your character without changing factions. |
npc_thankful |
Makes the NPC positively inclined toward your character. |
drop_weapon |
Makes the NPC drop their weapon. |
stranger_neutral |
Changes the NPC's attitude to neutral. |
start_mugging |
The NPC will approach your character and steal from your character, attacking if your character resists. |
lead_to_safety |
The NPC will gain the LEAD attitude and give your character the mission of reaching safety. |
start_training |
The NPC will train your character in a skill or martial art. NOTE: the code currently requires that you initiate training by directing the player through "topic": "TALK_TRAIN" where the thing to be trained is selected. Initiating training outside of "TALK_TRAIN" will give an error. |
start_training_npc |
The NPC will accept training from the player in a skill or martial art. |
start_training_seminar |
Opens a dialog to select which characters will participate in the training seminar hosted by this NPC. |
companion_mission: role_string |
The NPC will offer you a list of missions for your allied NPCs, depending on the NPC's role. |
basecamp_mission |
The NPC will offer you a list of missions for your allied NPCs, depending on the local basecamp. |
bionic_install |
The NPC installs a bionic from your character's inventory onto your character, using very high skill, and charging you according to the operation's difficulty. |
bionic_remove |
The NPC removes a bionic from your character, using very high skill, and charging you according to the operation's difficulty. |
npc_class_change: class_string |
Change the NPC's faction to class_string . |
npc_faction_change: faction_string |
Change the NPC's faction membership to faction_string . |
u_faction_rep: rep_num |
Increases your reputation with the NPC's current faction, or decreases it if rep_num is negative. |
toggle_npc_rule: rule_string |
Toggles the value of a boolean NPC follower AI rule such as "use_silent" or "allow_bash" |
set_npc_rule: rule_string |
Sets the value of a boolean NPC follower AI rule such as "use_silent" or "allow_bash" |
clear_npc_rule: rule_string |
Clears the value of a boolean NPC follower AI rule such as "use_silent" or "allow_bash" |
set_npc_engagement_rule: rule_string |
Sets the NPC follower AI rule for engagement distance to the value of rule_string . |
set_npc_aim_rule: rule_string |
Sets the NPC follower AI rule for aiming speed to the value of rule_string . |
npc_die |
The NPC will die at the end of the conversation. |
npc_set_goal:assign_mission_target_object , optional true_eocs: eocs_array , optional false_eocs: eocs_array |
The NPC will walk to assign_mission_target_object . See the missions docs for assign_mission_target parameters. If the goal is assigned, then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
Effect | Description |
---|---|
mapgen_update: mapgen_update_id_string mapgen_update: list of mapgen_update_id_string s, (optional assign_mission_target parameters), (optional target_var: variable_object ), (optional time_in_future: duration_string or duration_variable_object ), (optional key: string_variable_object ) |
With no other parameters, updates the overmap tile at the player's current location with the changes described in mapgen_update_id (or for each mapgen_update_id in the list). If time_in_future is set the update will happen that far in the future, in this case however the target location will be determined now and not changed even if its variables update. The assign_mission_target parameters can be used to change the location of the overmap tile that gets updated. See the missions docs for assign_mission_target parameters and the mapgen docs for mapgen_update . If target_var ( see variable_object above) is set this effect will be centered on a location saved to a variable with its name instead. |
revert_location: variable_object , time_in_future: duration_string or duration_variable_object |
revert_location is a variable object of the location. The map tile at that location will be saved(terrain,furniture and traps) and restored at time_in_future . If key is provided it can be used with alter_timed_events to force it to occur early. |
alter_timed_events: string_variable_object , (optional time_in_future: duration_string or duration_variable_object ) |
Will cause all future events associated with the title string as a key to occur time_in_future (defaults to 0) in the future. |
lightning |
Allows supercharging monster in electrical fields, legacy command for lightning weather. |
next_weather |
Forces a check for what weather it should be. |
custom_light_level: custom_light_level_int or custom_light_level_variable_object, length: duration_string or duration_variable_object , (optional key: string_variable_object ) |
Sets the ambient light from the sun/moon to be custom_light_level_int ( or the value of the variable described by custom_light_level_variable_object see variable_object above). This can vary naturally between 0 and 125 depending on the sun to give a scale. This lasts length . If key is provided it can be used with alter_timed_events to force it to occur early. |
u_transform_radius, npc_transform_radius: transform_radius_int or transform_radius_variable_object, ter_furn_transform: ter_furn_transform_string , (optional target_var: target_var_object ), (optional time_in_future: duration_string or duration_variable_object ), (optional key: key_string or duration_variable_object ) |
Applies the ter_furn_transform of id ter_furn_transform (See the transform docs) in radius translate_radius . If target_var is set this effect will be centered on a location saved to a variable with its name. target_var is an object with value ,type and context as string values and a bool global which determines if the variable is global or not. If time_in_future is set the transform will that far in the future, in this case however the target location and radius will be determined now and not changed even if their variables update. If key is provided it can be used with alter_timed_events to force it to occur early. |
transform_line: ter_furn_transform_string , first: target_var_object , second: target_var_object |
Applies the ter_furn_transform of id ter_furn_transform (See the transform docs) on a line between points first and second . |
place_override: string_variable_object, length: duration_variable_object , (optional key: key_string or duration_variable_object ) |
Overrides the location name in the sidebar to instead be the title string. Also disables map and map memory. If length is set the effect will last that long. If key is provided it can be used with alter_timed_events to force it to end early. |
u_spawn_monster: mtype_id_string, npc_spawn_monster: mtype_id_string ,(optional group: group_bool , optional hallucination_count: hallucination_count_int or hallucination_count_variable_object , optional real_count: real_count_int or real_count_variable_object ,optional min_radius: min_radius_int or min_radius_variable_object ,optional max_radius: max_radius_int or max_radius_variable_object ,optional outdoor_only: outdoor_only_bool ,optional open_air_allowed: open_air_allowed_bool ,optional target_range : target_range_int or target_range_variable_object ), optional lifespan: timespan_min_string or variable_object , optional target_var: target_var_object ,optional spawn_message: spawn_message_string ,optional spawn_message_plural: spawn_message_plural_spawn , optional true_eocs: eocs_array , optional false_eocs: eocs_array |
Spawns real_count_int ( or the value of the variable described by real_count_variable_object see variable_object above)(defaults to 0) monsters and hallucination_count_int ( or hallucination_count_variable_object ) (defaults to 0) hallucinations near you or the npc. The spawn will be of type mtype_id_string , if group_bool is false(defaults to false, if it is true a random monster from monster_group mtype_id_string will be used), if this is an empty string it will instead be a random monster within target_range_int ( or target_range_variable_object ) spaces of you. The spawns will happen between min_radius_int ( or min_radius_variable_object )(defaults to 1) and max_radius_int ( or max_radius_variable_object )(defaults to 10) spaces of the target and if outdoor_only_bool is true(defaults to false) will only choose outdoor spaces. If open_air_allowed is true(defaults to false) monsters can be spawned on open air. If lifespan (or the variable_object ) is provided the monster or hallucination will only that long. If target_var is set this effect will be centered on a location saved to a variable with its name. target_var is a variable_object . If at least one spawned creature is visible spawn_message will be displayed. If spawn_message_plural is defined and more than one spawned creature is visible it will be used instead. If at least one monster is spawned, then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
u_set_field: field_id_string or npc_set_field: field_id_string ,(optional intensity: intensity_int or intensity_variable_onject , optional age: age_int or variable_object ,optional radius: radius_int or radius_variable_onject ,optional outdoor_only: outdoor_only_bool ,optional indoor_only: indoor_only_bool ,optional hit_player : hit_player_bool ,optional target_var: target_var_object ) |
Add a field centered on you or the npc of type field_type_id_string , of intensity intensity_int ( or the value of the variable described by real_count_variable_object see variable_object above)( defaults to 1,) of radius radius_int ( or radius_variable_object )(defaults to 10000000) and age age_int (defaults 1) or age_variable_object . It will only happen outdoors if outdoor_only is true, it defaults to false. indoor_only is the opposite. It will hit the player as if they entered it if hit_player is true, it defaults to true. If target_var is set this effect will be centered on a location saved to a variable with its name. target_var is an object with value ,type and context as string values and a bool global which determines if the variable is global or not. |
Effect | Description |
---|---|
sound_effect: sound_effect_id_string , optional sound_effect_variant: variant_string , optional outdoor_event: outdoor_event ,optional volume: volume_int |
Will play a sound effect of id sound_effect_id_string and variant variant_string . If volume_int is defined it will be used otherwise 80 is the default. If outdoor_event (defaults to false) is true this will be less likely to play if the player is underground. |
open_dialogue , optional true_eocs: eocs_array , optional false_eocs: eocs_array . Opens up a dialog between the participants. This should only be used in effect_on_conditions. If the dialog is opened, then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
|
take_control , optional true_eocs: eocs_array , optional false_eocs: eocs_array . If the npc is a character then take control of them and then all of the effect_on_conditions in true_eocs are run, otherwise all the effect_on_conditions in false_eocs are run. |
|
take_control_menu . Opens up a menu to choose a follower to take control of. |
|
assign_mission: mission_type_id string |
Will assign mission mission_type_id to the player. |
remove_active_mission: mission_type_id string |
Will remove mission mission_type_id from the player's active mission list without failing it. |
finish_mission: mission_type_id string ,(optional success: success_bool ), (*optional step: step_int ) |
Will complete mission mission_type_id to the player as a success if success is true, as a failure otherwise. If a step is provided that step of the mission will be completed. |
offer_mission" mission_type_id string or array . Adds mission_type_id(s) to the npc's missions that they offer. |
|
run_eocs : effect_on_condition_array or single effect_condition_object |
Will run up all members of the effect_on_condition_array . Members should either be the id of an effect_on_condition or an inline effect_on_condition. |
queue_eocs : effect_on_condition_array or single effect_condition_object , time_in_future: time_in_future_int or string or variable_object |
Will queue up all members of the effect_on_condition_array . Members should either be the id of an effect_on_condition or an inline effect_on_condition. Members will be run time_in_future seconds or if it is a string the future values of them or if they are variable objects the variable they name. If the eoc is global the avatar will be u and npc will be invalid. Otherwise it will be queued for the current alpha if they are a character and not be queued otherwise. |
u_run_npc_eocs or npc_run_npc_eocs : effect_on_condition_array , (optional unique_ids: unique_ids_string_array ), (optional npcs_must_see: npcs_must_see_bool ), (optional npc_range: npc_range_int ), (optional local: local_bool ) |
Will run all members of the effect_on_condition_array on npcs. Members should either be the id of an effect_on_condition or an inline effect_on_condition. If local (default: false) is false, then regardless of location all npcs with unique ids in the array unique_ids will be affected. If local is true, only unique_ids listed in unique_ids will be affected, if it is empty all npcs in range will be effected. If a value is given for npc_range the npc must be that close to the source and if npcs_must_see (defaults to false) is true the npc must be able to see the source. For u_run_npc_eocs u is the source for npc_run_npc_eocs it is the npc. |
weighted_list_eocs: array_array |
Will choose one of a list of eocs to activate based on weight. Members should be an array of first the id of an effect_on_condition or an inline effect_on_condition and second an object that resolves to an integer weight. |
Example: This will cause "EOC_SLEEP" 1/10 as often as it makes a test message appear. |
"effect": [
{
"weighted_list_eocs": [
[ "EOC_SLEEP", { "const": 1 } ],
[ {
"id": "eoc_test2",
"effect": [ { "u_message": "A test message appears!", "type": "bad" } ]
},
{ "const": 10 }
]
]
}
]
Effect | Description |
---|---|
deny_follow deny_lead deny_train deny_personal_info |
Sets the appropriate effect on the NPC for a few hours. These are deprecated in favor of the more flexible npc_add_effect described above. |
{ "topic": "TALK_EVAC_GUARD3_HOSTILE", "effect": [ { "u_faction_rep": -15 }, { "npc_change_faction": "hells_raiders" } ] }
{ "text": "Let's trade then.", "effect": "start_trade", "topic": "TALK_EVAC_MERCHANT" },
{ "text": "What needs to be done?", "topic": "TALK_CAMP_OVERSEER", "effect": { "companion_mission": "FACTION_CAMP" } }
{ "text": "Do you like it?", "topic": "TALK_CAMP_OVERSEER", "effect": [ { "u_add_effect": "concerned", "duration": 600 }, { "npc_add_effect": "touched", "duration": 3600 }, { "u_add_effect": "empathetic", "duration": "PERMANENT" } ] }
As a special effect, an NPC's opinion of your character can change. Use the following:
trust, value, fear, and anger are optional keywords inside the opinion object. Each keyword must be followed by a numeric value. The NPC's opinion is modified by the value.
{ "effect": "follow", "opinion": { "trust": 1, "value": 1 }, "topic": "TALK_DONE" }
{ "topic": "TALK_DENY_FOLLOW", "effect": "deny_follow", "opinion": { "fear": -1, "value": -1, "anger": 1 } }
trust, value, fear, and anger are optional keywords inside the mission_opinion
object. Each keyword must be followed by a numeric value. The NPC's opinion is modified by the value.
Conditions can be a simple string with no other values, a key and an int, a key and a string, a key and an array, or a key and an object. Arrays and objects can nest with each other and can contain any other condition.
The following keys and simple strings are available:
Condition | Type | Description |
---|---|---|
"and" |
array | true if every condition in the array is true. Can be used to create complex condition tests, like "[INTELLIGENCE 10+][PERCEPTION 12+] Your jacket is torn. Did you leave that scrap of fabric behind?" |
"or" |
array | true if any condition in the array is true. Can be used to create complex condition tests, like "[STRENGTH 9+] or [DEXTERITY 9+] I'm sure I can handle one zombie." |
"not" |
object | true if the condition in the object or string is false. Can be used to create complex conditions test by negating other conditions, for text such as"[INTELLIGENCE 7-] Hitting the reactor with a hammer should shut it off safely, right?" |
These conditions can be tested for the player using the "u_"
form, and for the NPC using the "npc_"
form.
variable_object
: This is an object describing a variable name. default
is a required int which will be the value returned if the variable is not defined.
example json:
"condition": { "u_has_strength": { "name" :"variable_name", "type":"test", "context":"documentation", "default":5 } }
Condition | Type | Description |
---|---|---|
"u_male" "npc_male" |
simple string | true if the player character or NPC is male. |
"u_female" "npc_female" |
simple string | true if the player character or NPC is female. |
"u_at_om_location" "npc_at_om_location" |
string | true if the player character or NPC is standing on an overmap tile with u_at_om_location 's id. The special string "FACTION_CAMP_ANY" changes it to return true if the player or NPC is standing on a faction camp overmap tile. The special string "FACTION_CAMP_START" changes it to return true if the overmap tile that the player or NPC is standing on can be turned into a faction camp overmap tile. |
"u_has_trait" "npc_has_trait" |
string | true if the player character or NPC has a specific trait. Simpler versions of u_has_any_trait and npc_has_any_trait that only checks for one trait. |
"u_has_flag" "npc_has_flag" |
string | true if the player character or NPC has the specified character flag. The special trait flag "MUTATION_THRESHOLD" checks to see if the player or NPC has crossed a mutation threshold. |
"u_has_any_trait" "npc_has_any_trait" |
array | true if the player character or NPC has any trait or mutation in the array. Used to check multiple specific traits. |
"u_has_var" , "npc_has_var" |
string | "type": type_str , "context": context_str , and "value": value_str are required fields in the same dictionary as "u_has_var" or "npc_has_var" .true is the player character or NPC has a variable set by "u_add_var" or "npc_add_var" with the string, type_str , context_str , and value_str . |
"u_compare_var" , "npc_compare_var" |
dictionary | "type": type_str , "context": context_str , "op": op_str , "value": value_num or variable_object are required fields, referencing a var as in "u_add_var" or "npc_add_var" .true if the player character or NPC has a stored variable that is true for the provided operator op_str (one of == , != , < , > , <= , >= ) and value (or the value of the variable described by value see variable_object above). |
"u_compare_time_since_var" , "npc_compare_time_since_var_" |
dictionary | "type": type_str , "context": context_str , "op": op_str , "time": time_string are required fields, referencing a var as in "u_add_var" or "npc_add_var" .true if the player character or NPC has a stored variable and the current turn and that value (converted to a time point) plus the time_string is true for the provided operator op_str (one of == , != , < , > , <= , >= ). example: { "u_compare_time_since_var": "test", "type": "test", "context": "var_time_test", "op": ">", "time": "3 days" } returns true if the player character has a "test", "test", "var_time_test" variable and the current turn is greater than that value plus 3 days' worth of turns. |
"compare_string" |
array | The array must contain exactly two entries. They can be either strings or objects containing a variable object. Returns true if the strings are the same. |
"u_has_strength" "npc_has_strength" |
int or variable_object | true if the player character's or NPC's strength is at least the value of u_has_strength or npc_has_strength (or the value of the variable described see variable_object above). |
"u_has_dexterity" "npc_has_dexterity" |
int or variable_object | true if the player character's or NPC's dexterity is at least the value of u_has_dexterity or npc_has_dexterity ( or the value of the variable described see variable_object above). |
"u_has_intelligence" "npc_has_intelligence" |
int or variable_object | true if the player character's or NPC's intelligence is at least the value of u_has_intelligence or npc_has_intelligence ( or the value of the variable described see variable_object above). |
"u_has_perception" "npc_has_perception" |
int or variable_object | true if the player character's or NPC's perception is at least the value of u_has_perception or npc_has_perception ( or the value of the variable described see variable_object above). |
"u_has_item" "npc_has_item" |
string | true if the player character or NPC has something with u_has_item 's or npc_has_item 's item_id in their inventory. |
"u_has_items" "npc_has_item" |
dictionary | u_has_items or npc_has_items must be a dictionary with an item string and a count int or charges int.true if the player character or NPC has at least charges charges or counts of item in their inventory. |
"u_has_item_category" "npc_has_item_category" |
string | "count": item_count is an optional field that must be in the same dictionary and defaults to 1 if not specified. true if the player or NPC has item_count items with the same category as u_has_item_category or npc_has_item_category . |
"u_has_bionics" "npc_has_bionics" |
string | true if the player or NPC has an installed bionic with an bionic_id matching "u_has_bionics" or "npc_has_bionics" . The special string "ANY" returns true if the player or NPC has any installed bionics. |
"u_has_effect" "npc_has_effect" , (optional intensity : int ),(optional bodypart : string ) |
string | true if the player character or NPC is under the effect with u_has_effect or npc_has_effect 's effect_id . If intensity is specified it will need to be at least that strong. If bodypart is specified it will check only that bodypart for the effect. |
"u_can_stow_weapon" "npc_can_stow_weapon" |
simple string | true if the player character or NPC is wielding a weapon and has enough space to put it away. |
"u_has_weapon" "npc_has_weapon" |
simple string | true if the player character or NPC is wielding a weapon. |
"u_driving" "npc_driving" |
simple string | true if the player character or NPC is operating a vehicle. Note NPCs cannot currently operate vehicles. |
"u_has_skill" "npc_has_skill" |
dictionary | u_has_skill or npc_has_skill must be a dictionary with a skill string and a level int.true if the player character or NPC has at least the value of level in skill . |
"u_know_recipe" |
string | true if the player character knows the recipe specified in u_know_recipe . It only counts as known if it is actually memorized--holding a book with the recipe in it will not count. |
"u_has_worn_with_flag" "npc_has_worn_with_flag" |
string | true if the player character or NPC is wearing something with the u_has_worn_with_flag or npc_has_worn_with_flag flag. |
"u_has_wielded_with_flag" "npc_has_wielded_with_flag" |
string | true if the player character or NPC is wielding something with the u_has_wielded_with_flag or npc_has_wielded_with_flag flag. |
"u_can_see" "npc_can_see" |
simple string | true if the player character or NPC is not blind and is either not sleeping or has the see_sleep trait. |
"u_is_deaf" "npc_is_deaf" |
int | true if the player character or NPC can't hear. |
the value of u_has_focus or npc_has_focus ( or the value of the variable described see variable_object above). |
||
"u_is_on_terrain" "npc_is_on_terrain" |
string | true if the player character or NPC is on terrain named "u_is_on_terrain" or "npc_is_on_terrain" . |
"u_is_in_field" "npc_is_in_field" |
string | true if the player character or NPC is in a field of type "u_is_in_field" or "npc_is_in_field" .. |
"u_query" "npc_query", default : bool |
string | if the player character or NPC is the avatar will popup a yes/no query with the provided message and users response is used as the return value. If called for a non avatar will return default . |
example |
"condition": { "u_query": "Should we test?", "default": true },
Condition | Type | Description |
---|---|---|
"u_has_mission" |
string | true if the mission is assigned to the player character. |
"u_has_cash" |
int or variable_object | true if the player character has at least u_has_cash ( or the value of the variable described see variable_object above) cash available. Deprecated Previously used to check if the player could buy something, but NPCs shouldn't use e-cash for trades anymore. |
"u_are_owed" |
int or variable_object | true if the NPC's op_of_u.owed is at least u_are_owed ( or the value of the variable described see variable_object above). Can be used to check if the player can buy something from the NPC without needing to barter anything. |
"u_has_camp" |
simple string | true is the player has one or more active base camps. |
"u_has_faction_trust" |
int | true if the player character has at least the given amount of trust with the speaker's faction. |
Condition | Type | Description |
---|---|---|
"at_safe_space" or "u_at_safe_space" or "npc_at_safe_space" |
simple string | true if u or the NPC's current overmap location passes the is_safe() test. |
"has_assigned_mission" |
simple string | true if the player character has exactly one mission from the NPC. Can be used for texts like "About that job...". |
"has_many_assigned_missions" |
simple string | true if the player character has several mission from the NPC (more than one). Can be used for texts like "About one of those jobs..." and to switch to the "TALK_MISSION_LIST_ASSIGNED" topic. |
"has_no_available_mission" or "npc_has_no_available_mission" or "u_has_no_available_mission" |
simple string | true if u or the NPC has no jobs available for the player character. |
"has_available_mission" or "u_has_available_mission" or "npc_has_available_mission" |
simple string | true if u or the NPC has one job available for the player character. |
"has_many_available_missions" |
simple string | true if the NPC has several jobs available for the player character. |
"mission_goal" or "npc_mission_goal" or "u_mission_goal" |
string | true if u or the NPC's current mission has the same goal as mission_goal . |
"mission_complete" or "npc_mission_complete" or "u_mission_complete" |
simple string | true if u or the NPC has completed the other's current mission. |
"mission_incomplete" or "npc_mission_incomplete" or "u_mission_incomplete" |
simple string | true if u or the NPC hasn't completed the other's current mission. |
"mission_has_generic_rewards" |
simple string | true if the NPC's current mission is flagged as having generic rewards. |
"npc_service" |
int | true if the NPC does not have the "currently_busy" effect and the player character has at least npc_service cash available. Useful to check if the player character can hire an NPC to perform a task that would take time to complete. Functionally, this is identical to "and": [ { "not": { "npc_has_effect": "currently_busy" } }, { "u_has_cash": service_cost } ] |
"npc_allies" |
int or variable_object | true if the player character has at least npc_allies (or the value of the variable described; see variable_object above) number of NPC allies within the reality bubble. |
"npc_allies_global" |
int or variable_object | true if the player character has at least npc_allies_global (or the value of the variable as above) number of NPC allies anywhere. |
"is_by_radio" |
simple string | true if the player is talking to the NPC over a radio. |
"u_available" or "npc_available" |
simple string | true if u or the NPC does not have effect "currently_busy" . |
"u_following" or "npc_following" |
simple string | true if u or the NPC is following the player character. |
"u_friend" or "npc_friend" |
simple string | true if u or the NPC is friendly to the player character. |
"u_hostile" or "npc_hostile" |
simple string | true if u or the NPC is an enemy of the player character. |
"u_train_skills" or "npc_train_skills" |
simple string | true if u or the NPC has one or more skills with more levels than the player. |
"u_train_styles" or "npc_train_styles" |
simple string | true if u or the NPC knows one or more martial arts styles that the player does not know. |
"u_has_class" or "npc_has_class" |
array | true if u or the NPC is a member of an NPC class. |
"u_near_om_location" or "npc_near_om_location" , (optional range : int or variable_object ) |
string | same as at_om_location except it checks in a square stretching from the character range OMT's. NOTE: can only check OMT's in the reality bubble. |
"u_aim_rule" or "npc_aim_rule" |
string | true if u or the NPC follower AI rule for aiming matches the string. |
"u_engagement_rule" or "npc_engagement_rule" |
string | true if u or the NPC follower AI rule for engagement matches the string. |
"u_cbm_reserve_rule" or "npc_cbm_reserve_rule" |
string | true if u or the NPC follower AI rule for cbm, reserve matches the string. |
"u_cbm_recharge_rule" or "npc_cbm_recharge_rule" |
string | true if u or the NPC follower AI rule for cbm recharge matches the string. |
"u_rule" or "npc_rule" |
string | true if u or the NPC follower AI rule for that matches string is set. |
"u_override" or "npc_override" |
string | true if u or the NPC has an override for the string. |
"has_pickup_list" or "u_has_pickup_list" or "npc_has_pickup_list" |
string | true if u or the NPC has a pickup list. |
Condition | Type | Description |
---|---|---|
"npc_role_nearby" |
string | true if there is an NPC with the same companion mission role as npc_role_nearby within 100 tiles. |
"has_reason" |
simple string | true if a previous effect set a reason for why an effect could not be completed. |
Condition | Type | Description |
---|---|---|
"days_since_cataclysm" |
int or variable_object | true if at least days_since_cataclysm ( or the value of the variable described see variable_object above) days have passed since the Cataclysm. |
"is_season" |
string | true if the current season matches is_season , which must be one of "spring" , "summer" , "autumn" , or "winter" . |
"is_day" |
simple string | true if it is currently daytime. |
"u_is_outside" "npc_is_outside" |
simple string | true if you or the NPC is on a tile without a roof. |
"u_is_underwater" "npc_is_underwater" |
simple string | true if you or the NPC is underwater. |
"one_in_chance" |
int or variable_object | true if a one in one_in_chance ( or the value of the variable described see variable_object above) random chance occurs. |
"x_in_y_chance" |
object | true if a x in y random chance occurs. x and y are either ints or variable_object s ( see variable_object above). |
"is_weather" |
int or variable_object | true if current weather is "is_weather" . |
"compare_int"
can be used to compare two values to each other, while "arithmetic"
can be used to take up to two values, perform arithmetic on them, and then save them in a third value. The syntax is as follows.
{
"text": "If player strength is more than or equal to 5, sets time since cataclysm to the player's focus times the player's maximum mana with at maximum a value of 15.",
"topic": "TALK_DONE",
"condition": { "compare_int": [ { "u_val": "strength" }, ">=", { "const": 5 } ] }
"effect": { "arithmetic": [ { "time_since_cataclysm": "turns" }, "=", { "u_val": "focus" }, "*", { "u_val": "mana_max" } ], "max":15 }
},
min
and max
are optional int or variable_object values. If supplied they will limit the result, it will be no lower than min
and no higher than max
. min_time
and max_time
work the same way but will parse times written as a string i.e. "10 hours".
"compare_int"
supports the following operators: "=="
, "="
(Both are treated the same, as a compare), "!="
, "<="
, ">="
, "<"
, and ">"
.
"arithmetic"
supports the following operators: "*"
, "/"
, "+"
, "-"
, "%"
, "&"
, "|"
, "<<"
, ">>"
, "~"
, "^"
and the following results "="
, "*="
, "/="
, "+="
, "-="
, "%="
, "++"
, and "--"
To get player character properties, use "u_val"
. To get NPC properties, use same syntax but "npc_val"
instead. For vars only global_val
is also allowed. A list of values that can be read and/or written to follows.
Example | Description |
---|---|
"const": 5 |
A constant value, in this case 5. Can be read but not written to. |
"time": "5 days" |
A constant time value. Will be converted to turns. Can be read but not written to. |
"time_since_cataclysm": "turns" |
Time since the start of the cataclysm in turns. Can instead take other time units such as minutes, hours, days, weeks, seasons, and years. |
"rand": 20 |
A random value between 0 and a given value, in this case 20. Can be read but not written to. |
"weather": "temperature" |
Current temperature. |
"weather": "windpower" |
Current windpower. |
"weather": "humidity" |
Current humidity. |
"weather": "pressure" |
Current pressure. |
"u_val": "strength" |
Player character's strength. Can be read but not written to. Replace "strength" with "dexterity" , "intelligence" , or "perception" to get such values. |
"u_val": "strength_base" |
Player character's strength. Replace "strength_base" with "dexterity_base" , "intelligence_base" , or "perception_base" to get such values. |
"u_val": "strength_bonus" |
Player character's current strength bonus. Replace "strength_bonus" with "dexterity_bonus" , "intelligence_bonus" , or "perception_bonus" to get such values. |
"u_val": "var" |
Custom variable. "var_name" , "type" , and "context" must also be specified. If global_val is used then a global variable will be used. If default is given as either an int or a variable_object then that value will be used if the variable is empty. If default_time is the same thing will happen, but it will be parsed as a time string aka "10 hours". Otherwise 0 will be used if the variable is empty. |
"u_val": "time_since_var" |
Time since a custom variable was set. Unit used is turns. "var_name" , "type" , and "context" must also be specified. |
"u_val": "allies" |
Number of allies the character has. Only supported for the player character. Can be read but not written to. |
"u_val": "cash" |
Amount of money the character has. Only supported for the player character. Can be read but not written to. |
"u_val": "owed" |
Owed money to the NPC you're talking to. |
"u_val": "sold" |
Amount sold to the NPC you're talking to. |
"u_val": "skill_level" |
Level in given skill. "skill" must also be specified. |
"u_val": "pos_x" |
Player character x coordinate. "pos_y" and "pos_z" also works as expected. |
"u_val": "pain" |
Pain level. |
"u_val": "power" |
Bionic power in millijoule. |
"u_val": "power_max" |
Max bionic power in millijoule. Can be read but not written to. |
"u_val": "power_percentage" |
Percentage of max bionic power. Should be a number between 0 to 100. |
"u_val": "morale" |
The current morale. Can be read but not written to for players and for monsters can be read and written to. |
"u_val": "mana" |
Current mana. |
"u_val": "mana_max" |
Max mana. Can be read but not written to. |
"u_val": "hunger" |
Current perceived hunger. Can be read but not written to. |
"u_val": "thirst" |
Current thirst. |
"u_val": "stored_kcal" |
Stored kcal in the character's body. 55'000 is considered healthy. |
"u_val": "stored_kcal_percentage" |
a value of 100 represents 55'000 kcal, which is considered healthy. |
"u_val": "item_count" |
Number of a given item in the character's inventory. "item" must also be specified. Can be read but not written to. |
"u_val": "exp" |
Total experience earned. |
"u_val": "addiction_intensity", "addiction": "caffeine" |
Current intensity of the given addiction. Allows for an optional field "mod" which accepts an integer to multiply againt the current intensity. |
"u_val": "addiction_turns", "addiction": "caffeine" |
Current duration left (in turns) for the given addiction. |
"u_val": "stim" |
Current stim level. |
"u_val": "pkill" |
Current painkiller level. |
"u_val": "rad" |
Current radiation level. |
"u_val": "focus" |
Current focus level. |
"u_val": "activity_level" |
Current activity level index, from 0-5 |
"u_val": "fatigue" |
Current fatigue level. |
"u_val": "stamina" |
Current stamina level. |
"u_val": "sleep_deprivation" |
Current sleep deprivation level. |
"u_val": "anger" |
Current anger level, only works for monsters. |
"u_val": "friendly" |
Current friendly level, only works for monsters. |
"u_val": "vitamin" |
Current vitamin level. name must also be specified which is the vitamins id. |
"u_val": "age" |
Current age in years. |
"u_val": "bmi_permil" |
Current BMI per mille (Body Mass Index x 1000) |
"u_val": "height" |
Current height in cm. When setting there is a range for your character size category. Setting it too high or low will use the limit instead. For tiny its 58, and 87. For small its 88 and 144. For medium its 145 and 200. For large its 201 and 250. For huge its 251 and 320. |
"u_val": "monsters_nearby" |
Number of monsters nearby. Optional params: target_var is a variable_object of a location variable to center the effect on, id is a variable_object, if its provided only monsters with this id will be counted, radius a variable_object of how far around the center to count from. |
"distance": [] |
Distance between two targets. Valid targets are: "u","npc" and an object with a variable name. |
"hour" |
Hours since midnight. |
"moon" |
Phase of the moon. MOON_NEW =0, WAXING_CRESCENT =1, HALF_MOON_WAXING =2, WAXING_GIBBOUS =3, FULL =4, WANING_GIBBOUS =5, HALF_MOON_WANING =6, WANING_CRESCENT =7 |
"arithmetic" |
An arithmetic expression with no result. |
"condition": { "compare_int": [ { "distance": [ "u",{ "u_val": "stuck", "type": "ps", "context": "teleport" } ] }, ">", { "const": 5 } ] }
"real_count": { "arithmetic": [ { "arithmetic": [ { "const":1 }, "+", { "const": 1 } ] }, "+", { "const": 1 } ] },
{
"text": "Understood. I'll get those antibiotics.",
"topic": "TALK_NONE",
"condition": { "npc_has_effect": "infected" }
},
{
"text": "I'm sorry for offending you. I predict you will feel better in exactly one hour.",
"topic": "TALK_NONE",
"effect": { "npc_add_effect": "deeply_offended", "duration": 600 }
},
{
"text": "Nice to meet you too.",
"topic": "TALK_NONE",
"effect": { "u_add_effect": "has_met_example_NPC", "duration": "PERMANENT" }
},
{
"text": "Nice to meet you too.",
"topic": "TALK_NONE",
"condition": {
"not": {
"npc_has_var": "has_met_PC", "type": "general", "context": "examples", "value": "yes"
}
},
"effect": {
"npc_add_var": "has_met_PC", "type": "general", "context": "examples", "value": "yes" }
}
},
{
"text": "[INT 11] I'm sure I can organize salvage operations to increase the bounty scavengers bring in!",
"topic": "TALK_EVAC_MERCHANT_NO",
"condition": { "u_has_intelligence": 11 }
},
{
"text": "[STR 11] I punch things in face real good!",
"topic": "TALK_EVAC_MERCHANT_NO",
"condition": { "and": [ { "not": { "u_has_intelligence": 7 } }, { "u_has_strength": 11 } ] }
},
{ "text": "Maybe later.", "topic": "TALK_RANCH_WOODCUTTER", "condition": "npc_available" },
{
"text": "[$8] I'll take a beer",
"topic": "TALK_DONE",
"condition": { "u_has_cash": 800 },
"effect": { "u_buy_item": "beer", "container": "bottle_glass", "count": 2, "cost": 800 }
},
{
"text": "Okay. Lead the way.",
"topic": "TALK_DONE",
"condition": { "not": "at_safe_space" },
"effect": "lead_to_safety"
},
{
"text": "About one of those missions...",
"topic": "TALK_MISSION_LIST_ASSIGNED",
"condition": { "and": [ "has_many_assigned_missions", { "u_is_wearing": "badge_marshal" } ] }
},
{
"text": "[MISSION] The captain sent me to get a frequency list from you.",
"topic": "TALK_OLD_GUARD_NEC_COMMO_FREQ",
"condition": {
"and": [
{ "u_is_wearing": "badge_marshal" },
{ "u_has_mission": "MISSION_OLD_GUARD_NEC_1" },
{ "not": { "u_has_effect": "has_og_comm_freq" } }
]
}
},
{
"text": "I killed them. All of them.",
"topic": "TALK_MISSION_SUCCESS",
"condition": {
"and": [ { "or": [ { "mission_goal": "KILL_MONSTER_SPEC" }, { "mission_goal": "KILL_MONSTER_TYPE" } ] }, "mission_complete" ]
},
"switch": true
},
{
"text": "Glad to help. I need no payment.",
"topic": "TALK_NONE",
"effect": "clear_mission",
"mission_opinion": { "trust": 4, "value": 3 },
"opinion": { "fear": -1, "anger": -1 }
},
{
"text": "Maybe you can teach me something as payment?",
"topic": "TALK_TRAIN",
"condition": { "or": [ "npc_train_skills", "npc_train_styles" ] },
"effect": "mission_reward"
},
{
"truefalsetext": {
"true": "I killed him.",
"false": "I killed it.",
"condition": { "mission_goal": "ASSASSINATE" }
},
"condition": {
"and": [
"mission_incomplete",
{
"or": [
{ "mission_goal": "ASSASSINATE" },
{ "mission_goal": "KILL_MONSTER" },
{ "mission_goal": "KILL_MONSTER_SPEC" },
{ "mission_goal": "KILL_MONSTER_TYPE" }
]
}
]
},
"trial": { "type": "LIE", "difficulty": 10, "mod": [ [ "TRUST", 3 ] ] },
"success": { "topic": "TALK_NONE" },
"failure": { "topic": "TALK_MISSION_FAILURE" }
},
{
"text": "Didn't you say you knew where the Vault was?",
"topic": "TALK_VAULT_INFO",
"condition": { "not": { "u_has_var": "asked_about_vault", "value": "yes", "type": "sentinel", "context": "old_guard_rep" } },
"effect": [
{ "u_add_var": "asked_about_vault", "value": "yes", "type": "sentinel", "context": "old_guard" },
{ "mapgen_update": "hulk_hairstyling", "om_terrain": "necropolis_a_13", "om_special": "Necropolis", "om_terrain_replace": "field", "z": 0 }
]
},
{
"text": "Why do zombies keep attacking every time I talk to you?",
"topic": "TALK_RUN_AWAY_MORE_ZOMBIES",
"condition": { "u_has_var": "even_more_zombies", "value": "yes", "type": "trigger", "context": "learning_experience" },
"effect": [
{ "mapgen_update": [ "even_more_zombies", "more zombies" ], "origin_npc": true },
{ "mapgen_update": "more zombies", "origin_npc": true, "offset_x": 1 },
{ "mapgen_update": "more zombies", "origin_npc": true, "offset_x": -1 },
{ "mapgen_update": "more zombies", "origin_npc": true, "offset_y": 1 },
{ "mapgen_update": "more zombies", "origin_npc": true, "offset_y": -1 }
]
}