Merging an ally's recall list into your own

The place to post your WML questions and answers.

Moderators: Forum Moderators, Developers

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.
Post Reply
User avatar
MathBrush
Posts: 105
Joined: February 12th, 2018, 10:21 pm

Merging an ally's recall list into your own

Post by MathBrush » February 14th, 2018, 3:32 pm

In my Dunefolk campaign I'm writing, you fight with an AI ally in Scenario 2. In Scenario 3, at the very beginning, this ally dies. I'd like to merge their recall list from Scenario 2 with the player's own.

How can I do this in WML?

User avatar
Ravana
Moderator
Posts: 1786
Joined: January 29th, 2012, 12:49 am
Location: Estonia

Re: Merging an ally's recall list into your own

Post by Ravana » February 14th, 2018, 3:46 pm

I expect changing side of those recallable units will do that.

User avatar
Sapient
Inactive Developer
Posts: 4435
Joined: November 26th, 2005, 7:41 am
Contact:

Re: Merging an ally's recall list into your own

Post by Sapient » February 14th, 2018, 4:25 pm

First a couple of questions:
- What version of Wesnoth are you using?
- Normally an AI side has no recall list. Did you already make the AI side have a recall list by using the MAKE_AI_SIDE_PERSISTENT and RECALL_AI_SIDE macros?
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."

gfgtdf
Developer
Posts: 1001
Joined: February 10th, 2013, 2:25 pm

Re: Merging an ally's recall list into your own

Post by gfgtdf » February 14th, 2018, 4:32 pm

you don't need MAKE_AI_SIDE_PERSISTENT or RECALL_AI_SIDE just use persistent=yes in your side definition. In 1.12 this works unless you are writing a multiplayer campaigns where carryover is borken for some if a side is skipped in a certain scenario does not appear in a certain scenario. (have a side with id=Ravana in scenario 1 and 3 but not in scenario 2 will erase the carryover data from that side in scenairo 2 in 1.12 in a multiplayer campaign. the mainline mp campaign LoW also suffers from this bug in 1.12 ). This bug was fixed in 1.13. though where it should also work in multiplayer campaigns.


ftr, RECALL_AI_SIDE was removed in 1.13
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
MathBrush
Posts: 105
Joined: February 12th, 2018, 10:21 pm

Re: Merging an ally's recall list into your own

Post by MathBrush » February 14th, 2018, 5:33 pm

Thanks for the help! I’m using 1.13.10. It sounds like hanging their sides right before the scenario is over would do it. How do I do that in wml? I searched but can’t find it.

gfgtdf
Developer
Posts: 1001
Joined: February 10th, 2013, 2:25 pm

Re: Merging an ally's recall list into your own

Post by gfgtdf » February 14th, 2018, 5:51 pm

a lua implementaion woudlo look like this:

Code: Select all

for i,u in ipairs(wesnoth.get_recall_units({ side = old_side})) do
  u:extract()
  u:to_recall(new_side)
end
the u:extract() might not be needed but i would not rely on that.
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.

User avatar
Celtic_Minstrel
Developer
Posts: 1146
Joined: August 3rd, 2012, 11:26 pm
Contact:

Re: Merging an ally's recall list into your own

Post by Celtic_Minstrel » February 18th, 2018, 5:08 pm

I distinctly recall that AI sides having recall lists worked even in 1.10, and if I recall correctly, I didn't even need the macro.

Anyway, in order to do this, I think the following WML should work:

Code: Select all

[modify_unit]
    [filter]
        side=2
    [/filter]
    side=1
[/modify_unit]
That should transfer side 2's recall list over to side 1. (According to StandardUnitFilter, unit filters prefer units on the map but also match them on the recall list.)
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.

Post Reply