abilities, events, and other black magic [SOLVED]
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.
-
- Posts: 26
- Joined: April 1st, 2024, 10:35 pm
abilities, events, and other black magic [SOLVED]
ok, I give up
some months ago i posted a wrongfully named question about abilities that i named traits
in which i tried to understand how does it work and why it doesn't work on me
good people here helped me, thanks a lot, but then i tried to copy an ability from one campaign to the main game
I failed, and wiki.wesnoth didn't help me, i mean it tried but i'm apparently dumb enough to not understand.
So here I am, with humility, asking the good people here to help me again:
There is an UTBS-campaign-only ability named Disengage
As an example the Quenoth Archer has it. In utils\abilities.cfg it looks like this
and this
What i want is to port this ability to the main game, for it to be "global", and to add it to all undead units;
adding to undeads is trivial, what is not trivial for me is the first part.
some months ago i posted a wrongfully named question about abilities that i named traits
in which i tried to understand how does it work and why it doesn't work on me
good people here helped me, thanks a lot, but then i tried to copy an ability from one campaign to the main game
I failed, and wiki.wesnoth didn't help me, i mean it tried but i'm apparently dumb enough to not understand.
So here I am, with humility, asking the good people here to help me again:
There is an UTBS-campaign-only ability named Disengage
As an example the Quenoth Archer has it. In utils\abilities.cfg it looks like this
Code: Select all
#define ABILITY_DISENGAGE
[dummy]
id=disengage
name= _ "disengage"
female_name= _ "female^disengage"
description= _ "If this unit doesn’t move before attacking, it will retain its movement points after the attack."
special_note=_"This unit can move either before or after attacking."
[/dummy]
#enddef
Code: Select all
#define ABILITY_DISENGAGE_EVENTS
[event]
name=attack end
first_time_only=no
[filter]
ability=disengage
[not]
[filter_wml]
moves=$this_unit.max_moves
[/filter_wml]
[/not]
[/filter]
{VARIABLE unit.moves 0}
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/event]
#enddef
adding to undeads is trivial, what is not trivial for me is the first part.
Last edited by KanoFromMK on July 8th, 2024, 12:01 pm, edited 1 time in total.
Re: abilities, events, and other black magic
Main solutions are
1) have event in [era] or [campaign], that is probably what UTBS does
2) use +tag syntax to include copy of the event in each unit that has such ability, example https://github.com/ProditorMagnus/Agele ... ad.cfg#L10
1) have event in [era] or [campaign], that is probably what UTBS does
2) use +tag syntax to include copy of the event in each unit that has such ability, example https://github.com/ProditorMagnus/Agele ... ad.cfg#L10
-
- Posts: 1456
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: abilities, events, and other black magic
Is that event meant to stand on its own, or is there some other event(s) that it is affecting?
Seems to me, after an attack your moves are set to 0 anyway. Or perhaps you can't move if attacks=0, and so some this makes it so only units with disengage that didn't move will have moves>0, so some other event will not enable them to move. Or something. I can come up with some pretty out there theories, but nothing that doesn't involve some code not shown above.
What am I missing?
Seems to me, after an attack your moves are set to 0 anyway. Or perhaps you can't move if attacks=0, and so some this makes it so only units with disengage that didn't move will have moves>0, so some other event will not enable them to move. Or something. I can come up with some pretty out there theories, but nothing that doesn't involve some code not shown above.
What am I missing?
Speak softly, and carry Doombringer.
Re: abilities, events, and other black magic
white_haired_uncle: the missing piece is every attack of every unit with that ability has
KanoFromMK: that's an old version of the WML, because of the Tailwind ability it now needs to check for
[attack]movement_used=0
.KanoFromMK: that's an old version of the WML, because of the Tailwind ability it now needs to check for
formula = "self.moves<self.max_moves"
instead.-
- Posts: 26
- Joined: April 1st, 2024, 10:35 pm
Re: abilities, events, and other black magic
Thanks for your time. Where can I update the WML? And will the updated WML help me with my problem? If yes, how?octalot wrote: ↑July 1st, 2024, 4:20 pm white_haired_uncle: the missing piece is every attack of every unit with that ability has[attack]movement_used=0
.
KanoFromMK: that's an old version of the WML, because of the Tailwind ability it now needs to check forformula = "self.moves<self.max_moves"
instead.
-
- Posts: 26
- Joined: April 1st, 2024, 10:35 pm
Re: abilities, events, and other black magic
Thank for answering. For 2) I'm not that good with coding, can you help me understand what am I looking at? Or if the first solution is simpler can you please help me implement it?Ravana wrote: ↑July 1st, 2024, 2:26 pm Main solutions are
1) have event in [era] or [campaign], that is probably what UTBS does
2) use +tag syntax to include copy of the event in each unit that has such ability, example https://github.com/ProditorMagnus/Agele ... ad.cfg#L10
Re: abilities, events, and other black magic
I will not. I am not good at explaining. I might answer if you ask something specific.
-
- Posts: 26
- Joined: April 1st, 2024, 10:35 pm
Re: abilities, events, and other black magic
It's already possible to rename threads, which might avoid the need to create new ones. If you're the author of the first post of a thread, editing that post's title also renames the thread AFAIK.
It might make sense to merge this thread into https://r.wesnoth.org/t58084 , but merging threads can only be done by moderators.
Update it by getting a new copy it from the current version of UtBS. However, no, that won't solve any problems except for "disengage doesn't work when the unit was healed by a Quenoth Shaman (with the Tailwind ability) that turn".KanoFromMK wrote: ↑July 2nd, 2024, 8:34 pm Where can I update the WML? And will the updated WML help me with my problem?
Part of the problem is that UtBS has implemented the ability by putting
[attack]movement_used=0
into the unit definitions, for example into data/campaigns/Under_the_Burning_Suns/units/quenoth/Outrider.cfg, instead of putting it into the ability. To apply it to other units, you need some EffectWML:
Code: Select all
[effect]
apply_to=attack
set_movement_used=0
-
- Posts: 26
- Joined: April 1st, 2024, 10:35 pm
Re: abilities, events, and other black magic
Oh My God
it was so simple
thanks man you're F-ing hero
yes indeed, adding movement_used=0 into [attack][/attack] solved the problem
i dont understand how events work its still black magic to me, but its not that hard either to add this movement_used=0 to every unit in undead, certainly easier than to try to make it as a normal person would
again i dont know how to close the subject and label it as solved, is that also the forum moderator's job?
Thanks again and good luck to all that tried to help me and you who managed to helped me
it was so simple
thanks man you're F-ing hero
yes indeed, adding movement_used=0 into [attack][/attack] solved the problem
i dont understand how events work its still black magic to me, but its not that hard either to add this movement_used=0 to every unit in undead, certainly easier than to try to make it as a normal person would
again i dont know how to close the subject and label it as solved, is that also the forum moderator's job?
Thanks again and good luck to all that tried to help me and you who managed to helped me
- lhybrideur
- Posts: 454
- Joined: July 9th, 2019, 1:46 pm
Re: abilities, events, and other black magic
You can change the name of the post to add SOLVED by editing the first message.
-
- Posts: 26
- Joined: April 1st, 2024, 10:35 pm
Re: abilities, events, and other black magic
oh thanks, i will