Display damage in unitdef description?
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Display damage in unitdef description?
Is there a way that I can display a unit's damage and reloadrate in the description of that unit luamagiccally? Atm I am doing it by hand, and it's a pita.
Re: Display damage in unitdef description?
yeah. see healthbar rip that off plug it into the info box.
Re: Display damage in unitdef description?
See kp_tooltip.lua ?


- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Display damage in unitdef description?
So it can't be put INTO the description, only put adjacent to where the description is displayed.
Bit more complicated than I hoped for, but meh, I'll live.
Thanks guys
Bit more complicated than I hoped for, but meh, I'll live.
Thanks guys
Re: Display damage in unitdef description?
Do you mean the engine tooltip or a widget tooltip like in KP or zK?
For widgets obvious way is to edit the widget that it gets another field where it shows DPS and not use unitdef description.
There was no mentioning of widget so I will just babble on about engine tooltip. (the /tooltip one)
The supersimple way like:does IIRC not work in Lua.
But this should work:
(This just to show principle, instead of just damage there would be formula to calculate real DPS from burstrate, number of projectiles etc and a loop for multiple weapons)
Even better is imo to have the description generation in _post.lua, especially if you have many other things in description.
Something like that:
For widgets obvious way is to edit the widget that it gets another field where it shows DPS and not use unitdef description.
There was no mentioning of widget so I will just babble on about engine tooltip. (the /tooltip one)
The supersimple way like:
Code: Select all
unitdef =
{
unitname = "Tank",
weapondef = {
damage = 150,
},
description = "Deals " .. weapondef.damage .. " damage per shot",
}
But this should work:
Code: Select all
unitdef =
{
unitname = "Tank",
weapondef = {
damage = 150,
},
}
unitdef.description = "Deals " .. unitdef.weapondef.damage .. " damage per shot"
Even better is imo to have the description generation in _post.lua, especially if you have many other things in description.
Something like that:
could/should be automatically generated imo.description = [[Tank Destroyer Light, 25% Damage vs Buildings Can fire while underwater Requires +5 Power]],
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Display damage in unitdef description?
^^ this, is exactly what I was looking for
Thanks
