Summon unit on death
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.
Summon unit on death
Hello
I'm trying to make all units with a certain trait summon a specific unit when they die, like their soul is going out of their body to continue fighting. So it would be just like Plague but not depending on what weapon delivered the killing blow and with the summoned unit being on the same side than the killed unit
My main problem is that I can't find how to apply filters that recognize the dying unit. And it looks like you can't use events with traits and I'm unsure of how to proceed with a custom function. Yet I guess a code which would work for both traits and abilities would be more usefull to the community
Can you help me please
I'm trying to make all units with a certain trait summon a specific unit when they die, like their soul is going out of their body to continue fighting. So it would be just like Plague but not depending on what weapon delivered the killing blow and with the summoned unit being on the same side than the killed unit
My main problem is that I can't find how to apply filters that recognize the dying unit. And it looks like you can't use events with traits and I'm unsure of how to proceed with a custom function. Yet I guess a code which would work for both traits and abilities would be more usefull to the community
Can you help me please
Re: Summon unit on death
Similar to tentacle spawn https://github.com/ProditorMagnus/Agele ... _spawn.cfg and rat pack https://github.com/ProditorMagnus/Agele ... _spawn.cfg
Re: Summon unit on death
Ooooh thank you
I only have one more question: What happens with this code when an unit with this summon-on-death ability is killed by an unit with Plague? Which one takes precedence?
I only have one more question: What happens with this code when an unit with this summon-on-death ability is killed by an unit with Plague? Which one takes precedence?
Re: Summon unit on death
Should be event because of [kill].
Re: Summon unit on death
Oh, ok! I want Plague to take precedence. So I added a filter but... it doesn't work
What did I do wrong
Code: Select all
[filter_second]
[filter_weapon]
[not]
special_id_active=plague
[/not]
[/filter_weapon]
[/filter_second]
- Elvish_Hunter
- Posts: 1575
- Joined: September 4th, 2009, 2:39 pm
- Location: Lintanir Forest...
Re: Summon unit on death
[filter] (and [filter_second], for that matter) doesn't support [filter_weapon] inside itself; instead, it uses [has_attack]. Here's a list of what's allowed in unit filters: https://wiki.wesnoth.org/StandardUnitFilter.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Re: Summon unit on death
Thank you! So I changed the code
But with this filter on the unit I wanted to summon never shows up anymore, even when the enemy doesn't have plague! How?
Code: Select all
[filter_second]
[has_attack]
[not]
special_id_active=plague
[/not]
[/has_attack]
[/filter_second]
Re: Summon unit on death
special_id_active might not work as you expect. First get it working with special= instead.
Instead of filter_second->has_attack you can use [filter_second_weapon].
Instead of filter_second->has_attack you can use [filter_second_weapon].
Re: Summon unit on death
Thanks! So now the code is
But now, whether the enemy has plague or not, my unit just gets summoned anyway again (and same result if I still rather use special_id_active=plague)
What's wrong with this damn plague
Code: Select all
[filter_second_weapon]
[not]
special=plague
[/not]
[/filter_second_weapon]
What's wrong with this damn plague
Re: Summon unit on death
Actually filter_second_attack not filter_second_weapon.
Re: Summon unit on death
Oh, thank you it... WORKS! At last
But there's still a problem, right? I guess "special=plague" will prevent the summoning even if the dying unit is unplageable. So I added this:
...and I duplicated the event, in which I reversed this last filter and removed the other one. Should work right?
But there's still a problem, right? I guess "special=plague" will prevent the summoning even if the dying unit is unplageable. So I added this:
Code: Select all
[filter]
[not]
status=unplagueable
[/not]
[/filter]
Re: Summon unit on death
Yes it works! Thank you very much to you both