40 lines
990 B
Plaintext
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(102, sDisplayCR);
|
|
|
|
return TRUE;
|
|
}
|
|
|