How to create recall list?
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: 1168
- Joined: April 15th, 2012, 1:15 pm
How to create recall list?
Hey, Im working on new campaign and I don't know how to create recall list to have units from first scenario in next one. Anyone could write me here it? I tried my self but it didn't work.
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: How to create recall list?
https://wiki.wesnoth.org/DirectActionsW ... re_unit.5D lets you add units so you have something to recall in first scenario too.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
I've done code like this for the map end.
How it should looks like to recall units in next scenario?
Code: Select all
[event]
name=scenario_end
first_time_only=no
[store_unit]
[filter]
side=1
canrecruit=no
[/filter]
variable=first_side_recall_list
[/store_unit]
[store_unit]
[filter]
side=2
canrecruit=no
[/filter]
variable=second_side_recall_list
[/store_unit]
[store_unit]
[filter]
side=3
canrecruit=no
[/filter]
variable=third_side_recall_list
[/store_unit]
[/event]
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.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
Also what Ive seen with random leader at the beginning of the scenario 1 in next one is chosen other leader by random selection. How to do it to have the same leader?
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: How to create recall list?
Sounds like you changed your save_id.
Re: How to create recall list?
What do you mean? Could you be more specific?ChaosRider wrote: ↑December 12th, 2024, 5:52 pm Hey, Im working on new campaign and I don't know how to create recall list to have units from first scenario in next one. Anyone could write me here it? I tried my self but it didn't work.
You want to create a list with units that didn't exist previously? Or put different sides all together?
Also, 'scenario_end' is affected by some bug...
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
Is anyone could write me a code that will work for recalling unit? I dont know how to do it. Ive 3 human sides for which every side I need recall list. I guess this should be done in 2 events. First at the end of scenario to store units to recall list and second part of code to unstore units and delete them from recall list.
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: How to create recall list?
I'm sorry! I don't want to be those guys who just want to point out problems; I'm really having trouble trying to understand what you're saying.ChaosRider wrote: ↑December 13th, 2024, 8:43 am Is anyone could write me a code that will work for recalling unit? I dont know how to do it. Ive 3 human sides for which every side I need recall list. I guess this should be done in 2 events. First at the end of scenario to store units to recall list and second part of code to unstore units and delete them from recall list.
I think I got it now; you want to recall all the units in the battle itself?

You store the units on a 'victory' event (just to be safe). Just like you did, but on a 'victory' event.
Code: Select all
[event]
name=victory
#blah blah blah... store store store...
[endlevel]
#blah blah blah
[/endlevel]
[/event]
Code: Select all
[event]
name=prestart
{FOREACH first_side_recall_list i}
[recall]
id=$first_side_recall_list[$i].id
[/recall]
{NEXT i}
{CLEAR_VARIABLE first_side_recall_list}
{FOREACH second_side_recall_list i}
[recall]
id=$second_side_recall_list[$i].id
[/recall]
{NEXT i}
{CLEAR_VARIABLE second_side_recall_list}
{FOREACH third_side_recall_list i}
[recall]
id=$third_side_recall_list[$i].id
[/recall]
{NEXT i}
{CLEAR_VARIABLE third_side_recall_list}
[/event]
Now... if this is not what you meant... sorry!

