Jump to content

"return ELR_InterruptEventAndListeners/ELR_InterruptListeners" Not working?


Deleted32045420User

Recommended Posts

Hello everyone, I am currently building a mod to get FoV on enemies so they wont detect units if they are outside it (uses some vector math to check if the unit is in range, not so complicated). Yes i know it'd be easier to override the class but as many of you know i am mad for compatibility

event OnInit(UIScreen Screen)
{
    local Object ThisObj;


    ThisObj=self;
    `XEVENTMGR.RegisterForEvent(ThisObj, 'ObjectMoved', FixVisibility, ELD_Immediate,10);
    `XEVENTMGR.RegisterForEvent(ThisObj, 'ObjectMoved', TestReturnStuff, ELD_OnStateSubmitted);
    `XEVENTMGR.RegisterForEvent(ThisObj, 'ObjectVisibilityChanged', OnObjectVisibilityChanged,ELD_Immediate,10 );

    `log("-----------Registered for Object Moved-----------");
}
function EventListenerReturn TestReturnStuff(Object EventData, Object EventSource, XComGameState GameState, Name EventID)
{
    `log("---------------------IT DIDNT WORK! TEST FAILED!-----------------------");

    return ELR_NoInterrupt;
}

function EventListenerReturn FixVisibility(Object EventData, Object EventSource, XComGameState GameState, Name EventID)
{
    Some code from the Original Object Moved Event from the Unit code + Custom Vector math code for FoV (it works perfectly i tested it)...

    return ELR_InterruptEventAndListeners;//also tried ELR_InterruptListeners
}

function EventListenerReturn OnObjectVisibilityChanged(Object EventData, Object EventSource, XComGameState GameState, Name EventID)
{
    again some code from the original function from GameState_Player + Some vector math for FoV....


    return ELR_InterruptEventAndListeners;//also tried ELR_InterruptListeners
} 

you can check the github page here: Github XCom:Ghosts

Edited by Guest
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...