Bugfixing pass
Bugfixing pass. Spawn swapovers. Broom!
This commit is contained in:
@@ -31,6 +31,16 @@ void DespawnChildrenByTag(object oSpawn, string sSpawnTag);
|
||||
//
|
||||
//
|
||||
|
||||
// tinygiant -- set this to FALSE to turn off debug statement
|
||||
const int IS_DEBUGGING = TRUE;
|
||||
|
||||
// tinygiant -- temporary function to send debug messages
|
||||
void Debug(string sMessage)
|
||||
{
|
||||
if (IS_DEBUGGING)
|
||||
SendMessageToPC(GetFirstPC(), sMessage);
|
||||
}
|
||||
|
||||
string GetTemplateByCR(int nCR, string sGroupType)
|
||||
{
|
||||
string sRetTemplate;
|
||||
@@ -38,34 +48,34 @@ string GetTemplateByCR(int nCR, string sGroupType)
|
||||
if (sGroupType == "outdoor")
|
||||
{
|
||||
switch (nCR)
|
||||
{
|
||||
{
|
||||
case 1:
|
||||
switch(d6(1))
|
||||
{
|
||||
case 1: sRetTemplate = "NW_SKELETON"; break;
|
||||
case 2: sRetTemplate = "NW_ZOMBIE01"; break;
|
||||
case 3: sRetTemplate = "NW_NIXIE"; break;
|
||||
case 4: sRetTemplate = "NW_ORCA"; break;
|
||||
case 5: sRetTemplate = "NW_ORCB"; break;
|
||||
case 6: sRetTemplate = "NW_BTLFIRE"; break;
|
||||
case 1: sRetTemplate = "NW_SKELETON"; break;
|
||||
case 2: sRetTemplate = "NW_ZOMBIE01"; break;
|
||||
case 3: sRetTemplate = "NW_NIXIE"; break;
|
||||
case 4: sRetTemplate = "NW_ORCA"; break;
|
||||
case 5: sRetTemplate = "NW_ORCB"; break;
|
||||
case 6: sRetTemplate = "NW_BTLFIRE"; break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch(d4(1))
|
||||
{
|
||||
case 1: sRetTemplate = "NW_KOBOLD004"; break;
|
||||
case 2: sRetTemplate = "NW_KOBOLD005"; break;
|
||||
case 3: sRetTemplate = "NW_KOBOLD003"; break;
|
||||
case 4: sRetTemplate = "NW_PIXIE"; break;
|
||||
case 1: sRetTemplate = "NW_KOBOLD004"; break;
|
||||
case 2: sRetTemplate = "NW_KOBOLD005"; break;
|
||||
case 3: sRetTemplate = "NW_KOBOLD003"; break;
|
||||
case 4: sRetTemplate = "NW_PIXIE"; break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch(d4(1))
|
||||
{
|
||||
case 1: sRetTemplate = "NW_BTLBOMB"; break;
|
||||
case 2: sRetTemplate = "NW_BTLFIRE002"; break;
|
||||
case 3: sRetTemplate = "NW_BTLSTINK"; break;
|
||||
case 4: sRetTemplate = "NW_NYMPH"; break;
|
||||
case 1: sRetTemplate = "NW_BTLBOMB"; break;
|
||||
case 2: sRetTemplate = "NW_BTLFIRE002"; break;
|
||||
case 3: sRetTemplate = "NW_BTLSTINK"; break;
|
||||
case 4: sRetTemplate = "NW_NYMPH"; break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -77,18 +87,18 @@ string GetTemplateByCR(int nCR, string sGroupType)
|
||||
else if (sGroupType == "crypt")
|
||||
{
|
||||
switch (nCR)
|
||||
{
|
||||
{
|
||||
case 1:
|
||||
switch(d4(1))
|
||||
{
|
||||
case 1:
|
||||
case 2: sRetTemplate = "NW_SKELETON"; break;
|
||||
case 3: sRetTemplate = "NW_ZOMBIE01"; break;
|
||||
case 4: sRetTemplate = "NW_ZOMBIE02"; break;
|
||||
case 1:
|
||||
case 2: sRetTemplate = "NW_SKELETON"; break;
|
||||
case 3: sRetTemplate = "NW_ZOMBIE01"; break;
|
||||
case 4: sRetTemplate = "NW_ZOMBIE02"; break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
sRetTemplate = "NW_GHOUL";
|
||||
sRetTemplate = "NW_GHOUL";
|
||||
break;
|
||||
case 3:
|
||||
sRetTemplate = "NW_SHADOW";
|
||||
@@ -108,7 +118,7 @@ string GetTemplateByCR(int nCR, string sGroupType)
|
||||
}
|
||||
|
||||
|
||||
// Convert a given EL equivalent and its encounter level,
|
||||
// Convert a given EL equivalent and its encounter level,
|
||||
// return the corresponding CR
|
||||
float ConvertELEquivToCR(float fEquiv, float fEncounterLevel)
|
||||
{
|
||||
@@ -137,8 +147,8 @@ float ConvertCRToELEquiv(float fCR, float fEncounterLevel)
|
||||
|
||||
float fEquiv, fExponent, fDenom;
|
||||
|
||||
fExponent = fEncounterLevel - fCR;
|
||||
fExponent *= 0.5;
|
||||
fExponent = fEncounterLevel - fCR;
|
||||
fExponent *= 0.5;
|
||||
fDenom = pow(2.0, fExponent);
|
||||
fEquiv = 1.0 / fDenom;
|
||||
|
||||
@@ -147,6 +157,11 @@ float ConvertCRToELEquiv(float fCR, float fEncounterLevel)
|
||||
|
||||
string SpawnGroup(object oSpawn, string sTemplate)
|
||||
{
|
||||
Debug("NESS: Running function SpawnGroup");
|
||||
Debug(" oSpawn -> " + GetName(oSpawn));
|
||||
Debug(" sTemplate -> " + sTemplate);
|
||||
Debug("");
|
||||
|
||||
// Initialize
|
||||
string sRetTemplate;
|
||||
|
||||
@@ -165,7 +180,7 @@ string SpawnGroup(object oSpawn, string sTemplate)
|
||||
{
|
||||
float fEncounterLevel;
|
||||
int nScaledInProgress = GetLocalInt(oSpawn, "ScaledInProgress");
|
||||
string sGroupType = GetStringRight(sTemplate,
|
||||
string sGroupType = GetStringRight(sTemplate,
|
||||
GetStringLength(sTemplate) - 7);
|
||||
|
||||
// First Time in for this encounter?
|
||||
@@ -177,7 +192,7 @@ string SpawnGroup(object oSpawn, string sTemplate)
|
||||
int nTotalPCLevel = 0;
|
||||
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
|
||||
|
||||
object oPC = GetFirstObjectInArea(oArea);
|
||||
while (oPC != OBJECT_INVALID)
|
||||
{
|
||||
@@ -203,7 +218,7 @@ string SpawnGroup(object oSpawn, string sTemplate)
|
||||
// We're done when the CRs chosen add up to the
|
||||
// desired encounter level
|
||||
SetLocalInt(oSpawn, "ScaledCallCount", 0);
|
||||
SetLocalInt(oSpawn, "ScaledInProgress", TRUE);
|
||||
SetLocalInt(oSpawn, "ScaledInProgress", TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +247,7 @@ string SpawnGroup(object oSpawn, string sTemplate)
|
||||
sRetTemplate = GetTemplateByCR(nCR, sGroupType);
|
||||
|
||||
|
||||
// Convert CR to Encounter Level equivalent so it can be correctly
|
||||
// Convert CR to Encounter Level equivalent so it can be correctly
|
||||
// subtracted. This does the real scaling work
|
||||
float fELEquiv = ConvertCRToELEquiv(IntToFloat(nCR), fEncounterLevel);
|
||||
float fElRemaining = 1.0 - fELEquiv;
|
||||
@@ -245,10 +260,10 @@ string SpawnGroup(object oSpawn, string sTemplate)
|
||||
SetLocalInt(oSpawn, "ScaledCallCount", nScaledCallCount);
|
||||
|
||||
nSpawnNumber = GetLocalInt(oSpawn, "f_SpawnNumber");
|
||||
|
||||
if (nScaledCallCount >= nSpawnNumber)
|
||||
|
||||
if (nScaledCallCount >= nSpawnNumber)
|
||||
{
|
||||
// reset...
|
||||
// reset...
|
||||
SetLocalInt(oSpawn, "ScaledInProgress", FALSE);
|
||||
}
|
||||
}
|
||||
@@ -295,31 +310,87 @@ string SpawnGroup(object oSpawn, string sTemplate)
|
||||
sRetTemplate = "NW_GOBLINB";
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
// Brigands & Leader
|
||||
if (sTemplate == "brigands01")
|
||||
{
|
||||
int nIsBossSpawned = GetLocalInt(oSpawn, "IsBossSpawned");
|
||||
|
||||
Debug("NESS: nIsBossSpawned :: oSpawn -> " + GetName(oSpawn));
|
||||
Debug("NESS: nIsBossSpawned :: Value -> " + IntToString(nIsBossSpawned));
|
||||
|
||||
if (nIsBossSpawned == TRUE)
|
||||
{
|
||||
// Find the Boss
|
||||
object oBoss = GetChildByTag(oSpawn, "RA_BRIGAND002");
|
||||
|
||||
Debug("NESS: oBoss -> " + (GetIsObjectValid(oBoss) ? GetName(oBoss) : "OBJECT_INVALID"));
|
||||
|
||||
// Check if Boss is Alive
|
||||
if (oBoss != OBJECT_INVALID && GetIsDead(oBoss) == FALSE)
|
||||
{
|
||||
Debug("NESS: oBoss is valid and alive, assigning template 'RA_BRIGAND001'");
|
||||
|
||||
// He's alive, spawn a Peon to keep him Company
|
||||
sRetTemplate = "RA_BRIGAND001";
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug("NESS: oBoss is either invalid or dead, so let's respawn him.");
|
||||
sRetTemplate = "RA_BRIGAND002";
|
||||
SetLocalInt(oSpawn, "IsBossSpawned", TRUE);
|
||||
// He's dead, Deactivate Camp!
|
||||
//SetLocalInt(oSpawn, "SpawnDeactivated", TRUE);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug("NESS: Boss does not exist, assiging template 'RA_BRIGAND002'");
|
||||
|
||||
// No Boss, so Let's Spawn Him
|
||||
sRetTemplate = "RA_BRIGAND002";
|
||||
SetLocalInt(oSpawn, "IsBossSpawned", TRUE);
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
// Goblins and Boss
|
||||
if (sTemplate == "gobsnboss")
|
||||
{
|
||||
int nIsBossSpawned = GetLocalInt(oSpawn, "IsBossSpawned");
|
||||
|
||||
Debug("NESS: nIsBossSpawned :: oSpawn -> " + GetName(oSpawn));
|
||||
Debug("NESS: nIsBossSPawned :: Value -> " + IntToString(nIsBossSpawned));
|
||||
|
||||
if (nIsBossSpawned == TRUE)
|
||||
{
|
||||
// Find the Boss
|
||||
object oBoss = GetChildByTag(oSpawn, "NW_GOBCHIEFA");
|
||||
|
||||
Debug("NESS: oBoss -> " + (GetIsObjectValid(oBoss) ? GetName(oBoss) : "OBJECT_INVALID"));
|
||||
|
||||
// Check if Boss is Alive
|
||||
if (oBoss != OBJECT_INVALID && GetIsDead(oBoss) == FALSE)
|
||||
{
|
||||
Debug("NESS: oBoss is valid and alive, assigning templatle 'NW_GOBLINA'");
|
||||
|
||||
// He's alive, spawn a Peon to keep him Company
|
||||
sRetTemplate = "NW_GOBLINA";
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug("NESS: oBoss is either invalid or dead, deactivating camp");
|
||||
|
||||
// He's dead, Deactivate Camp!
|
||||
SetLocalInt(oSpawn, "SpawnDeactivated", TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug("NESS: Boss does not exist, assiging template 'NW_GOBCHIEFA'");
|
||||
|
||||
// No Boss, so Let's Spawn Him
|
||||
sRetTemplate = "NW_GOBCHIEFA";
|
||||
SetLocalInt(oSpawn, "IsBossSpawned", TRUE);
|
||||
@@ -539,3 +610,4 @@ string SpawnGroup(object oSpawn, string sTemplate)
|
||||
//
|
||||
return sRetTemplate;
|
||||
}
|
||||
//void main (){}
|
||||
|
||||
Reference in New Issue
Block a user