Fixed issue that occurred when an NPC lair was not able to spawn new NPC's if no NPC's were spawned.

This commit is contained in:
Cekis
2018-03-23 15:59:24 -07:00
committed by CekisSWG
parent e3415e5119
commit f2aaea8112
@@ -410,14 +410,15 @@ public class npc_lair extends script.theme_park.poi.base
setHitpoints(target, hpValue);
}
catch(Exception e){
System.out.println("Couldn't set obj vars on target with obj_id " + target.toString());
System.out.println("Target does " + (isIdValid(target) ? "" : "not") + " have a valid obj id.");
System.out.println("Target is " + (isPlayer(target) ? "" : "not") + " a player.");
System.out.println("Target is " + (isIncapacitated(target) ? "" : "not") + " incapacitated.");
System.out.println("Target is " + (isInvulnerable(target) ? "" : "not") + " invulnerable.");
System.out.println("Target is " + (isGod(target) ? "" : "not") + " in god mode.");
System.out.println("Targets template is " + getTemplateName(target));
System.out.println("Targets name is " + getPlayerName(target));
LOG("npc_lair","Couldn't set obj vars on target with obj_id " + target.toString()
+ "\nTarget does " + (isIdValid(target) ? "" : "not") + " have a valid obj id."
+ "\nTarget is " + (isPlayer(target) ? "" : "not") + " a player."
+ "\nTarget is " + (isIncapacitated(target) ? "" : "not") + " incapacitated."
+ "\nTarget is " + (isInvulnerable(target) ? "" : "not") + " invulnerable."
+ "\nTarget is " + (isGod(target) ? "" : "not") + " in god mode."
+ "\nTargets template is " + getTemplateName(target)
+ "\nTargets name is " + getPlayerName(target) + "."
);
}
}
else
@@ -672,6 +673,9 @@ public class npc_lair extends script.theme_park.poi.base
int maxHP = getMaxHitpoints(lair);
int curHP = getHitpoints(lair);
int numSpawned = getIntObjVar(self, "npc_lair.numberOfMobiles");
if(numSpawned == 0) {
return SCRIPT_CONTINUE;
}
int costPerMobile = maxHP / (numSpawned * 5);
if (costPerMobile > curHP)
{