Infinity loop during lvluping.
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.
- ChaosRider
- Posts: 1170
- Joined: April 15th, 2012, 1:15 pm
Infinity loop during lvluping.
Anyone know why game is doing infinity loop during lvluping unit with advance unit macro (for example advancing inferno drake to armageddon drake, same with lvluping lich to ancient lich)? Below code from my addon called "More units forms" (which was working fine on Wesnoth v1.10):
Spoiler:
Spoiler:
Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
Re: Infinity loop during lvluping.
Code: Select all
# Example to advance your leader normally:
#! {ADVANCE_UNIT canrecruit,side=yes,1 ""}
- ChaosRider
- Posts: 1170
- Joined: April 15th, 2012, 1:15 pm
Re: Infinity loop during lvluping.
Where in code Ive empty typeRavana wrote: ↑January 13th, 2025, 5:12 pmThat does not look correct. There is no reason why [modify_unit] should treat empty type as advancement.Code: Select all
# Example to advance your leader normally: #! {ADVANCE_UNIT canrecruit,side=yes,1 ""}

Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
- Atreides
- Posts: 1243
- Joined: March 30th, 2019, 10:38 pm
- Location: On the 2nd story of the centre village in Merwuerdigliebe turning the lights on and off
Re: Infinity loop during lvluping.
Not familiar with that macro but it's very likely the "" at the end is supposed to take a unit type as a parameter.ChaosRider wrote: ↑January 13th, 2025, 5:21 pmWhere in code Ive empty type :P?Ravana wrote: ↑January 13th, 2025, 5:12 pmThat does not look correct. There is no reason why [modify_unit] should treat empty type as advancement.Code: Select all
# Example to advance your leader normally: #! {ADVANCE_UNIT canrecruit,side=yes,1 ""}
- ChaosRider
- Posts: 1170
- Joined: April 15th, 2012, 1:15 pm
Re: Infinity loop during lvluping.
This code was taken from core macros in Wesnoth v1.18.3.
It looks wrong to me but its not why infinity loop happens after unit advance.
Code: Select all
Example to advance your leader normally:
#! {ADVANCE_UNIT canrecruit,side=yes,1 ""}
Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
Re: Infinity loop during lvluping.
I found that it is custom logic in modify_unit.lua, added to wiki.
- lhybrideur
- Posts: 454
- Joined: July 9th, 2019, 1:46 pm
Re: Infinity loop during lvluping.
On thing that happened in my add-on was that I was using a [modify_unit] in a pre_advance event. However, [modify_unit] is refreshing the unit, so was triggering a new pre_advance event thus looping.
You might have a similar problem.
Now I use [store_unit], manually modify, then [unstore_unit] to prevent that.
You might have a similar problem.
Now I use [store_unit], manually modify, then [unstore_unit] to prevent that.
- ChaosRider
- Posts: 1170
- Joined: April 15th, 2012, 1:15 pm
Re: Infinity loop during lvluping.
Once I reach 5000 different units in WOTG I will try rewrite code to use store unit and transform code.lhybrideur wrote: ↑January 14th, 2025, 12:47 pm On thing that happened in my add-on was that I was using a [modify_unit] in a pre_advance event. However, [modify_unit] is refreshing the unit, so was triggering a new pre_advance event thus looping.
You might have a similar problem.
Now I use [store_unit], manually modify, then [unstore_unit] to prevent that.
Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.