DynamicSoldierClassDisplay

Tracking Issue: #106

Tags: ui, events

Mods may want to manipulate the way a soldier's class is displayed (in terms of icon/name/description) in more dynamic ways. For example, RPGOverhaul has a single soldier class and the way it is displayed depends on selected skills and loadouts. There are three events with mostly self-explanatory names:

SoldierClassIcon event

Param Value
EventID SoldierClassIcon
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState none

Tuple contents

Index Name Type Direction
0 IconImagePath string inout

Listener template

static function EventListenerReturn OnSoldierClassIcon(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit UnitState;
    local XComLWTuple Tuple;
    local string IconImagePath;

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

    IconImagePath = Tuple.Data[0].s;

    // Your code here

    Tuple.Data[0].s = IconImagePath;

    return ELR_NoInterrupt;
}

SoldierClassDisplayName event

Param Value
EventID SoldierClassDisplayName
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState none

Tuple contents

Index Name Type Direction
0 DisplayName string inout

Listener template

static function EventListenerReturn OnSoldierClassDisplayName(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit UnitState;
    local XComLWTuple Tuple;
    local string DisplayName;

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

    DisplayName = Tuple.Data[0].s;

    // Your code here

    Tuple.Data[0].s = DisplayName;

    return ELR_NoInterrupt;
}

SoldierClassSummary event

Param Value
EventID SoldierClassSummary
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState none

Tuple contents

Index Name Type Direction
0 DisplaySummary string inout

Listener template

static function EventListenerReturn OnSoldierClassSummary(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit UnitState;
    local XComLWTuple Tuple;
    local string DisplaySummary;

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

    DisplaySummary = Tuple.Data[0].s;

    // Your code here

    Tuple.Data[0].s = DisplaySummary;

    return ELR_NoInterrupt;
}

There is a sister feature DynamicSoldierRankDisplay that extends this to rank icon/name.

Source code references