Heal leadership
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.
Heal leadership
Firstly, I'm working off 1.8.
I'm trying to create a special heal that is affected by an adjacent unit who has medical supplies, etc. For the test runs, I did not give it a creative and unique name.
Here is what I have so far, but due to my incompetence, Wesnoth complains that my add-on is unsupportable because of a missing closing tag. In addition, I suspect the code will only heal 6 (rather than 4) damage to the units with the medical supply ability.
Here goes:
The above is given to the unit who has medical supplies with an ability tag.
The above is given to a healer with an ability tag.
P.S: I know none of the acronyms or fancy coding terms. Keep it layman's, please. Thanks.
I'm trying to create a special heal that is affected by an adjacent unit who has medical supplies, etc. For the test runs, I did not give it a creative and unique name.
Here is what I have so far, but due to my incompetence, Wesnoth complains that my add-on is unsupportable because of a missing closing tag. In addition, I suspect the code will only heal 6 (rather than 4) damage to the units with the medical supply ability.
Here goes:
Code: Select all
#define HEAL_LEADING
[dummy]
id=heal_leading
name= _ "Heal leading"
female_name= _ "female^Heal leading"
description=_ "Lorum Ipsum"
[/dummy]
#enddef
Code: Select all
#define LEADEABLE_DAMAGE
[dummy]
id=leadeable_damage
name= _ "leadeable damage"
female_name= _ "female^leadeable damage"
description=_ "Lorum Ipsum"
[/dummy]
[/specials]
[event]
name=new turn
first_time_only=no
[filter]
ability=healing
[/filter]
[filter_adjacent]
ability=heal_leading
is_enemy=no
[/filter_adjacent]
[store_unit]
[filter]
side=$unit.side
[filter_adjacent]
x,y=$x1,$y1
[/filter_adjacent]
[/filter]
variable=Game_array
kill=no
[/store_unit]
{FOREACH Game_array u}
{VARIABLE_OP Game_array[$u].hitpoints add 6}
[if]
[variable]
name=Game_array[$u].hitpoints
greater_than=$Game_array[$u].max_hitpoints
[/variable]
[then]
{VARIABLE Game_array[$u].hitpoints $Game_array[$u].max_hitpoints}
[/then]
[/if]
[unstore_unit]
variable=Game_array[$u]
text="6"
{COLOR_HEAL}
[/unstore_unit]
{NEXT u}
[/event]
[event]
name=new turn
first_time_only=no
[filter]
ability=healing
[/filter]
[filter_adjacent]
is_enemy=no
[/filter_adjacent]
[store_unit]
[filter]
side=$unit.side
[filter_adjacent]
x,y=$x1,$y1
[/filter_adjacent]
[/filter]
variable=Game_array
kill=no
[/store_unit]
{FOREACH Game_array u}
{VARIABLE_OP Game_array[$u].hitpoints add 4}
[if]
[variable]
name=Game_array[$u].hitpoints
greater_than=$Game_array[$u].max_hitpoints
[/variable]
[then]
{VARIABLE Game_array[$u].hitpoints $Game_array[$u].max_hitpoints}
[/then]
[/if]
[unstore_unit]
variable=Game_array[$u]
text="4"
{COLOR_HEAL}
[/unstore_unit]
{NEXT u}
[/event]
[+specials]
#enddef
P.S: I know none of the acronyms or fancy coding terms. Keep it layman's, please. Thanks.
Re: Heal leadership
This isn't incompetence, just a wrong tag.
Your second code has a "[/specials]" tags without opening at line 8. Try to remove it and see if it works.
Your second code has a "[/specials]" tags without opening at line 8. Try to remove it and see if it works.
Re: Heal leadership
Don't listen to him. Your problem is that it is an ability and the closing and reopening tags are [/specials] and [+specials] instead of [/abilities] and [+abilities]. Also, the events are completely messed up. The filters in events are completely wrong, you should put them into the [store_unit] tag. You have the same event twice, one of them is made to heal 6 hp, the other one is meant to heal 4 hp, so on a new turn, they will heal 6 hp and 4 hp in a sequence very quickly, effectively healing 10 hp.
I also advise you to give an id to the event to avoid duplicating it when there is more healers in the scenario, and to clear the variables after.
I also advise you to give an id to the event to avoid duplicating it when there is more healers in the scenario, and to clear the variables after.
Re: Heal leadership
Sshh!
There is this [heal_unit] tag, just noting.
There is this [heal_unit] tag, just noting.
UMC Story Images — Story images for your campaign!
Re: Heal leadership
If you want normal healing behaviour which merely requires an adjacent "heal leader" to work, then you don't need any events for that; just copy a core healing ability and add something along these lines to it:
Code: Select all
[filter]
[filter_adjacent]
ability=heal_leading
is_enemy=no
[/filter_adjacent]
[/filter]
Re: Heal leadership
Oh, look, a [heal_unit] tag, ha ha (laughs weakly).
Anyway, I re-wrote and this still isn't working. I wrote it to heal 4 dmg at the beginning of each turn, and then an extra 2 if a heal leadership unit is adjacent.
Zookeeper's solution looked like it should have been elegant and simple, but I'm clueless. Does (He/You) mean like this?:
Anyway, I re-wrote and this still isn't working. I wrote it to heal 4 dmg at the beginning of each turn, and then an extra 2 if a heal leadership unit is adjacent.
Code: Select all
#define HEAL_LEADING
[dummy]
id=heal_leading
name= _ "Heal leading"
female_name= _ "female^Heal leading"
description=_ "Lorum Ipsum"
[/dummy]
#enddef
#define LEADEABLE_HEALING
[dummy]
id=leadeable_healing
name= _ "leadeable healing"
female_name= _ "female^leadeable damage"
description=_ "Lorum Ipsum"
[/dummy]
[event]
name=new turn
first_time_only=no
[filter]
[filter_adjacent]
ability=heal_leading
is_enemy=no
[/filter_adjacent]
[/filter]
[heal_unit]
[filter_adjacent]
is_enemy=no
[/filter_adjacent]
amount=2
restore_statuses=yes
[/heal_unit]
[/event]
[event]
name=new turn
first_time_only=no
[filter]
ability=healing
[filter_adjacent]
is_enemy=no
[/filter_adjacent]
[/filter]
[heal_unit]
[filter_adjacent]
is_enemy=no
[/filter_adjacent]
amount=4
restore_statuses=yes
animate=yes
[/heal_unit]
[/event]
#enddef
Zookeeper's solution looked like it should have been elegant and simple, but I'm clueless. Does (He/You) mean like this?:
Code: Select all
#define ABILITY_HEALS
# Canned definition of the heal+4 ability to be included in an [abilities] clause.
[heals]
[filter]
[filter_adjacent]
ability=heal_leading
is_enemy=no
[/filter_adjacent]
value=6
[/filter]
[filter]
[filter_adjacent]
is_enemy=no
[/filter_adjacent]
value=4
[/filter]
id=healing
affect_allies=yes
name= _ "heals +4"
female_name= _ "female^heals +4"
description= _ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.
A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
affect_self=no
poison=slowed
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[/affect_adjacent]
[/heals]
#enddef
Re: Heal leadership
OK, update. I tried the other way and I found out I can't say if/then, I can only say if (with a filter.)
Any solutions that would get either of the two possibilities to work would be greatly appreciated.
Any solutions that would get either of the two possibilities to work would be greatly appreciated.
Code: Select all
#define ABILITY_HEALS_LEADEABLE
# Canned definition of the heal+4 ability to be included in an [abilities] clause.
[heals]
id=healing
affect_allies=yes
name= _ "heals +4"
female_name= _ "female^heals +4"
description= _ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.
A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
affect_self=no
poison=slowed
[filter_adjacent]
is_enemy=no
ability=heal_leading
[/filter_adjacent]
[then]
value=6
[/then]
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[/affect_adjacent]
[/heals]
#enddef
Re: Heal leadership
This time around, I was brilliant. Problem is, this still won't work. Here is the code:
The unit in question is given
and another unit is given the battle healing.
I really need to know how to get this working (And/or if this can be gotten to work); I've already fully created a sprite for the supplies person and am holding off creating more units until I know whether this works or not. (I must, considering how the faction is intended to work together.) Any response at all will be immensely appreciated.
Thanks.
Code: Select all
#define HEAL_LEADING
[dummy]
id=heal_leading
name= _ "Heal leading"
female_name= _ "female^Heal leading"
description=_ "Lorum Ipsum"
[/dummy]
#enddef
#define ABILITY_HEALS_LEADEABLE
# Canned definition of the heal+4 ability to be included in an [abilities] clause.
[heals]
value=6
id=healingPlusLeadeable
affect_allies=yes
name= _ "heals +4"
female_name= _ "female^heals +4"
description= _ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.
A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
affect_self=no
poison=slowed
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[/affect_adjacent]
[/heals]
#enddef
#define LEADEABLE_HEALING_EVENT
# Canned definition of the heal+4 ability to be included in an [abilities] clause.
[dummy]
id=leadeableEvent
name= _ "Leadeable Event"
female_name= _ "female^Heal leading"
description=_ "Lorum Ipsum"
[/dummy]
[event]
name=turn end
first_time_only=no
[modify_unit]
[filter]
type=battlefield_medic
[/filter]
[modifications]
[abilities]
{ABILITY_HEALS}
[/abilities]
[/modifications]
[/modify_unit]
[modify_unit]
[filter]
type=battlefield_medic
[filter_adjacent]
ability=heal_leading
is_enemy=no
[/filter_adjacent]
[/filter]
[modifications]
[abilities]
{ABILITY_HEALS_LEADEABLE}
[/abilities]
[/modifications]
[/modify_unit]
[/event]
#enddef
The unit in question is given
Code: Select all
[abilities]
{ABILITY_HEALS}
{LEADEABLE_HEALING_EVENT}
[/abilities]
I really need to know how to get this working (And/or if this can be gotten to work); I've already fully created a sprite for the supplies person and am holding off creating more units until I know whether this works or not. (I must, considering how the faction is intended to work together.) Any response at all will be immensely appreciated.
Thanks.
Re: Heal leadership
Tested, works.
Code: Select all
#define ABILITY_HEALS_LEADING
[dummy]
id=healing_leading
# ...
[/dummy]
#enddef
#define ABILITY_HEALS_LEADABLE
[heals]
id=healing_leadable
# everything else like in core heals...
[filter]
[filter_adjacent]
ability=healing_leading
is_enemy=no
[/filter_adjacent]
[/filter]
[/heals]
#enddef
Re: Heal leadership
Thank you so much! My gratitude cannot be expressed!
For those of you who may want the code, I found a way to modify it so the unit still heals when a unit with the leadership is not adjacent, just in a lesser amount. All credit goes to zookeeper for this:
For those of you who may want the code, I found a way to modify it so the unit still heals when a unit with the leadership is not adjacent, just in a lesser amount. All credit goes to zookeeper for this:
Code: Select all
#define ABILITY_HEALS_LEADABLE
[heals]
id=healing_leadable
value=6
id=healing
affect_allies=yes
name= _ "heals +4"
female_name= _ "female^heals +4"
description= _ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.
A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
affect_self=no
poison=slowed
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[/affect_adjacent]
[filter]
[filter_adjacent]
ability=healing_leading
is_enemy=no
[/filter_adjacent]
[/filter]
[/heals]
[heals]
id=healing_leadable_two
value=4
id=healing
affect_allies=yes
name= _ "heals +4"
female_name= _ "female^heals +4"
description= _ "Heals +4:
Allows the unit to heal adjacent allied units at the beginning of our turn.
A unit cared for by this healer may heal up to 4 HP per turn, or stop poison from taking effect for that turn.
A poisoned unit cannot be cured of its poison by a healer, and must seek the care of a village or a unit that can cure."
affect_self=no
poison=slowed
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[/affect_adjacent]
[/heals]
#enddef