Deleted32045420User Posted May 14, 2016 Share Posted May 14, 2016 (edited) 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 May 14, 2016 by Guest Link to comment Share on other sites More sharing options...
fxsjosh Posted May 14, 2016 Share Posted May 14, 2016 I answered this on reddit, but in the interest of everyone seeing it: X2CharacterTemplate has a VisionArcDegrees field. Link to comment Share on other sites More sharing options...
Recommended Posts