I made a list of all of the `XEVENTMGR.TriggerEvent calls I could find
pastebin.com/8vbi1t2rPosted Feb 12, 2016, 2:45 AM UTC
Posted Feb 12, 2016, 2:45 AM UTC
What, how did I not realize this game has an event manager!? Can you subscribe to this without overriding existing classes?
I'll have to look into this some more - the only "events" I was aware of were the UIScreenListener events, which I've been using for basically everything.
I know right, there is not a lot of detail on how to use it right now yet though.
You can setup a callback to listen to a given event by using:
`XEVENTMGR.RegisterForEvent(ObjWithCallback, 'NameOfEvent', CallbackFunction, ELD_Immediate);
I've been using it mostly by creating a UIScreenListener and OnInit registering a trigger with a local function. So something along the lines of...
`XEVENTMGR.RegisterForEvent(SelfObj, 'UnitTakeEffectDamage', OnTakeDamage, ELD_Immediate);
...
function EventListenerReturn OnTakeDamage(Object EventData, Object EventSource, XComGameState GameState, Name EventID) {
...
return ELR_NoInterrupt;
}
Honestly, I am not certain what the ELD/ELR enums are doing and haven't yet put time into finding them.
==EDIT==
I found the ELD/ELR enums in XComGameState.uc
enum EventListenerDeferral
{
ELD_Immediate, // The Listener will be notified in-line (no deferral)
ELD_OnStateSubmitted, // The Listener will be notified after the associated game state is processed
ELD_OnVisualizationBlockCompleted, // The Listener will be notified after the associated visualization block is completed
ELD_PreStateSubmitted, // The Listener will be notified immediately prior to the associated game state being added to the history
ELD_OnVisualizationBlockStarted, // The Listener will be notified when the associated visualization block begins execution
};
enum EventListenerReturn
{
ELR_NoInterrupt, // any subsequent event listeners WILL be processed; if ELD_Immediate, the event WILL NOT be interrupted
ELR_InterruptEvent, // any subsequent event listeners WILL be processed; if ELD_Immediate, the event WILL be interrupted
ELR_InterruptListeners, // any subsequent event listeners WILL NOT be processed; if ELD_Immediate, the event WILL NOT be interrupted
ELR_InterruptEventAndListeners, // any subsequent event listeners WILL NOT be processed; if ELD_Immediate, the event WILL be interrupted
};
[..] haven't yet put time into finding them
ctrl+shift+f is your friend for this :P
OMG I love you for this. This is what I have been missing.
I did my best to describe where it came from and what I think it does. I would appreciate if anyone wanted to help make this a little bit nicer-- but I'm a little fried right now.
EventToTrigger //Not an actual trigger, seems to be a generic event triggerer, no idea where the EventToTrigger variable gets set.
'OnSkyrangerArrives' //Pretty sure this triggers when you are about to launch the the mission, but you still have the option to 'return to avenger'
Can confirm as true - this event makes the "Begin Mission/Return to Avenger" buttons appear.
I believe (but I might be wrong) that it's used as a placeholder when the event to trigger is known, but will occur at an unknown time in the future. It's set when the event to trigger becomes known.
Otherwise, great work, thank you for looking into all these - I'll add it to my info compilation I'm working on.