ValidateGTSClassTraining

Tracking Issue: #814

Tags: events

Triggers an 'ValidateGTSClassTraining' event that allows listeners to control whether the given class can be trained in the GTS.

The event is fired once for each class whenever the GTS creates a list of classes to train. The boolean value is based on vanilla checks (NumInForcedDeck and bMultiplayerOnly), so vanilla behavior is maintained when the value isn't changed by the listener(s), and listeners can base their logic on the vanilla checks or override the result.

ValidateGTSClassTraining event

Param Value
EventID ValidateGTSClassTraining
EventData XComLWTuple
EventSource UIChooseClass
NewGameState none

Tuple contents

Index Name Type Direction
0 CanTrainClass bool out
1 SoldierClassTemplate X2SoldierClassTemplate in

Listener template

static function EventListenerReturn OnValidateGTSClassTraining(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local UIChooseClass ChooseClassScreen;
    local XComLWTuple Tuple;
    local bool CanTrainClass;
    local X2SoldierClassTemplate SoldierClassTemplate;

    ChooseClassScreen = UIChooseClass(EventSource);
    Tuple = XComLWTuple(EventData);

    SoldierClassTemplate = X2SoldierClassTemplate(Tuple.Data[1].o);

    // Your code here

    Tuple.Data[0].b = CanTrainClass;

    return ELR_NoInterrupt;
}

Source code references