Disable opponent weapon during fight
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.
Disable opponent weapon during fight
Hello. Is there a simple way to disable opponent weapon during fight when he is hit by special attack?
I have the following piece of code but it disables attacks only after a fight.
I have the following piece of code but it disables attacks only after a fight.
Code: Select all
#define WEAPON_SPECIAL_WG5_FREEZE
[damage]
id=wg5_freeze
name= _ "freeze"
description= _ ""
[/damage]
#enddef
#define WG5_FREEZE_EVENTS
[event]
name=attacker hits
first_time_only=no
[filter_attack]
special_id=wg5_freeze
[/filter_attack]
[filter_second]
[not]
[filter_wml]
[status]
unfreezeable=yes
[/status]
[/filter_wml]
[/not]
[/filter_second]
{VARIABLE second_unit.status.frozen yes}
[unstore_unit]
variable=second_unit
find_vacant=no
text=_ "frozen"
red,green,blue=0,0,255
[/unstore_unit]
[modify_unit]
[filter]
id=$second_unit.id
[/filter]
[object]
silent=yes
duration=turn
id=wg5_frozen_obj
take_only_once=no
[effect]
apply_to=halo
halo=halo/frozen/ice_block.png
[/effect]
[effect]
apply_to=attack
increase_attacks="-100%"
[set_specials]
mode=append
{WEAPON_SPECIAL_WG5_DISABLED}
[/set_specials]
[/effect]
[effect]
apply_to=max_attacks
increase="-100%"
[/effect]
[effect]
apply_to=movement
set="0"
[/effect]
[/object]
[/modify_unit]
[/event]
[event]
name=defender hits
first_time_only=no
[filter_second_attack]
special_id=wg5_freeze
[/filter_second_attack]
[filter]
[not]
[filter_wml]
[status]
unfreezeable=yes
[/status]
[/filter_wml]
[/not]
[/filter]
{VARIABLE unit.status.burning yes}
[unstore_unit]
variable=unit
find_vacant=no
text=_ "frozen"
red,green,blue=0,0,255
[/unstore_unit]
[modify_unit]
[filter]
id=$unit.id
[/filter]
[object]
silent=yes
duration=turn
id=wg5_frozen_obj
take_only_once=no
[effect]
apply_to=halo
halo=halo/frozen/ice_block.png
[/effect]
[effect]
apply_to=attack
increase_attacks="-100%"
[set_specials]
mode=append
{WEAPON_SPECIAL_WG5_DISABLED}
[/set_specials]
[/effect]
[effect]
apply_to=max_attacks
increase="-100%"
[/effect]
[effect]
apply_to=movement
set="0"
[/effect]
[/object]
[/modify_unit]
[/event]
[event]
name=side turn
id=wg5_stop_being_freezed_event
first_time_only=no
[filter]
status=frozen
[/filter]
{VARIABLE unit.status.frozen no}
[unstore_unit]
variable=unit
find_vacant=no
advance=no
[/unstore_unit]
[remove_object]
x,y=$unit.x,$unit.y
object_id=wg5_frozen_obj
[/remove_object]
[/event]
#enddef
-
- Posts: 1232
- Joined: August 26th, 2018, 11:46 pm
- Location: A country place, far outside the Wire
Re: Disable opponent weapon during fight
I don't know the answer to your question, but I did notice that when defender hits you set unit.status.burning, which looks odd.
Re: Disable opponent weapon during fight
Just before the attack. For example, in
After the attack, on
I think it's much simpler than what you're trying
pre attack
event:Code: Select all
[modify_unit]
[filter]
id=$unit.id
[/filter]
[object]
id=aww_disable_attacks
[effect]
apply_to=attack
set_attacks=0
[/effect]
[/object]
[/modify_unit]
attack end
event:Code: Select all
[remove_object]
id=$unit.id
object_id=aww_disable_attacks
[/remove_object]
Last edited by Toranks on June 30th, 2023, 9:27 pm, edited 1 time in total.
Re: Disable opponent weapon during fight
side_turn does not contain unit, so filter means it never activates.