[put_to_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
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

[put_to_recall_list]

Post by Bitron »

In my campaign, there are different Leaders for the players team. Because of that I use the save_id to keep the recall list, BUT: if I use [put_to_recall_list] in a scenario, and change the leader in the next scenario, the units up put into the recall list with [put_to_recall_list] are gone.

Does the Tag only save the units to the standard save_id?
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [put_to_recall_list]

Post by gfgtdf »

hmm maybe you use save_id= wrong?
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
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

how could that be possible?

It's within the [side]-Tag, isn't it ?
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [put_to_recall_list]

Post by gfgtdf »

hmm yes it is. You need (should) use save_id=<id> in both scenarios. Also if one of the sides is controlled by an ai, you also have to use persitent=yes. In every scenario each save_id= may only be used once. Also note that the game will discard units in the recall list if their two of them have the same id=. Also make sure that no ther wml removes those units from the recall list.
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
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

All of it is as it should be in my WML-Code, but they disappeared anyway. I found another solution, but i will try it again however.
Instead of putting them to the recall list, i just hid them.
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

It was within the first Scenario. So, could it be possible that the recall-list gets created at the end of the first scenario ? Then it would be logical that the units were gone, because the list hasn't exist at this point.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [put_to_recall_list]

Post by gfgtdf »

Did hiding them work? (did they appear in the next scenario?)
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
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

I didnt put them onto the recall list with [put_to_recall_list] after hiding, but yes they are visible in the next scenario.
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [put_to_recall_list]

Post by gfgtdf »

hmm i have a new idea, the following could have happened:
After you put all the units to the recall list, the game noticed that the side had no units left on the map, so the side was marked as 'defeated' which usually implies that the side is removed from the carryover system.

You could try to put all units but the sides leader to the recall list with [put_to_recall_list] and see if the problems still occurs.
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
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

this sounds valid to me. I deleted the code but I think put the whole side to the recall list and recalled those i wanted to show up again.
Ill try that!
User avatar
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

Now.. I tried it this way:

Code: Select all

        [put_to_recall_list]
            side=1
            [not]
                id=Johan, Denvan, Ysedda, Lenvan
            [/not]
        [/put_to_recall_list]
Same problem, all units are gone in the next scenario.

EDIT: Johan is the Side 1 Leader
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [put_to_recall_list]

Post by gfgtdf »

Which wesnoth wesnoth do you use?
ok i looked at the definition of put_to_recall_list in wml-tags.lua:

Code: Select all



function wml_actions.put_to_recall_list(cfg)
	local units = wesnoth.get_units(cfg)

	for i, unit in ipairs(units) do	
		if cfg.heal then
			unit.hitpoints = unit.max_hitpoints
			unit.moves = unit.max_moves
			unit.attacks_left = unit.max_attacks
			unit.status.poisoned = false
			unit.status.slowed = false
		end
		wesnoth.put_recall_unit(unit, unit.side)
		wesnoth.erase_unit(unit)
	end
end
This code obviously puts teh units to the recall list with 'wesnoth.put_recall_unit' and removed it from teh recall list right after with 'wesnoth.erase_unit'.

you can fix this in your wml code by adding this

Code: Select all

[lua]
code = <<

function wesnoth.wml_actions.put_to_recall_list(cfg)
	local units = wesnoth.get_units(cfg)
	for i, unit in ipairs(units) do	
		if cfg.heal then
			unit.hitpoints = unit.max_hitpoints
			unit.moves = unit.max_moves
			unit.attacks_left = unit.max_attacks
			unit.status.poisoned = false
			unit.status.slowed = false
		end
		wesnoth.put_recall_unit(unit, unit.side)
	end
end
>>
[/lua]
inside your [scenario] that wants to use [put_to_recall_list].

Still i'd like to know which wesnoth version you use to know whoch vernoth versions are effected by this bug.
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
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

Uff, i have now clue about lua .. maybe i should take a look at it... seems pretty useful. ^^
Thanks for the code.

Im using the newest developement version: 1.13.2a
gfgtdf
Developer
Posts: 1432
Joined: February 10th, 2013, 2:25 pm

Re: [put_to_recall_list]

Post by gfgtdf »

y that code (the [lua] tag) can just be copied into the [scenario] as-is.

Hmm thats what i thought. mostlikeley this is a bug that doesn't effect 1.12.
(fixing this bug is mostlikeley easier than writing this answer, still this is no guarantee that it will be fixed in next wesnoth release.)

Please next time when reporting things like this, specify the wesnoth version right in the first post, becasue we by default assume that the current stable version (1.12) is used, and for 1.12 things like 'a bug in [put_to_recall_list]' are just quiet unlikeley, so its not the first thing we think of.

thx for reporting this anyway.
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
Bitron
Developer
Posts: 453
Joined: October 19th, 2015, 9:23 am
Location: Germany

Re: [put_to_recall_list]

Post by Bitron »

I'll keep that in mind!

and thanks again for helping me out with it, works fine now (:
Post Reply