the KNOCKBACK ability
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: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: the KNOCKBACK ability
Yes, of course. So @Dixie, use [/specials] and [/attack] instead of [/abilities] and [+attack] and [+specials] instead of [+abilities].
@zookeeper:
It will work for weapon specials.(I even tested it (not this specials itself) with the new version) Why shouldn't it?
@zookeeper:
It will work for weapon specials.(I even tested it (not this specials itself) with the new version) Why shouldn't it?
Last edited by fog_of_gold on April 9th, 2010, 9:39 pm, edited 1 time in total.
Re: the KNOCKBACK ability
Well I'll try it out. There are three things I still don't understand about it though:
1) You suggest two tags. Should I put both? Or just the [+special] one? Or what?
2) I suppose it is intentionnal, but what is the logic of putting the [/special] (or attack or ability, whichever) before the [+special]? Shouldn't the slash ("/") tag be used for closing, thus coming after the plus ("+") tag?
3) Why would I in particular need those tags? I've never any specials using those, be it in mainline or other user-made eras. If it makes it work though, why not? But I just don't get it.
1) You suggest two tags. Should I put both? Or just the [+special] one? Or what?
2) I suppose it is intentionnal, but what is the logic of putting the [/special] (or attack or ability, whichever) before the [+special]? Shouldn't the slash ("/") tag be used for closing, thus coming after the plus ("+") tag?
3) Why would I in particular need those tags? I've never any specials using those, be it in mainline or other user-made eras. If it makes it work though, why not? But I just don't get it.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: the KNOCKBACK ability
That aren't really tags. You need both:Dixie wrote:[...]1) You suggest two tags. Should I put both? Or just the [+special] one? Or what?
Spoiler:
Like I said above, it isn't really a tag, I just called it tag. With [+xx], you can add something to last tag of this type. The code, if you add the pieces of macros and files together, may look like following for the [unit_type] tag:2) I suppose it is intentionnal, but what is the logic of putting the [/special] (or attack or ability, whichever) before the [+special]? Shouldn't the slash ("/") tag be used for closing, thus coming after the plus ("+") tag?
Spoiler:
Spoiler:
I hope you understand now. If not, feel free to ask. Also, look in the mainline ability "feeding". This ability have got this method, too.
Unfortunatly, the game will only notice the events in [scenario], [unit_type] and maybe some less others. Any event tag in another tag will be ignored, even if this tag is also in one of the tags above.3) Why would I in particular need those tags? I've never any specials using those, be it in mainline or other user-made eras. If it makes it work though, why not? But I just don't get it.
Like above, I hope you understand. If not, feel free to ask.
Re: the KNOCKBACK ability
Ok, I get that about event tag working only in specific places, and bout the "+" "tags" not really being tags.
I wonder though. In your last post, in the "spoilers", you just did the opposite of what you said just above.
First Spoiler:
Also, I notice the feeding ability seems to put the "+" tag before the "/", unless I'm mistaken? See:
And jsut to make sure, you are telling me to include these "tags" in the ability.cfg file, not in every unit file, right? So I can link it like any other weapon special macro afterwards?
Anyway, I'll try it out and tell you how it goes. Thanks a lot!
I wonder though. In your last post, in the "spoilers", you just did the opposite of what you said just above.
First Spoiler:
Second and Third spoiler:[/specials]
[/attack]
[...]
[+attack]
[+specials]
Was that an error?[+attack]
[+specials]
{WEAPON_SPECIAL_POISON}
[/specials]
[/attack]
Also, I notice the feeding ability seems to put the "+" tag before the "/", unless I'm mistaken? See:
Spoiler:
Anyway, I'll try it out and tell you how it goes. Thanks a lot!

Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: the KNOCKBACK ability
The ability macro looks in this way, not in the way you thought:Dixie wrote: [...]Was that an error?
Spoiler:
Spoiler:
The [abilities] tag is still within a comment. The same thing with [/abilities]. So ignore these two commands. If I remove every comment, it would look this way:Also, I notice the feeding ability seems to put the "+" tag before the "/", unless I'm mistaken? See:
Spoiler:
Spoiler:
Yes you can, just like it's a usually weapon special. Just make sure, that you can't use them in any [effect] (a way to include abilities and weapon specials manually within [event] or [advancement]), just in the [units]-[unit_type]-[abilities] tag.And jsut to make sure, you are telling me to include these "tags" in the ability.cfg file, not in every unit file, right? So I can link it like any other weapon special macro afterwards?
[edited to correct some mistakes]
Re: the KNOCKBACK ability
Victory! The knockback ability now works! This was merely a WML battle, not the war, though, as I've got some more issues to fix. Let's just adress the first (and probably simplest) one in this post. I'll work on the second afterwards.
Here goes: Knockback works... but only on offense, as the original description said. There is no "active_on=" line anywhere, though. I tried adding such a line and leaving the space after the "=" blank, as to imply it's active both on offense and defense (which is what I actually want). That's what the wiki says at least. I placed it just under the [event] tag, along with the "first_time_only=no" line, which seemed like a suitable place to me, since the wiki doesn't precise where it should go. Well, anyway, it still just works on defense. Did I forget something? Is there a line or command the wiki omits that I should be aware of? Are my ambitions impossible?
Here's the code:
Thanks a lot, people! 
Here goes: Knockback works... but only on offense, as the original description said. There is no "active_on=" line anywhere, though. I tried adding such a line and leaving the space after the "=" blank, as to imply it's active both on offense and defense (which is what I actually want). That's what the wiki says at least. I placed it just under the [event] tag, along with the "first_time_only=no" line, which seemed like a suitable place to me, since the wiki doesn't precise where it should go. Well, anyway, it still just works on defense. Did I forget something? Is there a line or command the wiki omits that I should be aware of? Are my ambitions impossible?
Here's the code:
Spoiler:

Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth
-
- Posts: 637
- Joined: December 20th, 2009, 5:59 pm
- Location: Germany
Re: the KNOCKBACK ability
Well, unfortunatly, it isn't that much easy. If you take a look at EventWML, you'll see, that it'll only be fired, if the unit hits is the attacker. As far as I know, just adding 'defender hits' with a comma after the 'name' key should make it work. If not we'll have to copy the whole event code and change attacker hits to defender hits. Hopefully we haven't to. So to make the code work in the way you want to have it, change the part of the code into this:
I just looked at your 'retreat' specials, and at least one problem was, that you was filtering a location being always blocked by the enemy. This should work (removed every minus from the directions, added our method and added defender hits):
[edited because I forgot to add [/xx] [+xx]]
Code: Select all
[...]
[event]
name=attacker hits,defender hits
first_time_only=no
[...]
Spoiler:
Re: the KNOCKBACK ability
Hm. You have managed to fix my retreat ability (which was my second issue). However the "name=attacker hits,defender hits" thing doesn't work. The game misinterpretsthe code. Here is what it does:
Say U1 has knockback and attacks U2.
U1 (the attacker) hits = U2 is knocked back. OR U2 (the defender) hits U1 in retaliation, but U2 is still knocked back.
If U2 attacks U1 afterwards, the knockback ability is totally void.
So I don't really know what to do. If I had the choice between either jsut offense or jsut defense, I would pick defense. Would a line saying "active_on=defense" work? What else would you suggest?
I'll continue looking at the event wiki page, just in case.
Thanks again for your concern
EDIT:
Could it be possible to do it using an additionnal macro or something using the [filter_second_attack] filter tag, and then inversing the code in the [event] tag or something to make it work on defense? Where would I put such a command? In every [era] tag of my IME_eras.cfg?
Say U1 has knockback and attacks U2.
U1 (the attacker) hits = U2 is knocked back. OR U2 (the defender) hits U1 in retaliation, but U2 is still knocked back.
If U2 attacks U1 afterwards, the knockback ability is totally void.
So I don't really know what to do. If I had the choice between either jsut offense or jsut defense, I would pick defense. Would a line saying "active_on=defense" work? What else would you suggest?
I'll continue looking at the event wiki page, just in case.
Thanks again for your concern

