Permalink
Browse files

npctalk: add more conditions and dynamic line options

add options to generate dynamic lines and responses based on
whether the player has an item, the season of the year, whether
it is day or not, and the elapsed time since the cataclysm.
  • Loading branch information...
mlangsdorf committed Jan 2, 2019
1 parent e25c28e commit b1519e55c8715c8dfc7dda68c4cb39f4dc094401
Showing with 460 additions and 78 deletions.
  1. +96 −0 data/json/npcs/TALK_TEST.json
  2. +159 −72 doc/NPCs.md
  3. +128 −5 src/npctalk.cpp
  4. +77 −1 tests/npc_talk_test.cpp
@@ -79,6 +79,16 @@
"text": "This is a npc short trait test response.",
"topic": "TALK_DONE",
"condition": { "npc_has_trait": "ELFA_EARS" }
},
{
"text": "This is a trait flags test response.",
"topic": "TALK_DONE",
"condition": { "u_has_trait_flag": "CANNIBAL" }
},
{
"text": "This is a npc trait flags test response.",
"topic": "TALK_DONE",
"condition": { "npc_has_trait_flag": "CANNIBAL" }
}
]
},
@@ -165,6 +175,64 @@
{ "text": "This an error! npc allies 2 test response.", "topic": "TALK_DONE", "condition": { "npc_allies": 2 } }
]
},
{
"type": "talk_topic",
"id": "TALK_TEST_SEASON",
"dynamic_line": "This is a test conversation that shouldn't appear in the game.",
"responses": [
{ "text": "This is a basic test response.", "topic": "TALK_DONE" },
{
"text": "This is a season spring test response.",
"topic": "TALK_DONE",
"condition": { "is_season": "spring" }
},
{
"text": "This is a days since cataclysm 30 test response.",
"topic": "TALK_DONE",
"condition": { "days_since_cataclysm": 30 }
},
{
"text": "This is a season summer test response.",
"topic": "TALK_DONE",
"condition": { "is_season": "summer" }
},
{
"text": "This is a days since cataclysm 120 test response.",
"topic": "TALK_DONE",
"condition": { "days_since_cataclysm": 120 }
},
{
"text": "This is a season autumn test response.",
"topic": "TALK_DONE",
"condition": { "is_season": "autumn" }
},
{
"text": "This is a days since cataclysm 210 test response.",
"topic": "TALK_DONE",
"condition": { "days_since_cataclysm": 210 }
},
{
"text": "This is a season winter test response.",
"topic": "TALK_DONE",
"condition": { "is_season": "winter" }
},
{
"text": "This is a days since cataclysm 300 test response.",
"topic": "TALK_DONE",
"condition": { "days_since_cataclysm": 300 }
}
]
},
{
"type": "talk_topic",
"id": "TALK_TEST_TIME",
"dynamic_line": "This is a test conversation that shouldn't appear in the game.",
"responses": [
{ "text": "This is a basic test response.", "topic": "TALK_DONE" },
{ "text": "This is a is day test response.", "topic": "TALK_DONE", "condition": "is_day" },
{ "text": "This is a is night test response.", "topic": "TALK_DONE", "condition": { "not": "is_day" } }
]
},
{
"type": "talk_topic",
"id": "TALK_TEST_OR",
@@ -273,6 +341,34 @@
}
]
},
{
"type": "talk_topic",
"id": "TALK_TEST_HAS_ITEM",
"dynamic_line": "This is a test conversation that shouldn't appear in the game.",
"responses": [
{ "text": "This is a basic test response.", "topic": "TALK_DONE" },
{
"text": "This is a u_has_item beer test response.",
"topic": "TALK_DONE",
"condition": { "u_has_item": "beer" }
},
{
"text": "This is a u_has_item bottle_glass test response.",
"topic": "TALK_DONE",
"condition": { "u_has_item": "bottle_glass" }
},
{
"text": "This is a u_has_items beer test response.",
"topic": "TALK_DONE",
"condition": { "u_has_items": { "item": "beer", "count": 2 } }
},
{
"text": "Test failure! This is a u_has_items test response.",
"topic": "TALK_DONE",
"condition": { "u_has_items": { "item": "bottle_glass", "count": 2 } }
}
]
},
{
"type": "npc",
"id": "test_talker",
Oops, something went wrong.

0 comments on commit b1519e5

Please sign in to comment.