NWScript:
int RewardRolePlay( object oPC, int nResponse, int nAlignmentAxis=ALIGNMENT_GOOD, int nXPReward=20, int nAlignReward=1 );
int RewardRolePlay( object oPC, int nResponse, int nAlignmentAxis=ALIGNMENT_GOOD, int nXPReward=20, int nAlignReward=1 )
{
int nAlignmentValue;
int nAlignment;
int nAlignUp;
int nAlignDown;
int nMisAligned = -1;
if ( (!GetIsPC( oPC )) || (nXPReward < 0) || (nAlignReward < 0) )
{
return -1;
}
if ( (nAlignmentAxis == ALIGNMENT_GOOD) || (nAlignmentAxis == ALIGNMENT_EVIL) )
{
nAlignmentValue = GetGoodEvilValue( oPC );
nAlignment = GetAlignmentGoodEvil( oPC );
nAlignUp = ALIGNMENT_GOOD;
nAlignDown = ALIGNMENT_EVIL;
}
else if ( (nAlignmentAxis == ALIGNMENT_LAWFUL) || (nAlignmentAxis == ALIGNMENT_CHAOTIC) )
{
nAlignmentValue = GetLawChaosValue( oPC );
nAlignment = GetAlignmentLawChaos( oPC );
nAlignUp = ALIGNMENT_LAWFUL;
nAlignDown = ALIGNMENT_CHAOTIC;
}
else return -1;
if ( nAlignment == nResponse )
{
nMisAligned = 0;
GiveXPToCreature( oPC, nXPReward );
}
else
if ( (nAlignment == ALIGNMENT_NEUTRAL) || (nResponse == ALIGNMENT_NEUTRAL) )
{
nMisAligned = 1;
}
else
{
nMisAligned = 2;
}
if ( nResponse != ALIGNMENT_NEUTRAL )
{
AdjustAlignment( oPC, nResponse, nAlignReward*(1+nMisAligned/2) );
}
else
{
if ( nAlignmentValue > 50 )
{
AdjustAlignment( oPC, nAlignDown, nAlignReward );
}
else if ( nAlignmentValue < 50 )
{
AdjustAlignment( oPC, nAlignUp, nAlignReward );
}
}
return nMisAligned;
}
#include "aa_conv_rewards"
void main()
{
int nResponse = ALIGNMENT_EVIL;
int nAlignmentAxis = ALIGNMENT_GOOD;
int nXPReward = 20;
int nAlignReward = 1;
int nMisAligned = 0;
object oPC = GetPCSpeaker();
if ( GetLocalInt( oPC, "lr_reward" ) == FALSE )
{
nMisAligned = RewardRolePlay( oPC, nResponse, nAlignmentAxis, nXPReward, nAlignReward );
if ( nMisAligned >= 0 )
{
SetLocalInt( oPC, "lr_reward", TRUE + nMisAligned );
}
else
{
SendMessageToPC( oPC, "Response Reward System Failed" );
}
}
}