Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPC dialogue: wishin' for addition of conditions #27397

Closed
12 of 13 tasks
I-am-Erk opened this issue Jan 2, 2019 · 4 comments
Closed
12 of 13 tasks

NPC dialogue: wishin' for addition of conditions #27397

I-am-Erk opened this issue Jan 2, 2019 · 4 comments
Assignees
Labels
<Enhancement / Feature> New features, or enhancements on existing NPC / Factions NPCs, AI, Speech, Factions, Ownership <Suggestion / Discussion> Talk it out before implementing

Comments

@I-am-Erk
Copy link
Member

I-am-Erk commented Jan 2, 2019

Is your feature request related to a problem? Please describe.
NPC dialogue conditionals in dynamic line are a powerful way to control NPC dialogue, but the options are still not feature complete. I have a short list of conditionals I need to be able to work with for my background stories project, and these will certainly extend the utility of NPC dialogue options a lot going forward.

Describe the solution you'd like
I've broken these into a few categories.

  1. Conditionals I personally have immediate use for in dialogue I've already written:
  • u_has_item (maybe do an npc_has_item equivalent, although I don't have a use for it myself now): check if the user has a specific item. Awesome if this would allow checking for quantity as well.
  • it occurs to me that I also need a way to remove said item from player inventory, either u_remove_item to just delete it, or u_give_item to hand it over to the NPC. Both would be ideal.
  • npc_has_trait_flag (may as well do u_has_trait_flag too): positive if the NPC has a trait/mutation with a specific flag. Would make the framework of background stories and expertises much easier and more concise to write. JSON doesn't support wildcards so this would be just a work around. I would use this to add an error trap so that if an NPC didn't have any background story at all, they'd choose one from the universal list, and to make numerous places where the option to ask an NPC about their expertise - or challenge them on fakes - checks for the presence of any experise, or expertises of a certain type or level - rather than having to add a case for each possible expertise and level combination, which will result in thousands of lines of copy and pasted JSON code.
  • npc_spawn_age: a measure of when the NPC spawned relative to the first day of the game, in days(?). This is made complex because it needs to be a comparator rather than a boolean. An alternative that is less robust but still works would be something like "npc_spawn_after_year_1" or something. For my own uses this is to allow NPCs to unlock survival stories that describe more than their first few days of the cataclysm. Especially if it can be done in days or seasons and be a greater/less/equal comparison, I can see a huge number of other uses. Related to this and probably using the same code, discord had some suggestions about being able to use a similar flag to adjust the starting equipment and skills of NPCs after a year of survival, in class and item group definitions.
  • starting_npc: this flag would be true if an NPC was spawned with the player at the beginning of the game. Having this as an option would allow all kinds of new dialogue for NPCs that start alongside the player.
  • static_npc: true if the NPC was defined as a static NPC spawning with the map. Useful for error trapping - keeps the system from automatically assigning background stories to these NPCs for example. Can be combined with starting_npc to do some clever dialogue tricks in scenario starts.
  1. Conditionals I don't need immediately but I or others would like to see
  • is_day: returns true if it's daytime. Useful for shopkeepers for example. Doesn't have to know if the NPC can see the sky or a clock not because of the next one.
  • is_outside: returns true if the NPC can see the sky.
  • is_summer/is_spring/is_winter/is_autumn: returns true if it's currently that season. Obviously useful for flavour text at least, but I imagine there are also clever ways dialogue and missions can be structured with this. Thinking of the refugee ranch in particular

Describe alternatives you've considered
The only thing here I really need here immediately is the has_item flag. The trait_string one is complex but would be immensely useful in a ton of ways of implemented. Everything else is just cool at the moment, although many of them will see use from me pretty quickly.

Progress

  • u_has_item
  • u_sell_item/u_remove_item
  • npc_has_trait_flag
  • u_has_trait_flag
  • days_since_cataclysm
  • static NPC trait
  • starting NPC trait
  • hide traits in player display menu
  • is_day
  • is_outside
  • is_season
  • switches for responses
  • response trials based on any condition
@Night-Pryanik Night-Pryanik added <Enhancement / Feature> New features, or enhancements on existing NPC / Factions NPCs, AI, Speech, Factions, Ownership <Suggestion / Discussion> Talk it out before implementing labels Jan 2, 2019
@mlangsdorf mlangsdorf self-assigned this Jan 2, 2019
@mlangsdorf
Copy link
Contributor

npc_has_trait_string would be a pain to implement, but npc_has_trait_flag would be super easy to do. Then you could just flag the traits appropriately:

  {
    "type": "mutation",
    "id": "BGSS_Confused_1",
    "name": "Survivor",
    "points": 0,
    "description": "This NPC could tell you about how they survived the cataclysm",
    "valid": false,
    "purifiable": false,
    "flags": [ "BACKGROUND_STORY" ]
  },

@I-am-Erk
Copy link
Member Author

I-am-Erk commented Jan 2, 2019

Yep, flags would work just as well or possibly better.

@mlangsdorf
Copy link
Contributor

NPCs don't currently keep track of their birthdays, so npc_spawn_age is something of a non-starter.

I think what might work and be fairly flexible is the expanded trial idea I discussed earlier, and a days_since_cataclysm conditional. You could then set a trait or effect when the player first talks to the NPC, and that would influence their stories. Something like:

{
  "id": "TALK_SURVIVOR_STORY",
  "type": "talk_topic",
  "responses": [
    {
      "text": "<story_ask>",
      "trial": { "type": "CONDITION", "condition": { "npc_has_trait": "CHECKED_STORY" } },
      "success": { 
        "trial": { "type": "CONDITION", "condition": { "npc_has_trait": "SURVIVED_1_MONTH" } },
        "success": { "topic": "TALK_STORY_LONG" },
        "failure": { "topic": "TALK_STORY_SHORT" },
      },
      "failure": {
       "trial": { "type": "CONDITION", "condition": { "days_since_cataclysm": 30 } },
       "success": { "topic": "TALK_STORY_LONG", "effect": [ { "npc_add_trait": "SURVIVED_1_MONTH" }, { "npc_add_trait": "CHECKED_STORY" } ] },
       "failure": { "topic": "TALK_STORY_SHORT", "effect": { "npc_add_trait": "CHECKED_STORY" } },
      }
    }
  ]
}

which is kind of awful but what can you do.

@I-am-Erk
Copy link
Member Author

I-am-Erk commented Jan 2, 2019

I might be able to finagle something a bit slicker than that code at least by adding an effect or trait that the NPC gains when it is first spoken to. I don't need it quite yet so I'll think on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Enhancement / Feature> New features, or enhancements on existing NPC / Factions NPCs, AI, Speech, Factions, Ownership <Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants