I'm trying to create a buff that grows the size of a unit's life bar upon gaining veterancy levels so that they're easier to pick out in a crowd.
For more context, I'm editing another mod, Endless Levels, which allows unit veterancy to go on indefinitely. Of course, I will keep this private, but this thread might be a useful resource for future original modders.
I've never coded in lua before, so the I've tried reverse-engineering existing code for my own purposes. Currently, I've come up with the following additions:
*BuffDefinitions.lua
- Code: Select all
BuffBlueprint {
Name = 'VeterancyLifeBar',
DisplayName = 'VeterancyLifeBar',
BuffType = 'VETERANCYLIFEBAR',
Stacks = 'ALWAYS',
Duration = -1,
Affects = {
LifeBarSize = {
Add = 0,
Mult = 1.1,
},
},
}
*Buff.lua
- Code: Select all
elseif atype == 'LifeBarSize' then
local val = BuffCalculate(unit, buffName, atype, unit:GetLifeBarSize())
unit:SetLifeBarSize(val)
The game does work, and the existing buffs also work, except for my addition. I suspect there's a problem with my Buff.lua entry, and I may be missing another reference entirely.
Any help would be much appreciated!