Method to get unit resource requirement

qqqbbb

Prince
Joined
Sep 25, 2010
Messages
530
Is there a method that returns type and number of resource required to build a unit?
 
Off the top of my head I don't know.

But what I do know is that the game will tell you this when choosing a unit to build in a city.

That code is in ProductionPopup.lua (a very useful starting point for a lot of unit/building/project related questions)

Take a look in there and see how that does it.
 
ProductionPopup.lua uses city:CanTrain and city:IsCanPurchase but it's not exactly what I need.
 
Those control if a city can build a unit, you need the text that gets placed into the tooltips that tell you why the city can't build a unit just yet - look at the GetHelpTextForUnit() code (it's called in from InfoTooltipInclude.lua)
 
Back
Top Bottom