Adding spell points

The place to post your WML questions and answers.

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.
Post Reply
Vaihlor
Posts: 2
Joined: September 7th, 2009, 5:23 pm

Adding spell points

Post by Vaihlor »

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.
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Adding spell points

Post by Ken_Oh »

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]
Image
Vaihlor
Posts: 2
Joined: September 7th, 2009, 5:23 pm

Re: Adding spell points

Post by Vaihlor »

Thank you, I was thinking about that solution too. It seems to be the easiest way.

Thank you.
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Adding spell points

Post by Max »

shouldn't it be possible to use overlays?
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Adding spell points

Post by Ken_Oh »

It should be possible. I've thought of it too, but it would be a pain.
User avatar
Lord Ork
Code Contributor
Posts: 300
Joined: January 8th, 2009, 1:51 pm

Re: Adding spell points

Post by Lord Ork »

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
User avatar
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: Adding spell points

Post by melinath »

I'm fairly certain the current bars are some sort of overlay, aren't they?
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Adding spell points

Post by Max »

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.
Post Reply