EDIT:
Could it be possible to do it using an additionnal macro or something using the [filter_second_attack] filter tag, and then inversing the code in the [event] tag or something to make it work on defense? Where would I put such a command? In every [era] tag of my IME_eras.cfg?
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth
Re: the KNOCKBACK ability
Double post, sorry to all purists out there. The situation has evolved though, so I figured a double-post was needed.
I must declare... this is a success! I managed to have it work on defense! Yay!
Here is the code to knockback:
Here is the code to retreat:
There still are some issues, though. Here are my observations:
- Retreat on defense gives exp to both units.
- Retreat on defense makes you abandon a village.
- Retreat on defense doesn,t work if the attacker (the not-retreating unit) is on a village!
- Retreat on offense doesn't give exp to retreating unit.
- Retreat on offense makes you abandon a village.
- Retreat on offense doesn't work if the defender (the not-retreating unit) is on a village!
- Knockback on defense gives exp to both units.
- However, knockback on defense gives its own level in exp to the knockbacked unit (if it is knockbacked)
(ex: U1 has knockback and is lv1, and is attacked by U2, which is lv2. If U2 is knockbacked, it will earn 2 exps, instead of the 1 exp it should)!
- Knockback on defense doesn't make you leave a village.
- Knockback on offense gives exp to both units.
- Knockback on offense doesn't make you leave a village.
As of now, I can't seem to think straight anymore. I don't really understand how the experience-giving part of the code works, I'd have to look at it longer. Also, I can't find the line about not knocking back out of a village, so I can't reverse it to make retreat work properly.
Anyway, I'll inspect it some more tomorrow, thanks for any help. This is getting real close to being a complete success!
Edit:
I managed to have it work properly! Everything looks fine, and I've edited the above code to put the correct one in. Feel free to test it and report any bugs if you wish, but it should be ok now.
Thanks to all of you for your support!
I must declare... this is a success! I managed to have it work on defense! Yay!





