OverrideKillXp

Tracking Issue: #562

Tags: events

Allows listeners to override the XP values granted by a kill, including the normal kill contribution, any bonus XP from resistance orders and the like, the XP granted for assists, and any Wet Work bonus. Mods can even set these values to zero to prevent XP gain.

This event is called no more than once for each kill.

OverrideKillXp event

Param Value
EventID OverrideKillXp
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState yes

Tuple contents

Index Name Type Direction
0 KillXp float inout
1 BonusKillXp float inout
2 KillAssistXp float inout
3 WetWorkXp int inout
4 Killer XComGameState_Unit in

Listener template

static function EventListenerReturn OnOverrideKillXp(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit KilledUnit;
    local XComLWTuple Tuple;
    local float KillXp;
    local float BonusKillXp;
    local float KillAssistXp;
    local int WetWorkXp;
    local XComGameState_Unit Killer;

    KilledUnit = XComGameState_Unit(EventSource);
    Tuple = XComLWTuple(EventData);

    KillXp = Tuple.Data[0].f;
    BonusKillXp = Tuple.Data[1].f;
    KillAssistXp = Tuple.Data[2].f;
    WetWorkXp = Tuple.Data[3].i;
    Killer = XComGameState_Unit(Tuple.Data[4].o);

    // Your code here

    Tuple.Data[0].f = KillXp;
    Tuple.Data[1].f = BonusKillXp;
    Tuple.Data[2].f = KillAssistXp;
    Tuple.Data[3].i = WetWorkXp;

    return ELR_NoInterrupt;
}

Source code references