PGCC_PRC8/_module/nss/vtw_calccr.nss
Jaysyn904 e51634d39b Initial upload
Initial upload.
2024-10-09 14:17:22 -04:00

40 lines
990 B
Plaintext

int StartingConditional()
{
//initialize variables
float fTotalCR = 0.0;
float fPreviousCR = 0.0;
float fCreatureCR = 0.0;
string sDisplayCR;
object oCreature = GetFirstObjectInArea(OBJECT_SELF);
//calculate total CR
while (GetIsObjectValid(oCreature))
{
if (
!GetIsPC(oCreature) &&
!GetIsDM(oCreature) &&
GetObjectType(oCreature) == OBJECT_TYPE_CREATURE
)
{
fCreatureCR = GetChallengeRating(oCreature);
fTotalCR = fCreatureCR + fPreviousCR;
fPreviousCR = fTotalCR;
}
oCreature = GetNextObjectInArea(OBJECT_SELF);
}
//set custom token
if (fTotalCR > 0.0)
{
sDisplayCR = "Total CR = " + GetSubString(FloatToString(fTotalCR), 5, 6);
}
else
sDisplayCR = " ";
SetCustomToken(110, sDisplayCR);
return TRUE;
}