Dynamic unit-type description tooltip for trained units

Level 5
Jun 12, 2018
Hi ! I have a dynamic rolling system which allows to draft random different unit-types inside a building.
After the unit is trained, I have a script which sets max HP and base damage according to unit's tier & level.
The fact is that I got more than 150 different unit-types and I'd like to make a generic tooltip description to give info on unit's stats before you buy it.

I've looked into the new native functions and I've found
native BlzSetUnitStringField takes unit whichUnit, unitstringfield whichField, string value returns boolean
So basically I'm able to use it like this :
call BlzSetUnitStringField ( target, ConvertUnitStringField('utip'), "This is a good tooltip descr" )

Problem is that the AddUnitToStock function I'm using to dynamically add randomized units to my building takes an integer value as a parameter representing the unit-type ID.

Is there a way to dynamically change unit tooltips description in a building before they are getting trained ?

Thanks for the help ! :infl_thumbs_up:
Level 35
Feb 27, 2007
Train the units as normal and have a spellbook that mirrors the training page with passive abilities that give the descriptions for each unit. With a bit of effort to account for training costs you might be able to get a series of abilities based on Charge Gold and Lumber to function as a build menu since afaik that ability can have its base order changed to avoid collisions.