Skillcheck Modifiers

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Skillcheck Modifiers

Post by Tony Li »

Hi,

You can duplicate an existing Skill or SkillCheck asset, or right-click in the project view and select Create > Skill or Create > Skill Check. Make sure to put them in a folder named Resources.

The SkillCheck script has a method named GetText(). This is the text that gets added to the response button. You could modify the AdvancedSkillCheckExample script's OnConversationResponseMenu() method to show this text in a tooltip instead.

You could also modify the SkillCheck script's GetText() method to include text about the modifiers. Currently it just shows the skill name and the roll the player needs to get after applying all of the modifiers. But it doesn't show the modifiers themselves. To show the modifiers, add a string variable to the SkillCheckModifier class in the SkillCheck script:

Code: Select all

[Serializable]
public class SkillCheckModifier
{
    [VariablePopup] public string variable;
    public int modifierValue;
    public string description;
}
Then change the SkillCheck class's GetText() method:

Code: Select all

public string GetText()
{
    int requiredRoll = requiredValue - skill.value;
    string modifierText = "";
    foreach (var modifier in modifiers)
    {
        if (DialogueLua.GetVariable(modifier.variable).asBool)
        {
            requiredRoll -= modifier.modifierValue;
            modifierText = $"\n{modifier.description}"; // On a new line, add the modifier description.
        }
    }
    return $"[{skill.name} {requiredRoll}]{modifierText}";
}
DeidreReay
Posts: 93
Joined: Wed Jan 22, 2020 1:20 pm

Re: Skillcheck Modifiers

Post by DeidreReay »

Hello, Trying to make this example work then integrate something similar into our game, but having issues. I brought in the examples and can not see actually how things are set up in the dialogue system? I do not see any drop downs for selecting a skill check anywhere? The node says <Skill Check>, sequence says Continue() but there is nothing in any conditions or script filled out for that node or the cooresponding nodes below them? Is there something weird on my end due to maybe integrations with Quest machine? Or invector? This seems a great way to use skill checks, but can not figure this out. Is there perhaps an easier way to create some lua function extensions in a more straight forward manor compared to needing scriptables per check?
Attachments
4.PNG
4.PNG (190.84 KiB) Viewed 312 times
3.PNG
3.PNG (188.07 KiB) Viewed 312 times
2.PNG
2.PNG (212.08 KiB) Viewed 315 times
1.PNG
1.PNG (170.06 KiB) Viewed 315 times
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Skillcheck Modifiers

Post by Tony Li »

Hi,

The more typical way to do skill checks is here:

How To: Do Skill Checks in Conversations

(There are two examples in the direct download link in the second post. The second uses C# methods registered as Lua functions, which may be more appropriate to your case.)

If you want to use the approach in this thread instead, it relies on the script AdvancedSkillCheckExample located in the example's Scripts subfolder. The script is commented with a description of how it works. The "Bend the bars apart" node, for example, has a custom "Skill Check" field that's set to the dropdown value "Bend Bars". The script looks up this field and does a skill check.
DeidreReay
Posts: 93
Joined: Wed Jan 22, 2020 1:20 pm

Re: Skillcheck Modifiers

Post by DeidreReay »

Looking at the other example I still am not understanding how things are working out. That has some lua functions for a bool, and basically setting or checking if bool is false etc. Not actually seeing that there is a Intimidate skill, a roll (random range), then taking / checking that against what the goal would have been for success or not. Unless I am missing something, or have some issue on my end?
Is there some example that is like that? The first example (not in the pictues) Seemed to do a script to find x, and then check x in the following nodes to see what happened. I would very much like to see the lua functions that more or less do the same thing, then could try and tie our actual skills, stats, items, etc into that.

These images are from example 2. Which I do not understand how this is actually doing anything? Its just a bool that is not being changed or ?
Attachments
Script.PNG
Script.PNG (141.82 KiB) Viewed 305 times
3.PNG
3.PNG (216.71 KiB) Viewed 305 times
2.PNG
2.PNG (191.91 KiB) Viewed 305 times
1.PNG
1.PNG (79.09 KiB) Viewed 305 times
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Skillcheck Modifiers

Post by Tony Li »

Hi,

I just added a third example to How To: Do Skill Checks in Conversations that demonstrates how to use a Lua function GetLockpickSkill() that returns the player's current lockpick skill in the range 0-100. The conversation (in scene "Skill Check Example 3 Lockpick Lua Function") rolls a random number 0-100 to check if the player successfully picked the lock.

I didn't add this GetLockpickSkill() Lua function to the Custom Lua Function Info asset, but you could do that yourself. I just typed it into the text and conditions manually.
Post Reply