ItemAddedOrRemovedToSlot

Tracking Issue: #694

Tags: events

Triggers ItemAddedToSlot event when a unit adds an item to their inventory. Triggers ItemRemovedFromSlot event when a unit removes an item from their inventory. These events are perfect when relying on X2ItemTemplate::OnEquippedFn and X2ItemTemplate::OnUnequippedFn is not an option, such as when you need to execute arbitrary code whenever any unit adds any item to their inventory.

ItemAddedToSlot event

Param Value
EventID ItemAddedToSlot
EventData XComGameState_Item
EventSource XComGameState_Unit
NewGameState yes

Listener template

static function EventListenerReturn OnItemAddedToSlot(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    // Your code here

    return ELR_NoInterrupt;
}

ItemRemovedFromSlot event

Param Value
EventID ItemRemovedFromSlot
EventData XComGameState_Item
EventSource XComGameState_Unit
NewGameState maybe

Listener template

static function EventListenerReturn OnItemRemovedFromSlot(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    // Your code here

    return ELR_NoInterrupt;
}

Source code references