Weapon filter not working
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.
Re: Weapon filter not working
It works. Is there a clean way to make the unit reduce 5% to hit for each adjacent friendly unit? For instance, if there are 3 adjacent friendly units, it reduces 15% to hit in total
Re: Weapon filter not working
I think you can you need to use a formula in sub that counts the number of adjacent friendly units, but im not sure of whihc unit it will count hte adjacent units.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- Celtic_Minstrel
- Developer
- Posts: 2226
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Weapon filter not working
This sounds like a bug… shouldn't special_active return true if the attack has a special that's active? Where "active" means that it will take effect if the weapon were to be used right now… so, for example, you should be able to use it to test whether a rogue is in a valid position for backstabbing.
Well, obviously this bug really needs fixing…gfgtdf wrote: ↑April 4th, 2020, 7:33 pm In fact [has_attack] has to be used over [filter_attack] in events that handle wepopn specials, see https://github.com/wesnoth/wesnoth/issues/3317 (this is iirc because [filter_attack] is evalated on a _copy_ of the attack object that was used in combat that has the attack context not set correctly.)
WFL uses a function to get adjacent locations, so it would use whatever unit (or location) you tell it to.
Re: Weapon filter not working
Hmm, hard to say i guess at least for weapon specials that don't depend on the attack context that would make sense, but if we change that please only do it on 1.15 since 1.14 addons depend on the current behaviour, and not without fixing the other bug before since the dependence on this behviour is a workaround for the other bug.Celtic_Minstrel wrote: ↑April 6th, 2020, 1:22 pm
This sounds like a bug… shouldn't special_active return true if the attack has a special that's active? Where "active" means that it will take effect if the weapon were to be used right now… so, for example, you should be able to use it to test whether a rogue is in a valid position for backstabbing.
yes
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- lhybrideur
- Posts: 369
- Joined: July 9th, 2019, 1:46 pm
Re: Weapon filter not working
Maybe you could store adjacent units (case 1) or adjacent ally units (case 2) in a variable, then do a foreach over the variable and add one for each ally (case 1) or for each unit (case 2).
But there might be a lighter solution
-
- Code Contributor
- Posts: 172
- Joined: October 6th, 2017, 12:57 pm
Re: Weapon filter not working
Code: Select all
[chance_to_hit]
id=dformation1
name= _ ""
description= _ "makes 5% harder to hit when next to a friend"
sub=5
apply_to=opponent
[filter_self]
[filter_adjacent]
is_enemy=no
count=1-5
[/filter_adjacent]
[/filter_self]
[/chance_to_hit]
[chance_to_hit]
id=dformation2
sub=5
apply_to=opponent
[filter_self]
[filter_adjacent]
is_enemy=no
count=2-5
[/filter_adjacent]
[/filter_self]
[/chance_to_hit]
[chance_to_hit]
id=dformation3
sub=5
apply_to=opponent
[filter_self]
[filter_adjacent]
is_enemy=no
count=3-5
[/filter_adjacent]
[/filter_self]
[/chance_to_hit]
[chance_to_hit]
id=dformation4
sub=5
apply_to=opponent
[filter_self]
[filter_adjacent]
is_enemy=no
count=4-5
[/filter_adjacent]
[/filter_self]
[/chance_to_hit]
[chance_to_hit]
id=dformation5
sub=5
apply_to=opponent
[filter_self]
[filter_adjacent]
is_enemy=no
count=5
[/filter_adjacent]
[/filter_self]
[/chance_to_hit]