There is a situation where I would like to use item - spawn placeable. That works. Then, if PC doesn’t like placeable location, start conversation with placeable, select unsummon, placeable SHOULD vanish and create original item on PC so they can try again. Only, the placeable isn’t vanishing. Or more like it does but another is immediately spawned in its place, sometimes rotated slightly. I have NO IDEA why this is happening. If I use the toolset to place the placeable, the script fires as desired. If PC uses item - spawn placeable - start convo with placeable - select unsummon, the auto-respawning - sometimes rotated - thing happens. The only thing I can think of is maybe GetItemActivatedTargetLocation(); wants to make items persistent for some reason once spawned. Because in my limited experience, placeables created in the toolset stay gone once destroyed, placeables created at a WAYPOINT stay gone once destroyed.
Here is the item spawning script.
void main()
{
object oSpawn;
effect eVFX;
object oEventItem = GetItemActivated();
object oActTarget = GetItemActivatedTarget();
location lActTarget = GetItemActivatedTargetLocation();
object oActivator = GetItemActivator();
object oArea;
string sConst = “TowerBasement”;
object oPC = oActivator;
oArea = GetArea(oPC);
string sArea = GetTag(oArea);
// This item must target a location (not an object).
if ( GetIsObjectValid(oActTarget) )
{
SendMessageToPC(oActivator, "Improper use of this item!");
return;
}
if (sArea != sConst)
{
SendMessageToPC(oActivator, "Improper location for use of this item!");
return;
}
// Spawn Purple Portal.
eVFX = EffectVisualEffect(471);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "zep_portal003", lActTarget);
DelayCommand(0.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSpawn));
// Destroy an object (not fully effective until this script ends).
DelayCommand(1.0, DestroyObject(oEventItem));
// Update the player's journal.
AddJournalQuestEntry("NewLab", 4, oPC, FALSE);
}
Here is destroy script:
void main()
{
effect eVFX;
object oSelf = OBJECT_SELF;
// Get the PC who is in this conversation.
object oPC = GetPCSpeaker();
// Give "portalicon1" to the PC.
CreateItemOnObject("portalicon1", oPC);
// Destroy an object (not fully effective until this script ends).
eVFX = EffectVisualEffect(VFX_IMP_UNSUMMON);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVFX, oSelf);
DestroyObject(oSelf, 3.0);
}
Destroy script fires because you can hear the effect noise. And as I said, sometimes the new placeable is spawned in a rotated fashion, depending on slight PC rotation.