[store_unit] Get ability values
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.
[store_unit] Get ability values
I have this store unit
In the variable "healers" I store all the adjacent unit who have the "healer" ability. But now I want to get the value of the healer ability of each unit. I mean, the "healer" ability has a value (like: "healer +4", "healer +8", etc). I want to get that value. How can I do that?
I tried with something like this:
But didn't work, also I tried with "ability" instead of "abilities"... but again it didn't work . Any ideas?
Code: Select all
[store_unit]
[filter]
x,y=$x1,$y1
[filter_adjacent]
side=$side_number
ability=healer
[/filter_adjacent]
[/filter]
variable=healers
[/store_unit]
Code: Select all
#define ABILITY_HEALER HP
[dummy]
value={HP}
id=healer
name= _ "medic +{HP}"
female_name= _ "female^medic + {HP}"
description= _ "This unit is able to use it own turn in order to heal an specific wounded target."
[/dummy]
#enddef
Code: Select all
$healers[{number}].abilities.healer.value
Re: [store_unit] Get ability values
There's no [healer] tag, there's a [dummy] tag, so $healers[{number}].abilities.dummy.value would be correct. But of course that means you should choose a disambiguous tag name (because it can be anything), just in case the unit has other [dummy] abilities.Enderlook wrote:I tried with something like this:
But didn't work, also I tried with "ability" instead of "abilities"... but again it didn't work . Any ideas?Code: Select all
$healers[{number}].abilities.healer.value
Re: [store_unit] Get ability values
Thanks! I didn't know that I had to write the tag name instead of id. Also I didn't know that I could make my own dummies!