Custom attack special doesn't do anything
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.
Custom attack special doesn't do anything
My attack special is supposed to increase damage by one for every adjacent unit with the same attack special. It doesn't seem to work, though. Any help is appreciated. This is my code:
Code: Select all
#define WEAPON_SPECIAL_STATE_ATTACK
[damage]
id=agk_state_attack
name= _ "State Attack"
description= _ ""
[/damage]
[damage]
add=1
cumulative=yes
affect_self=yes
[filter_adjacent]
[has_attack]
special=agk_state_attack
[/has_attack]
[/filter_adjacent]
[/damage]
#enddef
My campaigns: Princess Nilwyn (available) & Home of the Undead (available)
Re: Custom attack special doesn't do anything
Last I tried there was not nice way to do it. https://github.com/ProditorMagnus/Agele ... ouping.cfg
Re: Custom attack special doesn't do anything
you can count the mumber of adjacent unit with that weapon special with a formula
note that this counts within all units that have a distance of at most one to the unit, in particular the unit itself, also it doesnt make a differnt between allied and enemy units.
Code: Select all
[damage]
cumulative=yes
add = "(size(filter(filter(locations_in_radius(loc, 1), 'loc', unit_at(loc) != null()), 'loc', size(filter(unit_at(loc).attacks, 'att', size(filter(att.specials, 'sp', sp = 'agk_state_attack')) > 0 )) > 0)))"
[/damage]
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: 2207
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Custom attack special doesn't do anything
For some reason I just felt like reformatting your formula, because it's so long and confusing like that...gfgtdf wrote: ↑September 21st, 2018, 4:48 pm you can count the mumber of adjacent unit with that weapon special with a formulanote that this counts within all units that have a distance of at most one to the unit, in particular the unit itself, also it doesnt make a differnt between allied and enemy units.Code: Select all
[damage] cumulative=yes add = "(size(filter(filter(locations_in_radius(loc, 1), 'loc', unit_at(loc) != null()), 'loc', size(filter(unit_at(loc).attacks, 'att', size(filter(att.specials, 'sp', sp = 'agk_state_attack')) > 0 )) > 0)))" [/damage]
Code: Select all
[damage]
cumulative=yes
add = "(
def count_specials_by_id(unit*, id)
size(specials)
where specials = filter(attacks, size(
filter(specials, 'spec', spec = id)
) > 0);
def adjacent_occupied_locs(loc)
filter(
adjacent_locs(loc),
'loc',
unit_at(loc) != null()
);
size(matching_units)
where matching_units = filter(
adjacent_occupied_locs(loc),
'loc',
count_specials_by_id(unit_at(loc), 'agk_state_attack') > 0
# If you want allies only you can add an additional condition here, something like:
and not is_enemy(unit_at(loc).side, side)
#
)
)"
[/damage]