set_accuracy and increase_accuracy inside an effect tag
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.
- Argesilao2
- Posts: 126
- Joined: February 18th, 2020, 9:28 pm
- Location: Piciule Patrie
set_accuracy and increase_accuracy inside an effect tag
I'm trying to create a unit with a ranged attack that blinds the opponent until their next turn, in Bfw 1.19.4.
this is the attack code:
this is the code of the WEAPON_SPECIAL_FLASH:
and then I insert these events in the [unit_type] tag
the problem is this one: using the set_accuracy command in the indicated line I get that the blinded unit's attack has a hit probability decreased by 10%.
Instead, if I replace the set_accuracy command with the increase_accuracy command, with the same value, I get that the hit probability for the blinded unit is 10%.
In short, the set_accuracy it does what increase_accuracy is supposed to do, and vice versa.
this is the attack code:
Code: Select all
[attack]
name=lightbeam
description=_"lightbeam"
type=arcane
range=ranged
[specials]
{WEAPON_SPECIAL_MAGICAL}
{WEAPON_SPECIAL_FLASH} #<----------------
[/specials]
damage=1
number=1
[/attack]
Code: Select all
#define WEAPON_SPECIAL_FLASH
[dummy]
id=flash
name=_"flash"
description=_"When hits this attack temporarily reduces at 10% the opponent's ability to hit an enemy."
special_note=_"This attack blind the enemy for a short time, significantly reducing its ability to hit the enemy and its vision range."
[/dummy]
#enddef
Code: Select all
[event]
name=attacker hits
first_time_only=no
[filter_attack]
special_id=flash
[/filter_attack]
[object]
[filter]
id=$second_unit.id
[/filter]
duration=turn
[effect]
apply_to=attack
range=melee,ranged
set_accuracy=-10 #<--------------- LOOK THIS
[/effect]
[effect]
apply_to=vision
set=1
[/effect]
[effect]
apply_to=status
add=blind
[/effect]
[effect]
apply_to=halo
halo="misc/blind-icon.png"
[/effect]
[/object]
[/event]
[event]
name=defender hits
first_time_only=no
[filter_second_attack]
special_id=flash
[/filter_second_attack]
[object]
[filter]
id=$unit.id
[/filter]
duration=turn
[effect]
apply_to=attack
range=melee,ranged
set_accuracy=-10 #<--------------- LOOK THIS
[/effect]
[effect]
apply_to=vision
set=1
[/effect]
[effect]
apply_to=status
add=blind
[/effect]
[effect]
apply_to=halo
halo="misc/blind-icon.png"
[/effect]
[/object]
[/event]
Instead, if I replace the set_accuracy command with the increase_accuracy command, with the same value, I get that the hit probability for the blinded unit is 10%.
In short, the set_accuracy it does what increase_accuracy is supposed to do, and vice versa.
Re: set_accuracy and increase_accuracy inside an effect tag
Assuming this attack did not have accuracy before, add and set have same result.
- Argesilao2
- Posts: 126
- Joined: February 18th, 2020, 9:28 pm
- Location: Piciule Patrie
Re: set_accuracy and increase_accuracy inside an effect tag
I did some testing, and here are the results:
set_accuracy and increase_accuracy works in the same way and makes the same thing;
both commands work like an increase_accuracy; Ravana is right, the vice versa at the end of my post was my fault.
increase_accuracy doesn't work if I assign a value in percentage terms (i.e. -10% instead of -10), but, curiously, set_accuracy works, always like increase_accuracy, even with percentage values.
That's all.
set_accuracy and increase_accuracy works in the same way and makes the same thing;
both commands work like an increase_accuracy; Ravana is right, the vice versa at the end of my post was my fault.

increase_accuracy doesn't work if I assign a value in percentage terms (i.e. -10% instead of -10), but, curiously, set_accuracy works, always like increase_accuracy, even with percentage values.

That's all.
Re: set_accuracy and increase_accuracy inside an effect tag
-10% of 0 is 0, so that is correct.
- Argesilao2
- Posts: 126
- Joined: February 18th, 2020, 9:28 pm
- Location: Piciule Patrie
Re: set_accuracy and increase_accuracy inside an effect tag
Ok.
I had misunderstood the use of accuracy.
Thank you.
I had misunderstood the use of accuracy.
Thank you.