Flood of [special_note] on units every turn
Moderator: Forum Moderators
Forum rules
Before reporting issues in this section, you must read the following topic:
Before reporting issues in this section, you must read the following topic:
Flood of [special_note] on units every turn
I have discovered a problem with Advance Wesnoth Wars that I can't understand how it is related, but after many tests I have discovered that it is a specific function of the addon.
What happens is that every turn, multiple lines are added to some specific unit movetypes. So far, that I have seen, undeadspirit and mounted. These lines continually grow to insane levels of thousands of lines per unit. I have not found any other relevant issues, the stats are correct, and there are no relevant effects on the gameplay, it is only seen in savegame files or using :inspect in debug mode.
Nothing that the addon does changes the movetype, nor adds these notes, it must be the game itself for some function. I have no idea which one. I have attached the complete code for the surprise ambushes function and some of the relevant macros.
MACROS (probably not relevant, but just in case)
I'm hoping someone can give me some clue where to look for what is causing this to occur.
Notes: Probably the unit being rebuilt over and over again during one turn? Maybe exit_hex and move_to? Because the other events are of only 1 time per turn.
Replay save in plain text (zipped so forum accept the file)
What happens is that every turn, multiple lines are added to some specific unit movetypes. So far, that I have seen, undeadspirit and mounted. These lines continually grow to insane levels of thousands of lines per unit. I have not found any other relevant issues, the stats are correct, and there are no relevant effects on the gameplay, it is only seen in savegame files or using :inspect in debug mode.
Code: Select all
[special_note]
note=_"Spirits have very unusual resistances to damage, and move quite slowly over open water."
[/special_note]
[special_note]
note=_"This unit has a defense cap on certain terrain types — it cannot achieve a higher defense rating on mixed terrains with such terrain types."
[/special_note]
Code: Select all
#textdomain aww
### 13. AMBUSHED UNITS DO ATTACK SURPRISES ; AFTER A NORMAL/SURPRISE THEN CANNOT SURPRISES NEXT TURN
# Author: Ruvaak, Toranks
# Partially based on Bobs_RPG_Era/files/ability_events.cfg
# see event name=movement end / {MODIFY_UNIT (id=Mal Keshar) attacks_left 1}
# will imply 1 unit variables : aww_ambush_cooldown_turn
## reset cooldown turn increment when we starts a new scenario of a campaign.s
# note : not filtered for recall list, so perfect :
[event]
name=start,aww_event_13_reset
id=aww_13_trigger_ambush_cooldown_reset
first_time_only=no
[filter_condition]
{AWW_ENABLED_FEATURE_13}
[/filter_condition]
[modify_unit]
[filter]
ability_type=hides
[/filter]
[variables]
aww_ambush_cooldown_turn=0
[/variables]
[/modify_unit]
[/event]
## un-surprises units on cooldown:
# new turn is here to manage daytime-related hides like nightstalk
[event]
name=new_turn,turn_refresh,side_turn_end
id=aww_13_trigger_ambush_cooldown_refresh_turn
first_time_only=no
[filter_condition]
{AWW_ENABLED_FEATURE_13}
[/filter_condition]
[store_unit]
variable=ambushers
[filter]
ability_type=hides
#ability_type_active=hides # TODO TEST
[/filter]
[/store_unit]
{FOREACH ambushers a}
[if]
{VARIABLE_CONDITIONAL ambushers[$a].variables.aww_ambush_cooldown_turn greater_than $turn_number}
[then]
{VARIABLE ambushers[$a].variables.preambush no}
[unstore_unit]
variable=ambushers[$a]
#text=_"Uncovered!"
[/unstore_unit]
#{AWW_TERRAIN_LABEL $ambushers[$a].y $ambushers[$a].y _"Uncovered " {COLOR_HEAL}}
[/then]
[elseif]
{VARIABLE_CONDITIONAL ambushers[$a].variables.aww_ambush_cooldown_turn less_than_equal_to $turn_number}
[then]
{VARIABLE ambushers[$a].variables.preambush yes}
[unstore_unit]
variable=ambushers[$a]
[/unstore_unit]
[/then]
[/elseif]
[elseif]
{AWW_NOT_ISSET_VARIABLE ambushers[$a].variables.aww_ambush_cooldown_turn}
[then]
{VARIABLE ambushers[$a].variables.preambush yes}
{VARIABLE ambushers[$a].variables.aww_ambush_cooldown_turn 0}
[unstore_unit]
variable=ambushers[$a]
[/unstore_unit]
[/then]
[/elseif]
[/if]
{NEXT a}
{CLEAR_VARIABLE ambushers}
[/event]
## un-surprises moving unit if still on cooldown (informative)
[event]
name=moveto
id=aww_13_trigger_ambush_cooldown_refresh_moveto
first_time_only=no
[filter_condition]
{AWW_ENABLED_FEATURE_13}
[/filter_condition]
[filter]
ability_type=hides
[/filter]
[if]
{VARIABLE_CONDITIONAL unit.variables.aww_ambush_cooldown_turn greater_than $turn_number}
[then]
{VARIABLE unit.variables.preambush no}
[unstore_unit]
variable=unit
#text=_"Uncovered M!"
[/unstore_unit]
#{AWW_TERRAIN_LABEL_CURRENT_SIDE_UNIT _"Uncovered M!" {COLOR_HEAL}}
[/then]
[/if]
[allow_undo]
[/allow_undo]
[/event]
## unsurprises + add cooldown for 2 turns to potential ambushers who attacks :
[event]
name=attack_end
id=aww_13_trigger_ambush_cooldown_refresh_attack
first_time_only=no
[filter_condition]
{AWW_ENABLED_FEATURE_13}
{VARIABLE_CONDITIONAL unit.hitpoints greater_than 0}
[/filter_condition]
[filter]
ability_type=hides
[/filter]
{VARIABLE unit.variables.preambush no}
{AWW_VARIABLE_VALUE_OP unit.variables.aww_ambush_cooldown_turn $turn_number add 2}
[unstore_unit]
variable=unit
#text=_"Uncovered A!"
[/unstore_unit]
#{AWW_TERRAIN_LABEL_CURRENT_SIDE_UNIT _"Uncovered A!" {COLOR_HEAL}}
[/event]
## manage if unit is hidden or not for the unit who start to moves
[event]
name=exit_hex
id=aww_13_trigger_ambush_startmove
first_time_only=no
[filter_condition]
{AWW_ENABLED_FEATURE_13}
[/filter_condition]
[store_unit]
variable=hidden_units
[filter]
[filter_vision]
visible=no
[/filter_vision]
[/filter]
[/store_unit]
[allow_undo]
[/allow_undo]
[/event]
## manage surprises attacks
[event]
name=moveto
id=aww_13_trigger_ambush_moveto
first_time_only=no
[filter_condition]
{AWW_ENABLED_FEATURE_13}
[/filter_condition]
[filter]
[filter_adjacent]
is_enemy=yes
ability_type_active=hides
find_in=hidden_units
[filter_wml]
[variables]
preambush=yes
[/variables]
[/filter_wml]
#ability=ambush,concealment,submerge,nightstalk,aww_ability_camouflage
#ability_type=hides
[/filter_adjacent]
[/filter]
# {AWW_FLOAT_TEXT_CURRENT_SIDE_UNIT "TEST OK!" {COLOR_HEAL}}
# {AWW_TERRAIN_LABEL_CURRENT_SIDE_UNIT "TEST OK!" {COLOR_HEAL}}
### getting victim terrain defense to reduce damages taken by surprise attack : (value will be between 20-80):
[store_unit_defense_on]
variable=def_ratio
loc_x,loc_y=$x1,$y1
[/store_unit_defense_on]
## it return like 30 for a terrain defense of 70%. We divide by 100 to get 0.3, and use this as damage ratio in harm_unit :
{VARIABLE_OP def_ratio divide 100}
# {AWW_TERRAIN_LABEL_CURRENT_SIDE_UNIT $def_ratio {COLOR_HEAL}}
{AWW_VARIABLE_VALUE_OP ambush_cooldown_turn $turn_number add 2}
### getting all ambushers ennemies :
[store_unit]
variable=ambushers
[filter]
ability_type_active=hides
find_in=hidden_units
[filter_wml]
[variables]
preambush=yes
[/variables]
[/filter_wml]
[filter_adjacent]
id=$unit.id
is_enemy=yes
[/filter_adjacent]
[/filter]
[/store_unit]
{FOREACH ambushers a}
[if]
{AWW_NOT_ISSET_VARIABLE ambushers[$a].variables.aww_ambush_cooldown_turn}
[or]
{VARIABLE_CONDITIONAL ambushers[$a].variables.aww_ambush_cooldown_turn less_than_equal_to $turn_number}
[/or]
[then]
## so it can do surprise attack :
# [if]
# {VARIABLE_CONDITIONAL ambushers[$a].status.uncovered equals yes}
# [then]
# {AWW_TERRAIN_LABEL $ambushers[$a].x $ambushers[$a].y "uncovered"+$ambushers[$a].variables.aww_ambush_cooldown_turn {COLOR_WHITE}}
# [/then]
# [else]
# {AWW_TERRAIN_LABEL $ambushers[$a].x $ambushers[$a].y "covered"+$ambushers[$a].variables.aww_ambush_cooldown_turn {COLOR_WHITE}}
# [/else]
# [/if]
### disable attack of ambushed victims :
[modify_unit]
[filter]
{AWW_EVENT_UNIT}
[/filter]
attacks_left=0
#moves=1
[/modify_unit]
## Most of the time weapon 2 is a faster / ranger weapon, so more coherent it's used for surprise attack :
[if]
{VARIABLE_CONDITIONAL ambushers[$a].attack[1].damage greater_than 0}
{VARIABLE_CONDITIONAL ambushers[$a].attack[1].number greater_than 0}
[then]
{VARIABLE ambusher_w_name $ambushers[$a].attack[1].name}
{VARIABLE ambusher_w_type $ambushers[$a].attack[1].type}
{VARIABLE ambusher_w_damage $ambushers[$a].attack[1].damage}
{VARIABLE ambusher_w_number $ambushers[$a].attack[1].number}
[/then]
[else]
{VARIABLE ambusher_w_name $ambushers[$a].attack[0].name}
{VARIABLE ambusher_w_type $ambushers[$a].attack[0].type}
{VARIABLE ambusher_w_damage $ambushers[$a].attack[0].damage}
{VARIABLE ambusher_w_number $ambushers[$a].attack[0].number}
[/else]
[/if]
[if]
{VARIABLE_CONDITIONAL ambusher_w_damage greater_than 0}
{VARIABLE_CONDITIONAL ambusher_w_number greater_than 0}
[then]
{AWW_VARIABLE_VALUE_OP ambush_damage $ambusher_w_damage multiply $ambusher_w_number}
## max damage : half of ambushed unit max_hp
{AWW_VARIABLE_VALUE_OP max_damage $unit.max_hitpoints divide 2}
[if]
{VARIABLE_CONDITIONAL ambush_damage greater_than $max_damage}
[or]
{VARIABLE_CONDITIONAL ambush_damage less_than 1}
[/or]
[then]
{VARIABLE ambush_damage $max_damage}
[/then]
[/if]
### surprise attack on ambushed victims :
[message]
speaker=$ambushers[$a].id
message=_"Surprise!"
side_for=$side_number,$ambushers[$a].side
[/message]
{AWW_VARIABLE_VALUE_OP ambush_damage $ambusher_w_damage multiply $ambusher_w_number}
[harm_unit]
[filter]
id=$unit.id
[/filter]
[filter_second]
id=$ambushers[$a].id
[/filter_second]
amount=$ambush_damage
damage_type=$ambusher_w_type
alignment=$ambushers[$a].alignment
fire_event=yes
animate=yes
[primary_attack]
name=$ambusher_w_name
[/primary_attack]
[secondary_attack]
name=$unit.attack[0].name
[/secondary_attack]
experience=yes
resistance_multiplier=$(1-$def_ratio)
[/harm_unit]
# {AWW_TERRAIN_LABEL $ambushers[$a].x $ambushers[$a].y $ambusher_w_name {COLOR_WHITE}}
[/then]
[/if]
# saving unit variable :
{VARIABLE ambushers[$a].variables.aww_ambush_cooldown_turn $ambush_cooldown_turn}
{VARIABLE ambushers[$a].variables.preambush no}
{VARIABLE ambushers[$a].status.uncovered yes}
[unstore_unit]
variable=ambushers[$a]
# {AWW_COLOR_YELLOW}
# text=_"Surprise Attack!"
[/unstore_unit]
[/then]
[/if]
{CLEAR_VARIABLE ambush_damage,max_damage,ambusher_w_damage,ambusher_w_number,ambusher_w_type,ambusher_w_name}
{NEXT a}
#{AWW_FLOAT_TEXT_CURRENT_SIDE_UNIT _"???" {AWW_COLOR_ORANGE}}
{CLEAR_VARIABLE ambushers,def_ratio,ambush_cooldown_turn,hidden_units}
[/event]
Code: Select all
#define AWW_NOT_ISSET_VARIABLE VAR
[variable]
name={VAR}
equals=$aww_empty_var
[/variable]
#enddef
#define AWW_VARIABLE_VALUE_OP VAR VALUE OP_NAME OP_VALUE
# like a {VARIABLE {VAR} VALUE}} + {VARIABLE_OP {VAR} {OP_NAME} {OP_VALUE}}
[set_variable]
name={VAR}
value={VALUE}
{OP_NAME}={OP_VALUE}
[/set_variable]
#enddef
AWW_ENABLED_FEATURE_13
#define AWW_ENABLED_FEATURE_13
{VARIABLE_CONDITIONAL aww_13_enable_ambushed_fix equals yes}
#enddef
Notes: Probably the unit being rebuilt over and over again during one turn? Maybe exit_hex and move_to? Because the other events are of only 1 time per turn.
Replay save in plain text (zipped so forum accept the file)
Re: Flood of [special_note] on units every turn
Are you sure it is related to your addon? It seems to happen even with no addons installed.
- Attachments
-
- TRoW-A Harrowing Escape-Auto-Save1.gz
- Example: look for "Vinogyc" the horseman
- (29.93 KiB) Downloaded 34 times
Re: Flood of [special_note] on units every turn
Two times repeated (as in your savegame) happens without addons, but I've talking about 1000 or more lines repeated
Re: Flood of [special_note] on units every turn
Thanks for reporting. It's a bug in
[unstore_unit]
, now logged as #7153.