Re: Skillcheck Modifiers
Posted: Mon Jun 19, 2023 10:56 am
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:
Then change the SkillCheck class's GetText() method:
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;
}
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}";
}