/* Title: spawn_template.script Description: This script lives on all spawned templates. It notifies the master spawn object when they are destroyed. */ inherits systems.spawning.spawn_base; trigger OnAddedToWorld() { /* //LOG("spawn_template", "Adding self to world"); if((hasObjVar(self, "intUnloaded"))||(hasObjVar(self, "intPersistent"))) { //LOG("spawn_template", "Reregistering with master spawner"); removeObjVar(self, "intUnloaded"); dictionary dctParams = new dictionary(); string strRegionName = getStringObjVar(self, "strRegionName"); string strPlanet = getStringObjVar(self, "strPlanet"); int intObjVarId = getIntObjVar(self, "intObjVarId"); obj_id objMasterSpawner = getObjIdObjVar(self, "objMasterSpawner"); string strTemplate = getTemplateName(self); string strLairType = ""; string strBuildingType = ""; if(hasObjVar(self, "spawning.lairType")) { strLairType = getStringObjVar(self, "spawning.lairType"); if(strLairType!="") { strTemplate = strTemplate +"."+strLairType; } } if(hasObjVar(self, "spawning.buildingTrackingType")) { strBuildingType = getStringObjVar(self, "spawning.buildingTrackingType"); if(strBuildingType!="") { strTemplate = strTemplate +"."+strBuildingType; } } dctParams.put("strTemplate", strTemplate); dctParams.put("intObjVarId", intObjVarId); dctParams.put("objSender", self); dctParams.put("strLairType", strLairType); dctParams.put("strBuildingType", strBuildingType); dctParams.put("strRegionName", strRegionName); dctParams.put("strPlanet", strPlanet); debugServerConsoleMsg(self, "Sending Reload Request Message"); messageTo(objMasterSpawner, "template_Reload", dctParams, 0, true); } else { //LOG("spawn_template", "destroying self on //LOGin"); destroyObject(self); } */ return SCRIPT_CONTINUE; } messageHandler template_Cleanup() { setObjVar(self, "intCleaningUp", 1); destroyObject(self); return SCRIPT_CONTINUE; } trigger OnRemovingFromWorld() { if(!hasObjVar(self, "intPersistent")) { destroyObject(self); } else { setObjVar(self, "intUnloaded", 1); } return SCRIPT_CONTINUE; } /** @brief This trigger handles notification of the master spawner when the template is destroyed. This will be used to cleanup all necessary spawn information and counters */ trigger OnDestroy() { obj_id objMasterSpawner; dictionary dctParams = new dictionary(); string strTemplate; string strLairType; string strBuildingType; strTemplate = getTemplateName(self); if(hasObjVar(self, "spawning.lairType")) { strLairType = getStringObjVar(self, "spawning.lairType"); if(strLairType!="") { strTemplate = strTemplate +"."+strLairType; } } if(hasObjVar(self, "spawning.buildingTrackingType")) { strBuildingType = getStringObjVar(self, "spawning.buildingTrackingType"); if(strBuildingType!="") { strTemplate = strTemplate +"."+strBuildingType; } } string strRegionName = getStringObjVar(self, "strRegionName"); string strPlanet = getStringObjVar(self, "strPlanet"); debugServerConsoleMsg(self, "Template being cleaned up is "+strTemplate); objMasterSpawner = getObjIdObjVar(self, "objMasterSpawner"); // dctParams.put("objMasterSpawner", objMasterSpawner); if (strTemplate != null) dctParams.put("strTemplate", strTemplate); if (strRegionName != null) dctParams.put("strRegionName", strRegionName); if (strPlanet != null) dctParams.put("strPlanet", strPlanet); debugServerConsoleMsg(self, "Sending Message"); // Now fire it off to the master object messageTo(objMasterSpawner, "template_Destroyed", dctParams, 0, false); debugServerConsoleMsg(self, "Message Sent"); return SCRIPT_CONTINUE; } boolean checkIfInCombat(obj_id objLair) { int intNumberOfMobiles = getIntObjVar(objLair, "npc_lair.numberOfMobiles"); // debugSpeakMsg(objLair, "number of mobiles is "+intNumberOfMobiles); for(int intI =0; intI0) { return true; } } return false; }