EditMitigationMessages

Tracking Issue: #1566

Tags: events

This feature allows mods to add or replace flyovers related to armor mitigation, e.g. to display extra mitigation from an AdjustArmorMitigation callback.

Note that mods overriding X2Action_ApplyWeaponDamageToUnit::ShowMitigationMessage might not emit or respect the associated event.

EditMitigationMessages event

Param Value
EventID EditMitigationMessages
EventData XComLWTuple
EventSource X2Action_ApplyWeaponDamageToUnit
NewGameState yes

Tuple contents

Index Name Type Direction
0 CurrentArmor int inout
1 ExtraMessages array<XComLWTuple> out

Listener template

static function EventListenerReturn OnEditMitigationMessages(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComLWTuple Tuple;
    local int CurrentArmor;
    local array<XComLWTuple> ExtraMessages;

    Tuple = XComLWTuple(EventData);

    CurrentArmor = Tuple.Data[0].i;

    // Your code here

    Tuple.Data[0].i = CurrentArmor;
    Tuple.Data[1].o = ExtraMessages;

    return ELR_NoInterrupt;
}

Listeners should format their response tuples as:

  • ResponseID: ExtraMitigationMessage
  • ResponseData: [string MessageText, int MessageAmount]

You can also modify CurrentArmor (e.g. setting it to 0 to suppress the vanilla flyover), but this might result in unexpected behavior if other listeners depend on it.

Source code references