Reverted back to Scarface's Reward system.
Reverted back to Scarface's Reward system. Scaled sf_xp out to 60 levels. Tweaked sc_xp GP rewards for unintelligent creatures & highly intelligent creatures. Full compile. Updated release archive.
This commit is contained in:
@@ -36,8 +36,7 @@ void RndDropGold(object oSelf, object oKiller)
|
||||
}
|
||||
|
||||
|
||||
//:: Take one off GetNumberPartyMembers(), see known bugs
|
||||
int nMembers = GetNumberPartyMembers(oKiller); //- 1;
|
||||
int nMembers = GetNumberPartyMembers(oKiller);
|
||||
|
||||
if (iIntB < 0) { iIntB = 1;}
|
||||
|
||||
@@ -127,8 +126,7 @@ void RndDropGear(object oSelf, object oKiller)
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("Not dropping shield", oKiller, FALSE);}
|
||||
bDropShield = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if (!GetIsObjectValid(oHelm))
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("Not dropping helmet", oKiller, FALSE);}
|
||||
@@ -201,7 +199,7 @@ void RndDropGear(object oSelf, object oKiller)
|
||||
!bDropLeftRing && !bDropRightRing)
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("No loot, running RndDropGold", oKiller, FALSE);}
|
||||
RndDropGold(oSelf, oKiller);
|
||||
//RndDropGold(oSelf, oKiller); //:: Alt liked scarface's better
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,6 +208,9 @@ void main()
|
||||
//:: Declare major variables
|
||||
object oKiller = GetLastKiller();
|
||||
object oSelf = OBJECT_SELF;
|
||||
|
||||
//:: Run GP / XP reward script
|
||||
ExecuteScript("sf_xp", oSelf);
|
||||
|
||||
if(DEBUG)
|
||||
{
|
||||
|
@@ -6,6 +6,8 @@
|
||||
All code created and written by Scarface
|
||||
*/
|
||||
//////////////////////////////////////////////////
|
||||
#include "inc_debug"
|
||||
#include "prc_inc_racial"
|
||||
|
||||
//:: CONSTANTS
|
||||
//:: You can adjust these constants to suit your module
|
||||
@@ -15,7 +17,7 @@
|
||||
// Setting this to 10 will give a similar XP amount to the default
|
||||
// bioware XP engines XP Slider.
|
||||
// Do NOT set this to 0
|
||||
const int XP_MODIFIER = 30;
|
||||
const int XP_MODIFIER = 40;
|
||||
|
||||
// Reward gold to players for killing creatures?
|
||||
// If TRUE use the GP_REWARD_MULTIPLIER const to multiply amount of gold rewarded
|
||||
@@ -72,12 +74,12 @@ const int PC_DIVIDE_XP = FALSE;
|
||||
// Minimum XP possible for all PC's
|
||||
// Default is 5 XP
|
||||
// Do NOT set this to 0
|
||||
const int MIN_XP = 50;
|
||||
const int MIN_XP = 5;
|
||||
|
||||
// Check XP to consider level or not?
|
||||
// Set to TRUE to check the PC's XP to consider level
|
||||
// Set to FALSE to only use their current level
|
||||
const int XP_CHECK = FALSE; //Default = FALSE (Use Hit Dice Not XP)
|
||||
const int XP_CHECK = TRUE; //Default = FALSE (Use Hit Dice Not XP)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// PC Level Max XP consts
|
||||
@@ -127,73 +129,109 @@ LEVEL_36_MAX_XP = 600,
|
||||
LEVEL_37_MAX_XP = 600,
|
||||
LEVEL_38_MAX_XP = 600,
|
||||
LEVEL_39_MAX_XP = 600,
|
||||
LEVEL_40_MAX_XP = 600; // No need for this really
|
||||
LEVEL_40_MAX_XP = 600,
|
||||
LEVEL_41_MAX_XP = 700,
|
||||
LEVEL_42_MAX_XP = 700,
|
||||
LEVEL_43_MAX_XP = 700,
|
||||
LEVEL_44_MAX_XP = 700,
|
||||
LEVEL_45_MAX_XP = 700,
|
||||
LEVEL_46_MAX_XP = 700,
|
||||
LEVEL_47_MAX_XP = 700,
|
||||
LEVEL_48_MAX_XP = 700,
|
||||
LEVEL_49_MAX_XP = 700,
|
||||
LEVEL_50_MAX_XP = 700,
|
||||
LEVEL_51_MAX_XP = 700,
|
||||
LEVEL_52_MAX_XP = 700,
|
||||
LEVEL_53_MAX_XP = 700,
|
||||
LEVEL_54_MAX_XP = 700,
|
||||
LEVEL_55_MAX_XP = 700,
|
||||
LEVEL_56_MAX_XP = 700,
|
||||
LEVEL_57_MAX_XP = 700,
|
||||
LEVEL_58_MAX_XP = 700,
|
||||
LEVEL_59_MAX_XP = 700,
|
||||
LEVEL_60_MAX_XP = 700;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//:: DO NOT TOUCH ANYTHING BELOW HERE !!!!!
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Declare the functions
|
||||
|
||||
//:: Declare functions
|
||||
int GetMaxXP(object oPC);
|
||||
|
||||
int CalculateXP(float fLevel, float fCR);
|
||||
|
||||
void GiveXP(object oKiller, int nXP, float fKillerBonus, int nDiff, int nPlayer);
|
||||
|
||||
int GetLevelFromXP(object oPC);
|
||||
void XPDebugMessage(object oPC, float fCR, int nDiff, int nLoLevel,
|
||||
int nHiLevel, float fAvLevel);
|
||||
|
||||
void XPDebugMessage(object oPC, float fCR, int nDiff, int nLoLevel, int nHiLevel, float fAvLevel);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
// Define major variables
|
||||
object oKiller = GetLastKiller();
|
||||
if (!GetIsPC(oKiller) && !GetIsPC(GetMaster(oKiller))) return;
|
||||
object oParty = GetFirstFactionMember(oKiller, FALSE);
|
||||
float fCR = GetChallengeRating(OBJECT_SELF), fDist;
|
||||
int nPlayer, nSummon, nTotalLevel, nHD, nXPToGive, nHiLevel, nLoLevel = 40;
|
||||
//:: Declare major variables
|
||||
object oKiller = GetLastKiller();
|
||||
object oSelf = OBJECT_SELF;
|
||||
|
||||
int nPlayer, nSummon, nTotalLevel, nHD, nXPToGive, nHiLevel, nLoLevel = 60;
|
||||
|
||||
//:: Get Dead Mob's CR
|
||||
float fCR = GetChallengeRating(oSelf), fDist;
|
||||
|
||||
// Calculate the amount of members oPC's Party
|
||||
//:: Players only
|
||||
if (!GetIsPC(oKiller) && !GetIsPC(GetMaster(oKiller))) return;
|
||||
|
||||
//: Get oKillers party
|
||||
object oParty = GetFirstFactionMember(oKiller, FALSE);
|
||||
|
||||
//:: Calculate size of oPC's party
|
||||
while (GetIsObjectValid(oParty))
|
||||
{
|
||||
// Make sure the party member is NOT dead and are within the specified distance
|
||||
//:: Make sure the party member is NOT dead and are within the specified distance
|
||||
fDist = GetDistanceToObject(oParty);
|
||||
if (!GetIsDead(oParty) && fDist >= 0.0 && fDist <= PARTY_DIST)
|
||||
{
|
||||
// Party member is a player
|
||||
if(GetIsPC(oParty))
|
||||
{
|
||||
// Number of players
|
||||
nPlayer++;
|
||||
//:: Party member is a player
|
||||
if(GetIsPC(oParty))
|
||||
{
|
||||
//:: Add to total number of players
|
||||
nPlayer++;
|
||||
|
||||
// Get total level of all PC party members
|
||||
nTotalLevel += GetLevelFromXP(oParty);
|
||||
//:: Get total level of all PC party members
|
||||
nTotalLevel += GetLevelFromXP(oParty);
|
||||
|
||||
// GetHighest/lowest party members
|
||||
//:: Get highest/lowest party members
|
||||
nHD = GetLevelFromXP(oParty);
|
||||
if (nHD > nHiLevel) nHiLevel = nHD;
|
||||
if (nHD < nLoLevel) nLoLevel = nHD;
|
||||
}
|
||||
// Party member is a summon/familiar/henchman
|
||||
else
|
||||
{
|
||||
nSummon++;
|
||||
}
|
||||
}
|
||||
//:: Party member is a summon/familiar/henchman
|
||||
else
|
||||
{
|
||||
nSummon++;
|
||||
}
|
||||
}
|
||||
//:: Get next party member
|
||||
oParty = GetNextFactionMember(oKiller, FALSE);
|
||||
}
|
||||
|
||||
// This check is to stop the "DIVIDED BY ZERO" error message
|
||||
//:: This check is to stop the "DIVIDED BY ZERO" error message
|
||||
if (!nPlayer) nPlayer = 1;
|
||||
|
||||
// Get average party level calculate difference between highest and lowest
|
||||
//:: Get average party level calculate difference between highest and lowest
|
||||
float fAvLevel = (IntToFloat(nTotalLevel) / nPlayer);
|
||||
int nDiff = abs(nHiLevel - nLoLevel);
|
||||
|
||||
// Calculate XP
|
||||
//:: Calculate XP
|
||||
int nBaseXP = CalculateXP(fAvLevel, fCR);
|
||||
int nXP = ((nBaseXP * XP_MODIFIER) / 10);
|
||||
|
||||
// Lets make sure the XP reward is within consts parameters
|
||||
//:: Lets make sure the XP reward is within consts parameters
|
||||
int nMaxXP = GetMaxXP(oKiller);
|
||||
|
||||
// Calculate Penalties based on consts
|
||||
//:: Calculate Penalties based on consts
|
||||
float fPenalty = (nXP *(nSummon * SUMMON_PENALTY)), fPartyBonus, fKillerBonus;
|
||||
|
||||
if (PC_DIVIDE_XP)
|
||||
@@ -204,8 +242,8 @@ void main()
|
||||
{
|
||||
nXPToGive = (nXP - FloatToInt(fPenalty));
|
||||
}
|
||||
// If there is more than 1 player in the party then calculate
|
||||
// XP Bonuses based on consts
|
||||
//:: If there is more than 1 player in the party then calculate
|
||||
//:: XP Bonuses based on consts
|
||||
if (nPlayer)
|
||||
{
|
||||
fPartyBonus = (nXP * (PARTY_XP_GP_BONUS * nPlayer));
|
||||
@@ -216,7 +254,8 @@ void main()
|
||||
//XPDebugMessage(oKiller, fCR, nDiff, nLoLevel, nHiLevel, fAvLevel);
|
||||
|
||||
}
|
||||
// This is my function that calculates the XP reward
|
||||
|
||||
//:: Calculates the XP reward
|
||||
int CalculateXP(float fLevel, float fCR)
|
||||
{
|
||||
float fXPModifier, fDiff = fabs(fLevel - fCR), fBonus = (((0.1 * fCR) * 10) / 2);
|
||||
@@ -240,24 +279,35 @@ int CalculateXP(float fLevel, float fCR)
|
||||
}
|
||||
return FloatToInt((fXPModifier * 10) + fBonus);
|
||||
}
|
||||
// This is my function to give XP to each party member within
|
||||
// the distance specified by the constants
|
||||
|
||||
//:: Gives XP to each party member within
|
||||
//:: the distance specified by the constants
|
||||
void GiveXP(object oKiller, int nXPToGive, float fKillerBonus, int nDiff, int nPlayer)
|
||||
{
|
||||
int nMaxXP;
|
||||
float fDist;
|
||||
// Get first party members (Only PC's)
|
||||
|
||||
object oSelf = OBJECT_SELF;
|
||||
|
||||
int iRacial = GetRacialType(oSelf);
|
||||
int iInt = GetAbilityScore(oSelf, ABILITY_INTELLIGENCE, TRUE);
|
||||
int iIntB = GetAbilityModifier(ABILITY_INTELLIGENCE, oSelf);
|
||||
|
||||
if (iIntB < 0) {iIntB = 0;}
|
||||
|
||||
//:: Get first party members (Only PC's)
|
||||
object oParty = GetFirstFactionMember(oKiller);
|
||||
// Loops through all party members
|
||||
|
||||
//:: Loops through all party members
|
||||
while (GetIsObjectValid(oParty))
|
||||
{
|
||||
// Make sure the party member is NOT dead and are within the specified distance
|
||||
//:: Make sure the party member is NOT dead and are within the specified distance
|
||||
fDist = GetDistanceToObject(oParty);
|
||||
if (GetIsPC(oParty))
|
||||
{
|
||||
if (!GetIsDead(oParty) && fDist >= 0.0 && fDist <= PARTY_DIST)
|
||||
{
|
||||
// Reward the killer with bonus if specified in consts
|
||||
//:: Reward the killer with bonus if specified in consts
|
||||
nMaxXP = GetMaxXP(oParty);
|
||||
if (nXPToGive > nMaxXP)
|
||||
{
|
||||
@@ -284,15 +334,36 @@ void GiveXP(object oKiller, int nXPToGive, float fKillerBonus, int nDiff, int nP
|
||||
}
|
||||
if (REWARD_GP)
|
||||
{
|
||||
if (FLOATING_TEXT)
|
||||
{
|
||||
FloatingTextStringOnCreature(IntToString(FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER))+"GP", oParty, FALSE);
|
||||
}
|
||||
GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER));
|
||||
if (iRacial == RACIAL_TYPE_ANIMAL || iRacial == RACIAL_TYPE_BEAST ||
|
||||
iRacial == RACIAL_TYPE_MAGICAL_BEAST || iRacial == RACIAL_TYPE_CONSTRUCT ||
|
||||
iRacial == RACIAL_TYPE_OOZE || iRacial == RACIAL_TYPE_PLANT || iRacial == RACIAL_TYPE_VERMIN)
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure", oKiller, FALSE);}
|
||||
//GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive-nXPToGive))));
|
||||
}
|
||||
else if (iInt < 4 && iRacial == RACIAL_TYPE_UNDEAD || iRacial == RACIAL_TYPE_ELEMENTAL)
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure [LOWINT]", oKiller, FALSE);}
|
||||
//GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive-nXPToGive))));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FLOATING_TEXT)
|
||||
{
|
||||
FloatingTextStringOnCreature(IntToString(FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER))+"GP", oParty, FALSE);
|
||||
|
||||
GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive) + (iIntB * d4(3)) + fKillerBonus) * GP_REWARD_MULTIPLIER));
|
||||
}
|
||||
else
|
||||
{
|
||||
GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive) + (iIntB * d4(3)) + fKillerBonus) * GP_REWARD_MULTIPLIER));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GiveXPToCreature(oParty, (nXPToGive + FloatToInt(fKillerBonus)));
|
||||
}
|
||||
// Reward other party members
|
||||
//:: Reward other party members
|
||||
else
|
||||
{
|
||||
if (FLOATING_TEXT)
|
||||
@@ -300,21 +371,51 @@ void GiveXP(object oKiller, int nXPToGive, float fKillerBonus, int nDiff, int nP
|
||||
DelayCommand(0.1, FloatingTextStringOnCreature(IntToString(nXPToGive)+"XP", oParty, FALSE));
|
||||
}
|
||||
if (REWARD_GP)
|
||||
{
|
||||
if (iRacial == RACIAL_TYPE_ANIMAL || iRacial == RACIAL_TYPE_BEAST ||
|
||||
iRacial == RACIAL_TYPE_MAGICAL_BEAST || iRacial == RACIAL_TYPE_CONSTRUCT ||
|
||||
iRacial == RACIAL_TYPE_OOZE || iRacial == RACIAL_TYPE_PLANT || iRacial == RACIAL_TYPE_VERMIN)
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure", oKiller, FALSE);}
|
||||
//GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive-nXPToGive))));
|
||||
}
|
||||
else if (iInt < 4 && iRacial == RACIAL_TYPE_UNDEAD || iRacial == RACIAL_TYPE_ELEMENTAL)
|
||||
{
|
||||
if(DEBUG) {FloatingTextStringOnCreature("Creature doesn't carry treasure [LOWINT]", oKiller, FALSE);}
|
||||
//GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive-nXPToGive))));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FLOATING_TEXT)
|
||||
{
|
||||
FloatingTextStringOnCreature(IntToString(FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER))+"GP", oParty, FALSE);
|
||||
|
||||
GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER));
|
||||
}
|
||||
else
|
||||
{
|
||||
GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER));
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if (REWARD_GP)
|
||||
{
|
||||
if (FLOATING_TEXT)
|
||||
{
|
||||
DelayCommand(0.1, FloatingTextStringOnCreature(IntToString(FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER))+"GP", oParty, FALSE));
|
||||
}
|
||||
GiveGoldToCreature(oParty, FloatToInt((IntToFloat(nXPToGive) + fKillerBonus) * GP_REWARD_MULTIPLIER));
|
||||
}
|
||||
GiveXPToCreature(oParty, nXPToGive);
|
||||
} */
|
||||
|
||||
GiveXPToCreature(oParty, nXPToGive);
|
||||
}
|
||||
}
|
||||
}
|
||||
oParty = GetNextFactionMember(oKiller);
|
||||
}
|
||||
}
|
||||
// This is my function for returning the max XP for the PC's level based on the consts
|
||||
|
||||
//:: Returns the max XP for the PC's level based on the consts
|
||||
int GetMaxXP(object oPC)
|
||||
{
|
||||
int iMaxXP;
|
||||
@@ -360,9 +461,30 @@ int GetMaxXP(object oPC)
|
||||
case 38: iMaxXP = LEVEL_38_MAX_XP; break;
|
||||
case 39: iMaxXP = LEVEL_39_MAX_XP; break;
|
||||
case 40: iMaxXP = LEVEL_40_MAX_XP; break;
|
||||
case 41: iMaxXP = LEVEL_41_MAX_XP; break;
|
||||
case 42: iMaxXP = LEVEL_42_MAX_XP; break;
|
||||
case 43: iMaxXP = LEVEL_43_MAX_XP; break;
|
||||
case 44: iMaxXP = LEVEL_44_MAX_XP; break;
|
||||
case 45: iMaxXP = LEVEL_45_MAX_XP; break;
|
||||
case 46: iMaxXP = LEVEL_46_MAX_XP; break;
|
||||
case 47: iMaxXP = LEVEL_47_MAX_XP; break;
|
||||
case 48: iMaxXP = LEVEL_48_MAX_XP; break;
|
||||
case 49: iMaxXP = LEVEL_49_MAX_XP; break;
|
||||
case 50: iMaxXP = LEVEL_50_MAX_XP; break;
|
||||
case 51: iMaxXP = LEVEL_51_MAX_XP; break;
|
||||
case 52: iMaxXP = LEVEL_52_MAX_XP; break;
|
||||
case 53: iMaxXP = LEVEL_53_MAX_XP; break;
|
||||
case 54: iMaxXP = LEVEL_55_MAX_XP; break;
|
||||
case 55: iMaxXP = LEVEL_55_MAX_XP; break;
|
||||
case 56: iMaxXP = LEVEL_56_MAX_XP; break;
|
||||
case 57: iMaxXP = LEVEL_57_MAX_XP; break;
|
||||
case 58: iMaxXP = LEVEL_58_MAX_XP; break;
|
||||
case 59: iMaxXP = LEVEL_59_MAX_XP; break;
|
||||
case 60: iMaxXP = LEVEL_60_MAX_XP; break;
|
||||
}
|
||||
return iMaxXP;
|
||||
}
|
||||
|
||||
// This new function will get the players level determined by XP rather than
|
||||
// the players level to stop exploiting
|
||||
int GetLevelFromXP(object oPC)
|
||||
@@ -375,7 +497,27 @@ int GetLevelFromXP(object oPC)
|
||||
{
|
||||
|
||||
iXP = GetXP(oPC);
|
||||
if (iXP >= 780000) iXP = 40;
|
||||
if (iXP >= 1770000) iXP = 60;
|
||||
else if (iXP >= 1711000) iXP = 59;
|
||||
else if (iXP >= 1653000) iXP = 58;
|
||||
else if (iXP >= 1596000) iXP = 57;
|
||||
else if (iXP >= 1540000) iXP = 56;
|
||||
else if (iXP >= 1485000) iXP = 55;
|
||||
else if (iXP >= 1431000) iXP = 54;
|
||||
else if (iXP >= 1378000) iXP = 53;
|
||||
else if (iXP >= 1326000) iXP = 52;
|
||||
else if (iXP >= 1275000) iXP = 51;
|
||||
else if (iXP >= 1225000) iXP = 50;
|
||||
else if (iXP >= 1176000) iXP = 49;
|
||||
else if (iXP >= 1128000) iXP = 48;
|
||||
else if (iXP >= 1081000) iXP = 47;
|
||||
else if (iXP >= 1035000) iXP = 46;
|
||||
else if (iXP >= 990000) iXP = 45;
|
||||
else if (iXP >= 946000) iXP = 44;
|
||||
else if (iXP >= 903000) iXP = 43;
|
||||
else if (iXP >= 861000) iXP = 42;
|
||||
else if (iXP >= 820000) iXP = 41;
|
||||
else if (iXP >= 780000) iXP = 40;
|
||||
else if (iXP >= 741000) iXP = 39;
|
||||
else if (iXP >= 703000) iXP = 38;
|
||||
else if (iXP >= 666000) iXP = 37;
|
||||
@@ -423,6 +565,7 @@ int GetLevelFromXP(object oPC)
|
||||
|
||||
return iXP;
|
||||
}
|
||||
|
||||
void XPDebugMessage(object oPC, float fCR, int nDiff, int nLoLevel, int nHiLevel, float fAvLevel)
|
||||
{
|
||||
object oParty = GetFirstFactionMember(oPC);
|
||||
|
Reference in New Issue
Block a user