[BNW] Change mouseover tooltip?

OctopusA

Chieftain
Joined
Jan 7, 2017
Messages
5
Hi all,

I am recently working on a trait that buffs the golden age, giving additional 10% production and gold. I have finished the trait effect, but I wonder if there is a way to change the mouseover tooltip on the top panel (attached pitcture).

Thank you.:)
 

Attachments

  • Golden.PNG
    Golden.PNG
    15.8 KB · Views: 52
Octo - I'm not 100% sure about this, but....

From a quick look at the TopPanel.lua file it looks like this value is set in the function called "GoldenAgeTipHandler"

You'd need to adjust that function to include the information you'd like it to display, then include your new TopPanel.lua as a replacement file in your mod.

Also, look at the text values of TXT_KEY_TP_GOLDEN_AGE_EFFECT, TXT_KEY_TP_CARNIVAL_EFFECT, and the other text keys in that function - if the changes you want to make are simple text changes, you may be able to simply update those values using XML and not need to update the LUA file.
 
Last edited:
Thank you very much. I will check that.

One more question, is there a way to increase production rate for a specific unit type? E.g. 100% more production for Musketeer during war?

Octo - I'm not 100% sure about this, but....

From a quick look at the TopPanel.lua file it looks like this value is set in the function called "GoldenAgeTipHandler"

You'd need to adjust that function to include the information you'd like it to display, then include your new TopPanel.lua as a replacement file in your mod.

Also, look at the text values of TXT_KEY_TP_GOLDEN_AGE_EFFECT, TXT_KEY_TP_CARNIVAL_EFFECT, and the other text keys in that function - if the changes you want to make are simple text changes, you may be able to simply update those values using XML and not need to update the LUA file.
 
I'm not sure I understand what you're trying to do. Do you mean a civ can generate the Musketeer twice as fast during war?

If so, I'd recommend opening a new thread to get a better response, because the only way I can think of changing unit cost for a player at war would be to do something very brute force. As all civs share a single unit definition for each unit, at any one time, there can be only one cost for a given unit. You'd need code that did something like this:

1. Add an event to GameEvents.PlayerDoTurn.Add (changeWartimeProduction ). The functions tied to this event pop at the beginning of a player's turn.

2. In the changeWartimeProduction function, test for at war, and if so loop through all the units to change their cost at the lower level.

3. Add an event at turn end to reset the unit prices, e.g. Events.ActivePlayerTurnEnd.Add( resetWartimeProduction )

4. In the resetWartimeProduction function, there is no need to test for at war, just check the first unit's cost. If it's not the "standard cost" loop through all the units to change unit price to standard cost. Just in case peace was declared in-turn.

You might also want to adjust the HurryCostModifiers so the gold purchase price wouldn't cut in half as well. It's a bit of a pain if each unit has a different modifier, as you'd need to build a persistent table that remembers the original HurryCostModifier, so you can reset it at the end of turn. If it were me, I'd make sure all units have the same modifier and call it done. Would greatly simplify the code, as you'd only need a peacetime and wartime modifier.

I'm an absolute beginner with LUA, so someone out there probably has a better way. All of this is pretty brute force, so adding a new thread will pop it to the top of the list so some actual experts can offer a better approach.

Good luck!
 
Back
Top Bottom