OnActivateItem/DestroyObject()

All I need is for oItem (a treasure chest) is to be destroyed at end of script. I don’t know if my delays are interrupting with the script - I’ve tried what I can think of, but oItem remains after script has fired…

On Activate ItemCode so far:

void main()
{
// Wand of Reach
     object oPC = GetItemActivator();
     object oItem = GetItemActivated();
     if ( GetTag(oItem) == "WAND_REACH_01" )
     {
        DelayCommand(0.3, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect
        ( VFX_FNF_GREATER_RUIN ), GetLocation(GetWaypointByTag("RUIN_LOC"))));

        DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect
        (VFX_FNF_GREATER_RUIN), oPC));

        DelayCommand(2.5, CreateObjectVoid(OBJECT_TYPE_PLACEABLE, "chest002", GetLocation(oPC)));

        DestroyObject(GetObjectByTag("WAND_REACH_02"), 3.0);
     }
}

Thanks,
The Reluctant coder… :crazy_face:

  • EDIT: This Relectant coder figured it out. Duplicate Tags are bad! Gave not oItem, but a seperate chest having a unique tag - and all is well in scriptville. Can’t beleive I did that… :frowning:

You’re using different tags at the beginning of the condition and in the destroy command.

Try the snippet above.