OnGetPawnArchetypeString
Tracking Issue: #1521
Tags: events
Allow runtime override of SelectedArchetype (kUnit is NOT none for ELD_Immediate) Triggers a 'OnGetPawnArchetypeString' event to override archetype path used in visualizations. Listeners should determine their reskin outcome at runtime using the kUnit and then check the tuple's priority to decide to override or not. If their priority exceeds it, they should set BOTH the tuple's OverrideString AND its OverridePriority to their corresponding values to inform everone else.
The primary use-case difference between a listener's priority and the tuple's priority is that the latter can be randomized at runtime, allowing diverse and unique per-spawn outcomes, rather than rigidity created at launch-time. For instance, you can now implement ultra-rare skins or random skins (think Lost).
ex: CurrentPriority = tuple[1].i; GetMyReskinData(kUnit, outArchetypePath, outPriority); if (outPriority > CurrentPriority) { tuple[0].s = outArchetypePath; tuple[1].i = outPriority; }
OnGetPawnArchetypeString event
| Param | Value |
|---|---|
| EventID | OnGetPawnArchetypeString |
| EventData | XComLWTuple |
| EventSource | XComGameState_Unit |
| NewGameState | none |
Tuple contents
| Index | Name | Type | Direction |
|---|---|---|---|
| 0 | OverrideString | String | inout |
| 1 | OverridePriority | int | inout |
| 2 | OriginalString | String | out |
| 3 | ReanimatedUnitID | int | out |
Listener template
static function EventListenerReturn OnOnGetPawnArchetypeString(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
local XComLWTuple Tuple;
local String OverrideString;
local int OverridePriority;
local String OriginalString;
local int ReanimatedUnitID;
Tuple = XComLWTuple(EventData);
OverrideString = Tuple.Data[0].s;
OverridePriority = Tuple.Data[1].i;
// Your code here
Tuple.Data[0].s = OverrideString;
Tuple.Data[1].i = OverridePriority;
Tuple.Data[2].s = OriginalString;
Tuple.Data[3].i = ReanimatedUnitID;
return ELR_NoInterrupt;
}