Tutorial: Dialogue Speech Checks
Sometimes in Skyrim, there are NPCs who offer the player some kind of reward or quest shortcut if you have a high enough Speechcraft skill (or money, in the case of a bribe). You knew that already. But how do we go about implementing this using the Creation Kit's dialogue system? Let's find out.
Before you Begin
The first step is to add your persuasion topic to the branch. Obviously, you need to put the player character's attempt to persuade the NPC in your topic text field. The conventional format in Skyrim is "Hello World! (Persuade)". Spell check will make sure you don't manage to spell 'persuade' wrong.
Now we need to add a minimum Speechcraft requirement that the player has to pass. To do this, we use conditions. So along with all the other conditions your 'positive response' info might have, add a new condition item with the function GetActorValue, the parameter here being Speechcraft. Of course, this function needs to run on the player. The comparison should be greater-than-or-equal-to (>=), and the value can be whatever you want, but for completeness it's best if you just choose one of the predetermined constant variables (SpeechVeryEasy, SpeechEasy etc). To select one of these, you need to have checked the Use Global box. You don't need to add an opposite condition to the 'negative response'.
That's all very well, but you still need to add a Papyrus fragment to make it a proper speech check that helps level up the Speech skill on a success and such. Type a comment into the begin box and hit compile to generate a script. Now add a property called something like 'pFDS' (that's short for Favor Dialogue Script). For the type, don't choose anything from the drop down menu, but instead type into the box 'FavorDialogueScript'. Leave the value blank, and hit Ok. If you did this right, you can now change the value to only one value called 'DialogueFavorGeneric' (that's the right one).
Finally, add this code to the begin fragment box:
Compile it and you're done. Fire up Skyrim, find you NPC (I only used Kleppr, the inkeeper at the Silver Blood Inn because I couldn't be bothered to create a new NPC) and test the speech check. You'll have to change your speechcraft skill around for this;
player.setav speechcraft n
Intimidation options are created using a process that is similar to persuasion options, however, the actor value you need to check for is different. On your successful intimidation response, create a GetIntimidateSuccess check, and have it check for GetIntimidateSuccess = 1.00. This will cause your successful intimidation response to trigger only if GetIntimidateSuccess returns 1 - i.e. only if it is successful according to the algorithm used by the game engine to calculate this, which takes into account variables such as the player's level and the speaker's confidence value, as well as the player's speechcraft skill and some other factors.
You should also be sure to add the following to your response's 'begin' script fragment. The script property should be set up the same way as for persuasion; the only difference is the actual Papyrus code used.
Finally, don't forget to add the suffix '(Intimidate)' to any intimidation topic texts in your plugin.
Bribery works in a slightly different way. You still need to add a pFDS property to the Papyrus fragment as described above, but this time, the begin box contains this code:
Along with any other conditions on the NPCs positive response, you need to run the function GetBribeSuccess on the subject, checking that it returns true. You also need to add '(<BribeCost> gold)' to the end of the topic text so that the player knows how much they have to pay.
You don't need to specify an amount of gold for the bribe, as the favor dialogue script will calculate a levelled amount and handle its removal from the player's inventory. If you want to have a specific bribe amount, or want to have options for the player to be a cheapskate and not offer enough gold, its best to do this other ways without favor dialogue.