How to apply a custom tag to a unit in the data editor (ability effect)

Use case:
When an enemy unit is hit by a certain ability, I want it to drop a certain item when at any later point in time the unit dies.

I thought to do this by having an effect of the ability apply a custom tag to the unit, which I could later retrieve when checking in the unit death event. However, I have no clue how to actually do this.

The “User Data” effect seemed promising, but no idea how it works. Also couldn’t find any documentation on this.

You could apply a behavior - buff that has the flag Stats: Flags | Hidden From Default UI enabled, to the enemy unit that gets hit. Then when the unit dies, check if it has the behavior (cuz you can still check behaviors of dying units, before they’re removed from the game) in Triggers, and if it does, create the item drop. If you’re adding this into a loot system drop mechanic in data, then I’d add a validator to the loot type in data that checks if the behavior count on the /dying/ unit is = 1, e.g. if the creator unit of the loot item has that hidden buff on them. If so, successfully spawn in the loot drop item.

1 Like

Works like a charm, thanks!
Small note: for this case to work I did have to add the Behavior flag Permanent as well