UnitFlagManager

jackgames

Warlord
Joined
Aug 10, 2013
Messages
115
Hello,
I want to modify the UnitFlagManager.lua file for units that have cargo skill, especially carriers: the flag only shows the number of aircrafts based on a carrier, but not the total plots available for units. I'd like it to display : " 1 / 4" to show that there's 1 aircraft based out of 4 potentially carried, for instance.
I've found the lines that handle this (line 797):
Code:
self.m_CargoControls.PullDown:LocalizeAndSetToolTip( "TXT_KEY_STATIONED_AIRCRAFT", cargoCount );
How to get the remaining plots for units and display it ?
 
Update the text for TXT_KEY_STATIONED_AIRCRAFT like this:

Code:
<Update>
 <Where Tag="TXT_KEY_STATIONED_AIRCRAFT"/>
 <Set Text="{1_number} / {2_max} Aircraft Stationed"/>
</Update>

And change the line in LUA to:

Code:
self.m_CargoControls.PullDown:LocalizeAndSetToolTip( "TXT_KEY_STATIONED_AIRCRAFT", cargoCount, pPlotUnit:CargoSpace() )
 
I made the changes given, but when the mouse's over the flag, nothing happens : the tooltip doesn't show up !
And, I'd also want to display this info in the permanent flag, next to the unit icon, that shows the number of units abroad.
It's set at line 796:
Code:
self.m_CargoControls.Count:SetText( cargoCount );
I tried to do this:
Code:
self.m_CargoControls.Count:SetText( cargoCount .. " / " .. pPlotUnit:CargoSpace() );
But then, nothing is displayed...
 
I made the changes given, but when the mouse's over the flag, nothing happens : the tooltip doesn't show up !
And, I'd also want to display this info in the permanent flag, next to the unit icon, that shows the number of units abroad.
It's set at line 796:
Code:
self.m_CargoControls.Count:SetText( cargoCount );
I tried to do this:
Code:
self.m_CargoControls.Count:SetText( cargoCount .. " / " .. pPlotUnit:CargoSpace() );
But then, nothing is displayed...

Nothing happened with the modified tooltip? (the example you just posted is wrong, by the way).

Did you change the text? did it register? Can you check lua.log (or run the FireTuner and look at the console output when mousing over the tooltip) and see what it says (making sure you have logging enabled before doing anything lua related).
 
I think the reason why is:
if you have a look some lines above (line 768 and following) you'll see the variable pPlotUnit is local to the "for" loop, and you use it outside...
 
I think the reason why is:
if you have a look some lines above (line 768 and following) you'll see the variable pPlotUnit is local to the "for" loop, and you use it outside...

You're correct. Use pUnit instead.
 
Great ! Works fine. Thanks a lot.
One last thing:
the permanent flag (next to icon) is'nt large enough to display all the info (the first number is masked by the icon). Where can I set the size of this element ?
 
Back
Top Bottom