Adding spell points
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Adding spell points
Hi,
I would like to know what is the best place to add spell points informations for a unit.
Is it possible to had spell points informations underneath the experience points of a unit?
Thank you.
Sorry for my English, I'm french.
I would like to know what is the best place to add spell points informations for a unit.
Is it possible to had spell points informations underneath the experience points of a unit?
Thank you.
Sorry for my English, I'm french.
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
Re: Adding spell points
While it's not easily possible to put a mana display under the experience, Exasperation and I figured a good place to put spell points is where traits normally are, since leaders don't usually have traits anyway. Check this out.
Code: Select all
[set_variables]
name=unit.modifications.trait
mode=replace
[value]
id="mana_counter"
name="mana: $unit.mana|/$unit.max_mana|"
description=" Available mana / maximum stored mana."
[/value]
[/set_variables]
Re: Adding spell points
Thank you, I was thinking about that solution too. It seems to be the easiest way.
Thank you.
Thank you.
Re: Adding spell points
shouldn't it be possible to use overlays?
- Ken_Oh
- Moderator Emeritus
- Posts: 2178
- Joined: February 6th, 2006, 4:03 am
- Location: Baltimore, Maryland, USA
Re: Adding spell points
It should be possible. I've thought of it too, but it would be a pain.
Re: Adding spell points
I also thought of it. But I don't know if it's possible/easy to draw a bar. But it would be cool.
It is ok to correct me if my English is too bad.
Working on Cunnicula Civil War
Working on Cunnicula Civil War
Re: Adding spell points
I'm fairly certain the current bars are some sort of overlay, aren't they?
Re: Adding spell points
unfortunately http://www.wesnoth.org/wiki/ImagePathFunctionWML isn't supported by overlays, but you should be able to get something similar to xp / hp bars.
have three or four overlays for the empty bar (including the border) so you get different lengths like it's done for xp/hp (it's not that dynamic, but hey^^). then you need a couple of (i guess 20 should be granular enough) overlays to fill them (starts with 1pix, last one completely fills the largest bar overlay). variable substitution works fine for image key, so you apply some math to get the right overlay for the bar and pick one of the 20 that fits best for current / max mana percentage.
coding wise this should be rather trivial, but i'm not sure if it's flicker free, since you need to remove and add those two overlays regularly.
have three or four overlays for the empty bar (including the border) so you get different lengths like it's done for xp/hp (it's not that dynamic, but hey^^). then you need a couple of (i guess 20 should be granular enough) overlays to fill them (starts with 1pix, last one completely fills the largest bar overlay). variable substitution works fine for image key, so you apply some math to get the right overlay for the bar and pick one of the 20 that fits best for current / max mana percentage.
coding wise this should be rather trivial, but i'm not sure if it's flicker free, since you need to remove and add those two overlays regularly.