OverrideHitEffects

Tracking Issue: #825

Tags: events

Allows listeners to change behavior of XComUnitPawn::PlayHitEffects(). Listeners can set OverrideHitEffect to true, and then the default behavior will be omitted entirely, and no hit effect will be played.

Alternatively, listeners can modify the parameters passed with the Tuple to modify the default behavior.

For example, this listener can be used to prevent Templar purple hit effects from playing for any attack that has the hit result eHit_Parry, eHit_Reflect or eHit_Deflect.

OverrideHitEffects event

Param Value
EventID OverrideHitEffects
EventData XComLWTuple
EventSource XComUnitPawn
NewGameState none

Tuple contents

Index Name Type Direction
0 OverrideHitEffect bool inout
1 Damage float inout
2 InstigatedBy Actor in
3 HitLocation vector inout
4 DamageTypeName name inout
5 Momentum vector inout
6 bIsUnitRuptured bool inout
7 HitResult enum (EAbilityHitResult) inout

Listener template

static function EventListenerReturn OnOverrideHitEffects(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComUnitPawn Pawn;
    local XComLWTuple Tuple;
    local bool OverrideHitEffect;
    local float Damage;
    local Actor InstigatedBy;
    local vector HitLocation;
    local name DamageTypeName;
    local vector Momentum;
    local bool bIsUnitRuptured;
    local EAbilityHitResult HitResult;

    Pawn = XComUnitPawn(EventSource);
    Tuple = XComLWTuple(EventData);

    OverrideHitEffect = Tuple.Data[0].b;
    Damage = Tuple.Data[1].f;
    InstigatedBy = Actor(Tuple.Data[2].o);
    HitLocation = Tuple.Data[3].v;
    DamageTypeName = Tuple.Data[4].n;
    Momentum = Tuple.Data[5].v;
    bIsUnitRuptured = Tuple.Data[6].b;
    HitResult = EAbilityHitResult(Tuple.Data[7].i);

    // Your code here

    Tuple.Data[0].b = OverrideHitEffect;
    Tuple.Data[1].f = Damage;
    Tuple.Data[3].v = HitLocation;
    Tuple.Data[4].n = DamageTypeName;
    Tuple.Data[5].v = Momentum;
    Tuple.Data[6].b = bIsUnitRuptured;
    Tuple.Data[7].i = HitResult;

    return ELR_NoInterrupt;
}

Source code references