here's a script that creates and destroys Placed light-effect objects. It works (though i'm not sure why simply searching for OBJECT_TYPE_PLACED_EFFECT on the destroy-loop doesn't...)
// - onHeartbeat of Area
const string POINT = "sp_light"; // tag of Object(s) to spawn lights at
const string LIGHT = "lt_white"; // resref of the Light to spawn
const string EFFECT = "lt_phosphor0101"; // resref of the Placed_Effect to spawn
// both LIGHT and EFFECT will spawn at POINT at dusk, and get destroyed at dawn.
void main()
{
object oArea = OBJECT_SELF;
int bDark = (GetIsNight() || GetIsDusk());
if (bDark == GetLocalInt(oArea, "bDark"))
return;
SetLocalInt(oArea, "bDark", bDark);
if (bDark)
{
object oPoint = GetFirstObjectInArea(oArea);
while (GetIsObjectValid(oPoint))
{
if (GetTag(oPoint) == POINT)
{
location lPoint = GetLocation(oPoint);
object oLight = CreateObject(OBJECT_TYPE_LIGHT, LIGHT, lPoint);
object oEffect = CreateObject(OBJECT_TYPE_PLACED_EFFECT, EFFECT, lPoint);
SetLocalInt(oLight, "bDestroy", TRUE);
SetLocalInt(oEffect, "bDestroy", TRUE);
}
oPoint = GetNextObjectInArea(oArea);
}
}
else
{
object oDestroy = GetFirstObjectInArea(oArea);
while (GetIsObjectValid(oDestroy))
{
if (GetLocalInt(oDestroy, "bDestroy"))
{
DestroyObject(oDestroy);
}
oDestroy = GetNextObjectInArea(oArea);
}
}
}notice I flagged the Placed_Effects for destruction (didn't want to destroy anything that should remain static).
Maybe you can compare the idea against what you're doing and find something useful there.