I am trying to create a simple mod in which a player can toggle the floating icons on/off. I found this interesting bit of code in the InGame.lua:
This function hides unit icons (and city banners) upon entering a city. Likewise, there is another function similar to this which re-shows the icons upon exiting the city view:
So I created a new checkbox in the MiniMapPanel.xml called ID="HideUnitIcon". In the MiniMapPanel.lua, I then tried to put the UnitFlagManager:SetHide command into the handler for the new checkbox as so:
The mod is ineffective. Sure, there is the check-box I created, but checking it has no effect on the visibility of the unit icons. The handler works just fine, though. To test, I copied the code from the 'show resource icons' handler into this handler, and when I loaded the mod, sure enough, the resource icons were toggled as I used this new checkbox.
So the only suspect part of this code is the Controls.UnitFlagManager:SetHide ( bIsChecked ); command. It works for the other functions in the InGame.lua, but not for this function in the MiniMapPanel.lua
Any discussion on why this isn't working, or better yet, how to get it to work would be very beneficial. Thanks.
Spoiler:
This function hides unit icons (and city banners) upon entering a city. Likewise, there is another function similar to this which re-shows the icons upon exiting the city view:
Spoiler:
So I created a new checkbox in the MiniMapPanel.xml called ID="HideUnitIcon". In the MiniMapPanel.lua, I then tried to put the UnitFlagManager:SetHide command into the handler for the new checkbox as so:
Spoiler:
The mod is ineffective. Sure, there is the check-box I created, but checking it has no effect on the visibility of the unit icons. The handler works just fine, though. To test, I copied the code from the 'show resource icons' handler into this handler, and when I loaded the mod, sure enough, the resource icons were toggled as I used this new checkbox.
So the only suspect part of this code is the Controls.UnitFlagManager:SetHide ( bIsChecked ); command. It works for the other functions in the InGame.lua, but not for this function in the MiniMapPanel.lua
Any discussion on why this isn't working, or better yet, how to get it to work would be very beneficial. Thanks.