Jump to content

UITacticalHUD and the Target System


btysgtmajor

Recommended Posts

I'm still fairly new to XCOM 2 modding, but, I was wondering if anyone knows if there are any events triggered or any way whatsoever to know when UITacticalHUD ends up calling RaiseTargetSystem() or LowerTargetSystem()? I've tried polling the class, but, so far I've only been able to do it via the Visualization Observer Interface (or whatever) but those events don't trigger when the targeting system goes up or down.

 

This is the last sticking point for a mod of mine. Otherwise, I have to override UITacticalHUD and it creates all kinds of conflicts with other mods.

 

Any thoughts/advice? Or am I missing something obvious?

 

Thanks in advance!

Link to comment
Share on other sites

As promised, I'm sharing my results.

 

Thanks to the mod referenced above, I found a snazzy way to be alerted to essentially ANY variable change! Take a look at the line below and I think you'll see how you can use it most anywhere:

WorldInfo.MyWatchVariableMgr.RegisterWatchVariable( HUDScreen, 'm_isMenuRaised', self, ToggleTargetSystem);

In the case above, we're registering the variable/property "m_isMenuRaised" against the "HUDScreen" class (in this case a UITacticalHUD), and telling it to notify "self" and, when doing so, call the "ToggleTargetSystem" method.

 

Hope this helps someone else!

Link to comment
Share on other sites

That being said, RegisterWatchVariable should be considered a last resort for ONLY UI ELEMENTS. Often, these class variables contain data relevant to the internal state of the object. If there is anything that changes the GameState, you should not rely on it, and use the built-in `XEVENTMGR if possible.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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