Issue: I have recently encountered odd behavior with this script which will respawn TWO placeables at the location instead of one, which will cause them to be undestroyable by melee or spells (only noticed with Webs so far). I have chalked this up to the location being invalid, by that space being occupied at the time of destruction, most noticably by a large creature size such as Dragon or Earth Elemental. Now before I go and make any changes I would like to ask you guys what would explain these double respawns? And do you have any better ways or more refined code to produce more accurate results?
void RespawnObject(string sTag, int iType, location lLoc)
{
string sResRef = GetStringLowerCase(GetStringLeft(sTag, 16));
CreateObject(iType, sResRef, lLoc);
}
void main()
{
//Modified by SKIPPNUTTZ 04-23-12
//Placeable Objects now respawn after 20 minutes
string sTag = GetTag(OBJECT_SELF);
int iType = GetObjectType(OBJECT_SELF);
float fDelay = 1200.0; //Default: 1200.0 (20 minutes)
//get the location of the placeable object
location lLoc = GetLocation(OBJECT_SELF);
//respawn the placeable object after 20 minutes
AssignCommand(GetArea(OBJECT_SELF), DelayCommand(fDelay, RespawnObject(sTag, iType, lLoc)));
//get the location of the killer(PC)
location lPC = GetLocation(GetLastKiller());
//call the creature string from variables list of placeable
string sCreatureToSpawn = GetLocalString(OBJECT_SELF, "sCreatureToSpawn");
//randomize the spawn chance somewhat
int iSpawnExp = d4(1);
if (iSpawnExp < 3)
{
//spawn 5 sCreatureToSpawn(s) at the player's location
int i;
int j = 5;
for (i = 0; i < j; i++)
{
object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, sCreatureToSpawn, lPC, FALSE, "");
}
}
}
Thanks.
Modifié par SKIPPNUTTZ, 08 mai 2012 - 09:08 .





Retour en haut






