Failed.Bard wrote...
Set up waypoints at each spawn location, all with the same tag, that have the creature ResRef on them that you want to spawn at that point.
On spawn you'll want to store the creature object on it that you last spawned there, so it can be ported back into place if still present, or remade if not. The new creature object would then be stored. It'd only take about 10 lines of script to do the whole module under that system.
I'm heading out for a bit now, but I'll write something up in a couple hours when I get back if you're curious how that would be scripted.
Whether you manually put the creatures into the toolset and create waypoints at their start location or you put waypoints into the toolset and create creatures at that those locations is just a matter of preference.
If you want this to work only in specified areas your respawn script will look something like this:
(Note for the module only approach use the Module for oArea)
void RespawnCreatures(object oArea)
{
object oCreature;
string sResRef;
location lLoc;
int nCount = GetLocalInt(oArea, "RespawnNumber");
string sCount;
while(nCount--)
{
sCount = IntToString(nCount + 1);
oCreature = GetLocalObject(oArea, "RespawnCreature" + sCount);
if(GetIsObjectValid(oCreature)) DestroyObject(oCreature);
sResRef = GetLocalString(oArea, "RespawnResRef" + sCount);
lLoc = GetLocation(GetLocalObject(oArea, "RespawnLocation" + sCount));
oCreature = CreateObject(OBJECT_TYPE_CREATURE, sResRef, lLoc);
SetLocalObject(oArea, "RespawnCreature" + sCount, oCreature);
}
}
Edit: Note that I used a waypoint to trigger lLoc, when I could have also used GetLocalLocation(), this is more for if you like a waypoint method more than a non-waypoint.
Modifié par WhiZard, 10 février 2012 - 11:21 .