//***************************************************************************************************************
//THIS IS A SET OF SEVERAL SCRIPTS, INSTRUCTIONS WITHIN!
//***************************************************************************************************************
//Name: Persuation script(s)
//Function: Makes persuade only happen 1 time. No infinite persuading chances
anymore.
//
//Notes: Can be reused in any conversation. Only restriction would be that the
NPC can only have one persuation branch because if the PC fails all their //persuation
branches will no longer show up.
//
//This is actually 3 main scripts and an optional 4th script.
//
//Part 1
//
//Use: Put this in the "Actions Taken" of the 'Persuade' dialogue.
//::///////////////////////////////////////////////
//:: FileName cd_persuade_10
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Stive5115
//:: Purpose: To make a DC 10 Persduasion check
//:: that is completely reusable.
//:://////////////////////////////////////////////
void main()
{
int numRolled = d20(1); // The PC Die Roll
int charismaMod = GetAbilityModifier(ABILITY_CHARISMA, GetPCSpeaker());
int persuationRank = GetSkillRank(SKILL_PERSUADE, GetPCSpeaker());
// String for specific NPC you are persuading
string ap = "attemptedPersuade_" + GetName(OBJECT_SELF);
// Success on Persuade
if(numRolled + charismaMod + persuationRank >= 10)
{
SetLocalInt(GetPCSpeaker(), "persuade", 1);
SetLocalInt(GetPCSpeaker(), ap, 2);
}
//Persuade Failure
else
{
SetLocalInt(GetPCSpeaker(), "persuade", 0);
SetLocalInt(GetPCSpeaker(), ap, 1);
}
}
//Part 2
//Use: Put this in the "Text appears when..." of the 'Persuade' dialogue.
//::///////////////////////////////////////////////
//:: FileName cd_persuaded_chk
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Stive5115
//:: Purpose: Returns true if the [Persuade]line of
//:: dialogue should be displayed.
//:: Prevents persuade from showing multiple times.
//:://////////////////////////////////////////////
int StartingConditional()
{
// String used for specific NPC that you are persuading
string ap = "attemptedPersuade_" + GetName(OBJECT_SELF);
// Inspect local variables
// On failure if Persuade
if((GetLocalInt(GetPCSpeaker(), ap) == 1))
return FALSE;
// On success of Persuade
else if((GetLocalInt(GetPCSpeaker(), ap) == 2))
return FALSE;
// Have not tried to persuade yet.
else
{
return TRUE;
}
}
//part 3
//Use: in the "Text Appears when..." of the 'Success' dialogue.
//::///////////////////////////////////////////////
//:: FileName cd_persuade_true
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Stive5115
//:: Purpose: Check if the persuade was a success.
//:://////////////////////////////////////////////
int StartingConditional()
{
// Inspect local variables
// Succeeded
if((GetLocalInt(GetPCSpeaker(), "persuade") == 1))
return TRUE;
// Failed
else
{
return FALSE;
}
}
//part 4
//Note: Part 4 is if you want the dialogue that showed up upon persuading them
to be allowed to show up in normal conversation with that NPC. So that //they
don't have to persuade them again (since that is impossible now.)
//
//Use: Create dialogue branch similiar to the persuade except no longer a
persuading branch. And just add this script to the "Text Appears When..."
//spot.
//::///////////////////////////////////////////////
//:: FileName cd_persuaded_bef
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Stive5115
//:: Purpose: If Persuade was a success.
//:: Then you can optionally display a
//:: dialogue tree without forcing the PC
//:: to persduade the NPC again.
//:://////////////////////////////////////////////
int StartingConditional()
{
// String used for specific NPC that you are persuading
string ap = "attemptedPersuade_" + GetName(OBJECT_SELF);
// Inspect local variables
// On success of Persuade
if((GetLocalInt(GetPCSpeaker(), ap) == 2))
return TRUE;
// Have failed/not persuaded yet.
else
{
return FALSE;
}
}
//Final Note: The optional script has yet to be tested, however it should work
perfectly. If you have any trouble PM me and I'll solve it. The rest of the
//script has been tested and found to work.