Display damage in unitdef description?

Display damage in unitdef description?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Display damage in unitdef description?

Post by Forboding Angel »

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.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Display damage in unitdef description?

Post by smoth »

yeah. see healthbar rip that off plug it into the info box.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Display damage in unitdef description?

Post by zwzsg »

See kp_tooltip.lua ?

Image
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Display damage in unitdef description?

Post by Forboding Angel »

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
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Display damage in unitdef description?

Post by knorke »

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:

Code: Select all

unitdef = 
{
unitname = "Tank",
weapondef = {
damage = 150,
},
description = "Deals " .. weapondef.damage .. " damage per shot",
}
does IIRC not work in Lua.

But this should work:

Code: Select all

unitdef = 
{
unitname = "Tank",
weapondef = {
damage = 150,
},
}
unitdef.description = "Deals " .. unitdef.weapondef.damage .. " damage per shot"
(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:
description = [[Tank Destroyer Light, 25% Damage vs Buildings• Can fire while underwater Requires +5 Power]],
could/should be automatically generated imo.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Display damage in unitdef description?

Post by Forboding Angel »

^^ this, is exactly what I was looking for :-) Thanks
Post Reply

Return to “Game Development”