generated from Jaysyn/ModuleTemplate
Initial Commit
Initial Commit.
This commit is contained in:
48
_module/nss/hs_include.nss
Normal file
48
_module/nss/hs_include.nss
Normal file
@@ -0,0 +1,48 @@
|
||||
//::////////////////////////////////////////////////////////
|
||||
//:: hs_include.nss
|
||||
//:
|
||||
/*
|
||||
Catch-all include for missing module scripts.
|
||||
*/
|
||||
//:
|
||||
//::
|
||||
//::////////////////////////////////////////////////////////
|
||||
#include "nw_i0_plot"
|
||||
|
||||
void RemoveXPFromParty(int nXP, object oPC, int bSplit)
|
||||
{
|
||||
object oMember;
|
||||
int nXPToRemove = 0;
|
||||
int nPartyCount = 0;
|
||||
|
||||
// If splitting the XP, first count the party members.
|
||||
if (bSplit)
|
||||
{
|
||||
oMember = GetFirstFactionMember(oPC);
|
||||
while (oMember != OBJECT_INVALID)
|
||||
{
|
||||
nPartyCount++;
|
||||
oMember = GetNextFactionMember(oPC);
|
||||
}
|
||||
// Avoid division by zero; if no party members, count the PC itself.
|
||||
if (nPartyCount <= 0)
|
||||
nPartyCount = 1;
|
||||
|
||||
nXPToRemove = nXP / nPartyCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not splitting, each member loses the full XP amount.
|
||||
nXPToRemove = nXP;
|
||||
}
|
||||
|
||||
// Remove the XP from every party member.
|
||||
oMember = GetFirstFactionMember(oPC);
|
||||
while (oMember != OBJECT_INVALID)
|
||||
{
|
||||
// Subtract XP by adding a negative value.
|
||||
// (Note: Ensure that AddXP in your module supports negative values.)
|
||||
GiveXPToCreature(oMember, -nXPToRemove);
|
||||
oMember = GetNextFactionMember(oPC);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user