generated from Jaysyn/ModuleTemplate
Initial upload
Initial upload.
This commit is contained in:
39
_module/nss/vtw_calccr.nss
Normal file
39
_module/nss/vtw_calccr.nss
Normal file
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user