You don't need to store units for them to remain in the recall list; if it's a side controlled by AI, you must make the side persistent - otherwise it'll just be erased at the end of the scenario.
- Spannerbag
- Posts: 759
- Joined: December 18th, 2016, 6:14 pm
- Location: Yes
Re: How to create recall list?
There are many ways to do this but this works for me on 1.18.
It allows creation of units in recall at any point in a scenario with nothing appearing on screen.
Example below creates recallable units on player turn 2.
(Yes I know my indentation's horrible, it's a test campaign.)
Turn 1 recall
Turn 2 recall
You can recall using [recall] or {RECALL_XY...} macro (need to scroll down a bit).
E.g.:
Removing units:
Note: for generic units (those for which you don't know their id) other identifiers will needed to be used and it is possible that you might end up deleting more units than the one intended without due care and attention. Specifying each unit's id is probably the simplest solution, if possible (depending on gameplay/scenario design).
Test code including above:
After all the above only the generic Mage remains in recall.
Edit: however if all you want to do is carry units between scenarios then [store_unit] (stores multiple units at once) and [unstore_unit] (unstores a single unit so need to loop through array if multiple units are to be unstored) are easier IMHO.
Hope this helps,
cheers!
-- Spannerbag
It allows creation of units in recall at any point in a scenario with nothing appearing on screen.
Example below creates recallable units on player turn 2.
(Yes I know my indentation's horrible, it's a test campaign.)

Code: Select all
[event]
name=side 1 turn 2
{DEBUG_MSG (_"About to create 3 units on recall")}
{GENERIC_UNIT 1 Mage recall recall}
{LOYAL_UNIT 1 (Elvish Druid) recall recall}
[unit]
name=_"Recallable Leader"
id=recallable_leader
side=1
type=Grand Marshal
x,y=recall,recall
[modifications]
{TRAIT_STRONG}
{TRAIT_FEARLESS}
[/modifications]
canrecruit=yes
[/unit]
[/event]
Turn 1 recall
Turn 2 recall
You can recall using [recall] or {RECALL_XY...} macro (need to scroll down a bit).
E.g.:
{RECALL_XY recallable_leader 4 4}
Removing units:
Code: Select all
[kill]
x,y=recall,recall
type=Elvish Druid
trait=loyal
[/kill]
Test code including above:
Code: Select all
[event]
name=side 1 turn 2
{DEBUG_MSG (_"About to create 3 units on recall")}
{GENERIC_UNIT 1 Mage recall recall}
{LOYAL_UNIT 1 (Elvish Druid) recall recall}
[unit]
name=_"Recallable Leader"
id=recallable_leader
side=1
type=Grand Marshal
x,y=recall,recall
[modifications]
{TRAIT_STRONG}
{TRAIT_FEARLESS}
[/modifications]
canrecruit=yes
[/unit]
{DEBUG_MSG (_"About to kill druid")}
[kill]
x,y=recall,recall
type=Elvish Druid
trait=loyal
[/kill]
{RECALL_XY recallable_leader 4 4}
[/event]
Edit: however if all you want to do is carry units between scenarios then [store_unit] (stores multiple units at once) and [unstore_unit] (unstores a single unit so need to loop through array if multiple units are to be unstored) are easier IMHO.
Hope this helps,
cheers!
-- Spannerbag
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
Your code doesnt work. I tested it and game see no units from previous scenario at the second scenario. Also as I said if in first scenario leaders are changing in second scenario. They are again picked randomly. How to make game choose leaders from previous scenario?Saizo-Luz wrote: ↑December 13th, 2024, 11:25 amI'm sorry! I don't want to be those guys who just want to point out problems; I'm really having trouble trying to understand what you're saying.ChaosRider wrote: ↑December 13th, 2024, 8:43 am Is anyone could write me a code that will work for recalling unit? I dont know how to do it. Ive 3 human sides for which every side I need recall list. I guess this should be done in 2 events. First at the end of scenario to store units to recall list and second part of code to unstore units and delete them from recall list.
I think I got it now; you want to recall all the units in the battle itself?![]()
You store the units on a 'victory' event (just to be safe). Just like you did, but on a 'victory' event.
Then do the rest on a 'prestart' event. You can use the foreach; it's deprecated but... I think it has on your version.Code: Select all
[event] name=victory #blah blah blah... store store store... [endlevel] #blah blah blah [/endlevel] [/event]
I've never done this before, but it should work. I believe the units will be recalled around the initial area of each side. (This was done in the campaign A Song of Fire, scenario 15, Farewell)Code: Select all
[event] name=prestart {FOREACH first_side_recall_list i} [recall] id=$first_side_recall_list[$i].id [/recall] {NEXT i} {CLEAR_VARIABLE first_side_recall_list} {FOREACH second_side_recall_list i} [recall] id=$second_side_recall_list[$i].id [/recall] {NEXT i} {CLEAR_VARIABLE second_side_recall_list} {FOREACH third_side_recall_list i} [recall] id=$third_side_recall_list[$i].id [/recall] {NEXT i} {CLEAR_VARIABLE third_side_recall_list} [/event]
Now... if this is not what you meant... sorry!![]()
You don't need to store units for them to remain in the recall list; if it's a side controlled by AI, you must make the side persistent - otherwise it'll just be erased at the end of the scenario.
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: How to create recall list?
Sorry!ChaosRider wrote: ↑December 13th, 2024, 12:21 pm Your code doesnt work. I tested it and game see no units from previous scenario at the second scenario. Also as I said if in first scenario leaders are changing in second scenario. They are again picked randomly. How to make game choose leaders from previous scenario?

Are any of these sides controlled by AI? The game only reconizes the leader id that is inside the [side] tag. I always had some problems with that; that's why I always use a dummy unit as a leader - I store it on a prestart event and unstore at the end, just to avoid any issues.
You want to recall the units in the battlefield all at once. This is really what you want to do, right?
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
Yes, I want to put inside recall list all side units to have them available in next scenario.
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.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
From your code only Grand Marshal show up in recall list. Other two units doesnt show up.Spannerbag wrote: ↑December 13th, 2024, 11:27 am There are many ways to do this but this works for me on 1.18.
It allows creation of units in recall at any point in a scenario with nothing appearing on screen.
Example below creates recallable units on player turn 2.
(Yes I know my indentation's horrible, it's a test campaign.)![]()
Code: Select all
[event] name=side 1 turn 2 {DEBUG_MSG (_"About to create 3 units on recall")} {GENERIC_UNIT 1 Mage recall recall} {LOYAL_UNIT 1 (Elvish Druid) recall recall} [unit] name=_"Recallable Leader" id=recallable_leader side=1 type=Grand Marshal x,y=recall,recall [modifications] {TRAIT_STRONG} {TRAIT_FEARLESS} [/modifications] canrecruit=yes [/unit] [/event]
Turn 1 recall
rt1.jpg
Turn 2 recall
rt2.jpg
You can recall using [recall] or {RECALL_XY...} macro (need to scroll down a bit).
E.g.:{RECALL_XY recallable_leader 4 4}
Removing units:Note: for generic units (those for which you don't know their id) other identifiers will needed to be used and it is possible that you might end up deleting more units than the one intended without due care and attention. Specifying each unit's id is probably the simplest solution, if possible (depending on gameplay/scenario design).Code: Select all
[kill] x,y=recall,recall type=Elvish Druid trait=loyal [/kill]
Test code including above:After all the above only the generic Mage remains in recall.Code: Select all
[event] name=side 1 turn 2 {DEBUG_MSG (_"About to create 3 units on recall")} {GENERIC_UNIT 1 Mage recall recall} {LOYAL_UNIT 1 (Elvish Druid) recall recall} [unit] name=_"Recallable Leader" id=recallable_leader side=1 type=Grand Marshal x,y=recall,recall [modifications] {TRAIT_STRONG} {TRAIT_FEARLESS} [/modifications] canrecruit=yes [/unit] {DEBUG_MSG (_"About to kill druid")} [kill] x,y=recall,recall type=Elvish Druid trait=loyal [/kill] {RECALL_XY recallable_leader 4 4} [/event]
Edit: however if all you want to do is carry units between scenarios then [store_unit] (stores multiple units at once) and [unstore_unit] (unstores a single unit so need to loop through array if multiple units are to be unstored) are easier IMHO.
Hope this helps,
cheers!
-- Spannerbag
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.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
I found the way to put inside recall list units but problem is that on recall list are new units, not the old one. Their modification, effects are gone. How to copy all modifications from old unit to new one?
Code: Select all
[event]
name=side 1 turn 2
first_time_only=no
[store_unit]
[filter]
side=1
canrecruit=no
[/filter]
variable=test_recall_list
kill=yes
[/store_unit]
{FOREACH test_recall_list i}
[unit]
id=$test_recall_list[$i].id
side=$test_recall_list[$i].side_number
type=$test_recall_list[$i].type
x,y=recall,recall
[/unit]
{NEXT i}
{CLEAR_VARIABLE test_recall_list}
[/event]
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.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: How to create recall list?
Ok, I found the way. The last thing that was require to make code works was unstore unit.
Code: Select all
[event]
name=side 1 turn 2
first_time_only=no
[store_unit]
[filter]
side=1
canrecruit=no
[/filter]
variable=test_recall_list
kill=yes
[/store_unit]
{FOREACH test_recall_list i}
{VARIABLE test_recall_list[$i].x recall}
{VARIABLE test_recall_list[$i].y recall}
[recall]
id=$test_recall_list[$i].id
[/recall]
[unstore_unit]
variable=test_recall_list[$i]
[/unstore_unit]
{NEXT i}
{CLEAR_VARIABLE test_recall_list}
[/event]
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.