Trouble with storing units

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.
Post Reply
User avatar
Pewskeepski
Posts: 378
Joined: November 17th, 2010, 6:24 pm
Location: An icy dungeon beneath Antarctica

Trouble with storing units

Post by Pewskeepski »

So in my campaign, The Fall of Wesnoth, there's a part where the player's army is separated in two. The units you recruit in scenario 4 go with you to scenario 6 (scenario 5 is a talk scenario that doesn't feature the player's character), which you can't recruit in. The units that remain on your recall list in scenario 4 are suppose to stay there until scenario 8, where you can finally start recruiting/recalling again.

I figured out that you have to store the units/leader for them to stay intact through scenario 5, and I've done that. However, at the end of scenario 4, I have it label the units that aren't on your recall list with a variable so that they are the only ones in scenario 6. Also in scenario 4, I have it label the units that ARE on your recall list something else so they can be separated and obtained later.

The problem is this: I use the [store_unit] tag to label all units on side 1's recall list, but later in the campaign only ONE unit is actually in your recall list. It's like it only stores one unit that meets the filtered requirements, when it's suppose to store them all.

I hope someone can understand what I'm saying. This kind of thing use to work, but doesn't anymore. I don't know, maybe I messed something else up. Here's the code for the scenarios involved.

Scenario 4:
Spoiler:
Scenario 6:
Spoiler:
"Everything is better with penguins."
Creator of Burning Souls, The Fall of Wesnoth (abandoned) and Adventures of Knighthood (now available on BfW 1.15!)
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Trouble with storing units

Post by Dugi »

What is this supposed to mean? It unstores ONE unit.
[unstore_unit]
variable=units_on_recall_list
find_vacant=no
x,y=recall,recall
[/unstore_unit]
You have to unstore them all, like you did above, using a FOREACH cycle.

Code: Select all

{FOREACH units_on_recall_list i}
        [unstore_unit]
            variable=units_on_recall_list[$i]
        [/unstore_unit]
{NEXT i}
User avatar
Pewskeepski
Posts: 378
Joined: November 17th, 2010, 6:24 pm
Location: An icy dungeon beneath Antarctica

Re: Trouble with storing units

Post by Pewskeepski »

Oh wow, I literally would've tried that next. Guess I gave up to early. Anyway, thanks :P
"Everything is better with penguins."
Creator of Burning Souls, The Fall of Wesnoth (abandoned) and Adventures of Knighthood (now available on BfW 1.15!)
Post Reply