Spoiler:

Spoiler:
- Retreat on defense gives exp to both units.
- Retreat on defense makes you abandon a village.
- Retreat on defense doesn,t work if the attacker (the not-retreating unit) is on a village!
- Retreat on offense doesn't give exp to retreating unit.
- Retreat on offense makes you abandon a village.
- Retreat on offense doesn't work if the defender (the not-retreating unit) is on a village!
- Knockback on defense gives exp to both units.
- However, knockback on defense gives its own level in exp to the knockbacked unit (if it is knockbacked)
(ex: U1 has knockback and is lv1, and is attacked by U2, which is lv2. If U2 is knockbacked, it will earn 2 exps, instead of the 1 exp it should)!
- Knockback on defense doesn't make you leave a village.
- Knockback on offense gives exp to both units.
- Knockback on offense doesn't make you leave a village.
As of now, I can't seem to think straight anymore. I don't really understand how the experience-giving part of the code works, I'd have to look at it longer. Also, I can't find the line about not knocking back out of a village, so I can't reverse it to make retreat work properly.
Anyway, I'll inspect it some more tomorrow, thanks for any help. This is getting real close to being a complete success!
Edit:
I managed to have it work properly! Everything looks fine, and I've edited the above code to put the correct one in. Feel free to test it and report any bugs if you wish, but it should be ok now.

Thanks to all of you for your support!
Last edited by Dixie on June 11th, 2010, 4:27 pm, edited 1 time in total.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth
Re: the KNOCKBACK ability
Well people, seems I'm pseudo thread-necroing some more, but...
Well, knockback worked perfectly fine a few weeks ago. I had tested it in every conceivable way. And now, this morning, it doesn't work on attack anymore. It works on defense, though, and retreat works top-notch! I've tried different previous supposedly working versions of knockback, I've tried various units, maps, terrains... But to no avail. I've proof-read the code over and over, and couldn't figure what the problem was. I even rebooted my laptop, rebooted the wesnoth app several times... I just don't get it. This is so god damn frustrating!
Anyway, would anybody have an explanation? Or at least try the above code and tell me if it's working for them?
Thanks, people.
Well, knockback worked perfectly fine a few weeks ago. I had tested it in every conceivable way. And now, this morning, it doesn't work on attack anymore. It works on defense, though, and retreat works top-notch! I've tried different previous supposedly working versions of knockback, I've tried various units, maps, terrains... But to no avail. I've proof-read the code over and over, and couldn't figure what the problem was. I even rebooted my laptop, rebooted the wesnoth app several times... I just don't get it. This is so god damn frustrating!
Anyway, would anybody have an explanation? Or at least try the above code and tell me if it's working for them?
Thanks, people.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth
Re: the KNOCKBACK ability
Well, the fact that the following doesn't make any sense at all could be one:Dixie wrote:Well people, seems I'm pseudo thread-necroing some more, but...
Well, knockback worked perfectly fine a few weeks ago. I had tested it in every conceivable way. And now, this morning, it doesn't work on attack anymore. It works on defense, though, and retreat works top-notch! I've tried different previous supposedly working versions of knockback, I've tried various units, maps, terrains... But to no avail. I've proof-read the code over and over, and couldn't figure what the problem was. I even rebooted my laptop, rebooted the wesnoth app several times... I just don't get it. This is so god damn frustrating!
Anyway, would anybody have an explanation?
Code: Select all
[filter_second]
[not]
[filter_second_location]
terrain=*^V*
[/filter_second_location]
[/not]
[/filter_second]
Other than that, you could just find out what it is which isn't working right.
Re: the KNOCKBACK ability
Oh god, I feel so dumb right now, it looks so obvious now *face palm*.
Still I could have sworn it used to work in every conceivable way a few weeks ago, and that it contained that code. How could I possibly have missed such an obvious bug in my tests? Anyway, it's fixed now... Thank you dearly, zookeeper, your WML wisdom is always most appreciated.
Anyway, I've corrected it in the above code, so fear not using it if you need to.
Still I could have sworn it used to work in every conceivable way a few weeks ago, and that it contained that code. How could I possibly have missed such an obvious bug in my tests? Anyway, it's fixed now... Thank you dearly, zookeeper, your WML wisdom is always most appreciated.

Anyway, I've corrected it in the above code, so fear not using it if you need to.
Jazz is not dead, it just smells funny - Frank Zappa
Current projects: Internet meme Era, The Settlers of Wesnoth
Current projects: Internet meme Era, The Settlers of Wesnoth