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

New dialogue trial type to check the level of a skill against a flat difficulty #56896

Merged
merged 1 commit into from
Apr 20, 2022
Merged

Conversation

Ilysen
Copy link
Contributor

@Ilysen Ilysen commented Apr 18, 2022

Summary

Infrastructure "Dialogues can now run skill checks using a given skill ID and difficulty"

Purpose of change

With NPCs becoming an increasing part of the game, I found the lack of something for this really glaring! CDDA is an RPG, and I think that it makes a lot of sense to allow for the character's skill progression to factor into talkers. This could be used in person-on-person dialogue, but can also be used for talking furniture and, later on, talking monsters and such.

Describe the solution

Added a new trial type, designated by the string SKILL_CHECK. It functions by checking the provided integer difficulty (already existed) against the player's current level in the skill designated by the ID skill_required. If the level is greater than or equal to difficulty, the check passes. Otherwise, it fails.

While these kinds of checks could already be done using EOCs to only present an option if the player has a certain skill, it doesn't show potential dialogue options that would become available if the player had a different level in their skill. In addition to opening up roleplay opportunities (like trying to make a special dish and failing badly at it, for instance), this also offers a neat thing for players to observe and keep in mind for later playthroughs or engagements, especially if the dialogue isn't time-sensitive; for instance, a broken machine of a special type might not be fixable with the player's current skill, but if they see that they could fix it if they had a higher electronics skill, they might come back later when they're more experienced.

Skill checks display using the required and current skill level in the line, such as [applied science 1/5] Test line. If the skill level is higher than the difficulty, it uses the difficulty instead of showing the higher number; i.e. an applied science level of 8 would display [applied science 5/5] Test line.

Describe alternatives you've considered

Two things I had considered for this PR are allowing theoretical knowledge to be checked as well as practical, and possibly having multiple skills checked in a single challenge. I decided against these both to stay in a modest scope, as well as because I couldn't think of any use cases in the current game.

The trial itself also doesn't currently have inline or special syntax to show different text depending on if the player would pass or fail the check. This currently needs to be done using truefalsetext, which I figured was sufficient for the moment, but ideally we could have a separate text type that handles it automatically, too.

Testing

I added the following response to the Hub 01 intercom's default topic.

      {
        "truefalsetext": {
          "condition": { "u_has_skill": { "skill": "swimming", "level": 3 } },
          "true": "You should let me in.  I'm swole af.",
          "false": "I'm… uh, totally super strong.  Let me in?"
        },
        "trial": { "type": "SKILL_CHECK", "difficulty": 3, "skill_required": "swimming" },
        "success": { "topic": "TALK_ROBOFAC_INTERCOM_SERVICES_FIRST" },
        "failure": { "topic": "TALK_DONE" }
      },

I used an existing debug world in which I had already completed the introductory quest. First, I set my athletics to 1 and opened the chat:
cataclysm-tiles_1qmb8CoG0K

The check failed when I selected it, and ended the dialogue due to the failure topic being TALK_DONE. Afterwards, I changed my athletics again, this time to 4, which put me above the required threshold to pass. Then I tried again:
cataclysm-tiles_T6rG9LoRRg

Selecting the skill challenge this time passed the check and correctly sent me to the services dialogue with the one-time response that the intercom usually gives when first opening up to the player ("We look forward to working with you.")

Editing the trial itself and the truefalsetext condition to use nonexistent skill IDs result in the check being unpassable and displaying nothing for the skill name and 0 for the skill itself, but it is otherwise harmless, producing no debug messages or errors.

Additional context

N/A

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Apr 18, 2022
@NetSysFire NetSysFire added the NPC / Factions NPCs, AI, Speech, Factions, Ownership label Apr 18, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 18, 2022
@kevingranade kevingranade merged commit 1d96e06 into CleverRaven:master Apr 20, 2022
@Ilysen Ilysen deleted the skill-checks branch April 21, 2022 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style <Documentation> Design documents, internal info, guides and help. json-styled JSON lint passed, label assigned by github actions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants