Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Having trouble with the game? Report issues and get help here. Read this first!

Moderator: Forum Moderators

Forum rules
Before reporting issues in this section, you must read the following topic:
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

tried to use [remove_object] in place of [remove_unit_overlay] as adviced here:
https://github.com/wesnoth/wesnoth/comm ... 5ad2a46271
and found that [remove_object] tag also resets some of unit's stats to its default values

steps to reproduce:
1. start new (multiplayer) game with "TEST" era from attached .zip file under BfW 1.18.6 or 1.16.11
(for obviousness also enable "Team color indicators" in "Display" section of wesnot's Preferences)
2. recruit any level 0 unit - it will get its zone of control enabled by "recruit" event included in "TEST" era
3. click on this level 0 unit - "select" event included in "TEST" era will run [remove_object] tag which will disable zone of control for level 0 unit (its team color oval indicator will get visible gaps in it)

for "Altera" (my add-on) it also causes first unit movement after side turn start to become permanent (cannot undo it, unlike subsequent movements) and caps unit's moves to its max_moves which breaks "sustained march" custom rule

does not reproduce under BfW 1.14.16 and BfW 1.12.6
(BfW 1.12.6 also shows error message stating that [remove_object] tag is not supported, BfW 1.14.16 did not show any error messages)

is it a known bug?
Attachments
build info.txt
(1.83 KiB) Downloaded 1 time
TEST.zip
(623 Bytes) Downloaded 2 times
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by Ravana »

That is working as intended.
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

in this case what is preferred way to change unit's ZoC and current moves (situationally making it higher than max_moves)?

Altera does both to facilitate two of its custom rules

also interfering with "undo" function is certainly *not* working as intended

latter can be reproduced by running Altera 0.9.1 under BfW 1.18.6 with all custom rules and per-side UI preferences enabled, did not find a way to reproduce it as part of test era
[remove_object] is used in only one place and replacing it with [remove_unit_overlay] makes first movement undo-able

also Altera removes objects (unrelated to unit overlays) from units since BfW 1.12.6, without using [remove_object] and without such side effects
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by Ravana »

When you ask to rebuild unit its clear that it loses all temporary changes. Either dont make temporary changes or apply them again after rebuild.

If your addon disables undo that is your own decision. If you test it without 1.19 it might not be from your addon though.
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

Ravana wrote: February 21st, 2026, 2:12 pm When you ask to rebuild unit its clear that it loses all temporary changes. Either dont make temporary changes or apply them again after rebuild.
IMO It should be mentioned in the wiki for [remove_unit_overlay]
added it:
https://wiki.wesnoth.org/InterfaceActio ... overlay.5D
Ravana wrote: February 21st, 2026, 2:12 pmIf your addon disables undo that is your own decision. If you test it without 1.19 it might not be from your addon though.
it does not disable it - that's the point
and this issue vanishes once [remove_object] is replaced with [remove_unit_overlay]
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by Ravana »

I dont get your point. If you use any event, no matter if with remove_unit_overlay or remove_object, it disables undo.
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

Ravana wrote: February 21st, 2026, 9:33 pm I dont get your point. If you use any event, no matter if with remove_unit_overlay or remove_object, it disables undo.
the point is: all my events (in "Altera") have [allow_undo] and it works as long as [remove_unit_overlay] is used to remove icons near units
if [remove_unit_overlay] is replaced with [remove_object] then first (and only first) move during each turn cannot be undone, subsequent moves can be undone as expected
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by Ravana »

Not sure why it happens, but it is not unexpected. Rebuilding unit is allowed to change gamestate, so undo should not be allowed.
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

Ravana wrote: February 22nd, 2026, 2:59 pm Not sure why it happens, but it is not unexpected. Rebuilding unit is allowed to change gamestate, so undo should not be allowed.
in this case why is it allowed for subsequent moves during each turn?

in "Altera" unit overlays mark whether each unit is in area affected by healing and/or leadership-like abilities - these overlays are updated (removed and re-added) on every single move
yet only first move on every turn is non-undoable if [remove_object] is used to remove unit overlays
this applies even if first and second moves during side turn are made with same unit - only second one (and subsequent ones) can be undone
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by Ravana »

Can you narrow it down to specific event we could test?
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

it reproduces since very first turn if playing with "Altera" era
"delay shroud updates" should be disabled in right-click menu since shroud updates often (legitimately) make moves non-undoable

going to try to debug further when I will have more time
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

Ravana wrote: February 22nd, 2026, 3:54 pm Can you narrow it down to specific event we could test?
apparently I mixed things up and [remove_object] has nothing to do with first move during every turn becoming non-undoable

the source of this bug is "Plan Unit Advance" modification bundled with Wesnoth, regardless of whether its "Force advancement planning" option is enabled or not
it reproduces even with "Default" era
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by Ravana »

I updated it so with 1.19 it wont prevent undo.
lea
Posts: 317
Joined: October 1st, 2016, 7:25 pm

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by lea »

Ravana wrote: February 24th, 2026, 9:14 am I updated it so with 1.19 it wont prevent undo.
will this fix be included in updates for 1.18?
author of: Altera (formerly "Altered Era/Ruleset"), latest version is on add-ons servers for BfW 1.18, 1.16 and 1.14, latest version also still supports BfW 1.12 and 1.10 but add-ons servers for these old versions of BfW are closed for uploads
User avatar
Ravana
Forum Moderator
Posts: 3417
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Bug Report: [remove_object] tag also resets ZoC and caps moves of affected units

Post by Ravana »

No.
Post Reply