TheRealSFlo Posted March 10, 2016 Share Posted March 10, 2016 I'm using a UIScreenListener to draw additional data to the Squad Select screen from 'UISquadSelect.uc' and I can't seem to find an event that takes place whenever a unit is removed from the squad that I can hook into. OnInit(), OnReceiveFocus(), & OnLoseFocus() all serve most of my needs, but when a unit is removed from the current squad the additional data I drew to the screen lingers since I cannot call the event that checks for and wipes the unneeded visuals until the screen loses focus again. I couldn't find a function in 'UISquadSelect.uc' to really hook into when I looked through it. Anyone know what event I'm missing? Link to comment Share on other sites More sharing options...
Amineri Posted March 10, 2016 Share Posted March 10, 2016 Nope, this was a problem I ran into with OfficerPack as well, which is why I had to resort to the more extreme measures of class replacement. Note that I didn't use the built-in new/spawn driven class replacement as set up in Engine.ini (since that wasn't available when I wrote the code), but instead replaced the SquadSelect_ListItem from within a UISquadSelect ScreenListener. Overall it's a fairly hack-ey solution, and I can't recommend it, and I can't really recommend it. Especially since the mod would be incompatible with OfficerPack. Link to comment Share on other sites More sharing options...
TheRealSFlo Posted March 10, 2016 Author Share Posted March 10, 2016 (edited) Well crap... What about using a UIScreenListener to just watch UISquadSelect_ListItem without modifying it? Or do I absolutely have to override OnClickedDismissButton() to run things when it's called? Edited March 10, 2016 by TheRealSFlo Link to comment Share on other sites More sharing options...
kosmo111 Posted March 10, 2016 Share Posted March 10, 2016 Could you maybe try getting around it by registering a watch? I have not played around with this screen, but would 'm_iSelectedSlot' be changed reliably enough to give you the update tick you need? Link to comment Share on other sites More sharing options...
TheRealSFlo Posted March 10, 2016 Author Share Posted March 10, 2016 (edited) Wait, is that a thing? I was under the impression that we're more or less out of luck in this instance if we can't get any of UIScreenListener's events to trigger. Edited March 10, 2016 by TheRealSFlo Link to comment Share on other sites More sharing options...
kosmo111 Posted March 10, 2016 Share Posted March 10, 2016 Well, I think the easiest way would just be to show you an example. In my mod I needed a way to update data every time a new soldier was 'focused' during tactical play. So I used this in a UITacticalHUD ScreenListener: `BATTLE.WorldInfo.MyWatchVariableMgr.RegisterWatchVariable( XComTacticalController(`PRES.Owner), 'm_kActiveUnit', self, updateStats); This is (to my understanding) saying that whenever the m_kActiveUnit variable located in the `Pres.Owner instance of XComTacticalController is directly changed (like, assigned via an = operator), call the updateStats function located in the 'self' object. You may be able to do something similar to achieve the same results if you can find a variable that can be watched and changes at the correct times. If you are curious, my Lifetime Stats mod does this in the LifetimeStats_ScreenListener.uc class (which is more updated on the Workshop than on the nexus). Link to comment Share on other sites More sharing options...
Recommended Posts