Need OnDisturbed help

How would I format the script when I want to do a check for the last item added to a placeable by item’s specific tag? Example: If last item added = specific tag of item we’re looking for, then do X. If not then do Y (like do small damage to PC). There is no OnDisturbed function in Lilac Soul scripter, so I’m clueless how to format this.

1 Like

Yeah I was looking at that. Didn’t help me with the formatting.

void main()
    object oPC = GetLastDisturbed();
    object oItem = GetInventoryDisturbItem();

    // Check whether the right *kind* of disturbance triggered the OnDisturbed event.
    if (GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_REMOVED)
        // Compare the tag of the item that has been removed to
        // the string we want to check for:
        if (GetTag(oItem) == "TagWeAreLookingFor")
            // If the item tag was a match, do this:
            AssignCommand(oPC, SpeakString("Did you know that there is such a thing as coffee-flavoured chocolate?"));

Commented for convenience of explainination. Use ApplyEffectToObject() to apply EffectDamage() to the PC - and maybe a VFX too.

Thanks. I got it to work pretty well. When a PC adds an object to a brazier, it flames, consumes the object, and unlocks a nearby door with the knock visual.