How to create recall list?

The place to post your WML questions and answers.

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.
User avatar
Spannerbag
Posts: 759
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: How to create recall list?

Post by Spannerbag »

ChaosRider wrote: December 13th, 2024, 3:17 pm
Spannerbag wrote: December 13th, 2024, 11:27 am There are many ways to do this but this works for me on 1.18...
From your code only Grand Marshal show up in recall list. Other two units doesnt show up.
??? :? Just copied the first code example from my post and it worked for me same as before. :? ???

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]
My guess, FWIW, is that if the Grand Marshal appears but the other's don't then the [unit] version works, but using standard macros fails for some reason.

The store/unstore method uses the variable test_recall_list as a container rather than the recall list, but if it works for you then OK. :)

Since I can't replicate your experience then if you still want to get the recall logic working all I can suggest is:
  1. Check the logfile, there may be a hint in there.
  2. Replace the macros with [unit] and see if that works (then the issue is something to do with macros I guess).
  3. Create a test scenario that does nothing except create recall units and see what works and what doesn't.
Might help to know what version of Wesnoth are you using and what's your platform (*nix, Windows, etc.)?

Edit:
ChaosRider wrote: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?
I assumed that the leaders were all on the same side, were player controlled and didn't have [filter_recall]s.
It may be that you need to check out side persistent and save_id.
If all you want to do is carry over a recall list between leaders and/or scenarios then the store/unstore is probably easier to get working.

Does the recall logic work within the first scenario? If so then the recalls are being lost when the new scenario starts.
Best way to carry over leaders (assuming nothing unusual) would be to simply declare the same leader(s) in subsequent scenarios (recall should work then too with luck). You can store leaders too provided at least one remains on map at scenario end* (the one you declare in your side would be best I guess).
* Or change your side's defeat_condition to never.
Good luck!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.18, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
octalot
General Code Maintainer
Posts: 818
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: How to create recall list?

Post by octalot »

If you use [side]save_id=some_name_1, [side]save_id=some_name_2, etc then the engine should carry over both the recall list and the recruit list for you, automatically storing all units from the map onto the appropriate side's recall list.

[unit]id= will automatically recall instead of creating a new unit if a unit with the same id is on the engine's list for that side, although it won't look in other variables. I don't know if it'll look in other sides' recall lists, but IIRC it does; I've a vague memory of an unexpected result involving that, when using debug to skip back to a scenario after a unit changed sides.
Post Reply