Is it possible to do this, and if so, how?

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
Huston
Posts: 1070
Joined: April 29th, 2009, 8:26 pm
Location: Somewhere in this World(I Think)

Is it possible to do this, and if so, how?

Post by Huston »

i was wondering if it is possible to place a unit on the map from the recall list without actually recalling them, or to recall them to a specific spot on the map? thanks in advance.
User avatar
mnewton1
Posts: 777
Joined: November 12th, 2008, 4:31 am
Location: On my pretty teal horsey.
Contact:

Re: Is it possible to do this, and if so, how?

Post by mnewton1 »

I am not sure about recalling a unit in specific place on the map. But the way you recall a unit so it starts next to your leader is you just put this in your scenario and modify the id.

Code: Select all

[event]
    name=prestart
    [recall]
        id=the units id I want to recall
    [/recall]
[/event]
Creator of Ageless Era
Check out Frogatto & Friends, it's made by the same people who created The Battle for Wesnoth!
Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: Is it possible to do this, and if so, how?

Post by Lord_Aether »

According to the wiki, you just give recall the x and y coordinates.

Code: Select all

[event]
    name=prestart
    [recall]
        id=the units id I want to recall
        x,y= coordinates to place the unit
    [/recall]
[/event]
Mac OS X 10.5.7
Wesnoth 1.6.2
User avatar
Huston
Posts: 1070
Joined: April 29th, 2009, 8:26 pm
Location: Somewhere in this World(I Think)

Re: Is it possible to do this, and if so, how?

Post by Huston »

yeah i know that but i need to get a unit from the recall list to be placed on the map during the prestart without using the recall tag because i do not have the leader starting on a keep.
Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: Is it possible to do this, and if so, how?

Post by Lord_Aether »

The recall tag will grab units from the recall list regardless of where the leader is...
Mac OS X 10.5.7
Wesnoth 1.6.2
User avatar
Huston
Posts: 1070
Joined: April 29th, 2009, 8:26 pm
Location: Somewhere in this World(I Think)

Re: Is it possible to do this, and if so, how?

Post by Huston »

oh. didn't realize that. thanks.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Is it possible to do this, and if so, how?

Post by Gambit »

Best solution, If I understand what you want correctly, is to store the unit in a variable and then unstore it next scenario.
User avatar
TofuOgre
Posts: 24
Joined: April 25th, 2009, 12:25 am

Re: Is it possible to do this, and if so, how?

Post by TofuOgre »

Gambit wrote:Best solution, If I understand what you want correctly, is to store the unit in a variable and then unstore it next scenario.
It unstores them where you stored them--unless you unstore them at the end of the scenario, so that recalling them drops them off like a normal recall.

If you want to unstore him in the middle of things--without him showing up on the recall unit list, then you do something else.

Using the teleport tag worked for me. Homeboy was embedded in rock at 2,2 and this got him to 42,2.

Scenario in the past--

Code: Select all

         [store_unit]
            variable=homz_store
            kill=yes
            [filter]
                id=Homz
            [/filter]
        [/store_unit]


Scenario where you want him--

Code: Select all

     [unstore_unit]
            variable=homz_store
        [/unstore_unit]
        {CLEAR_VARIABLE homz_store}
        [recall]
            id=Homz
        [/recall]
        [teleport]
            [filter]
                id=Homz
            [/filter]
            x=42
            y=2
        [/teleport]
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: Is it possible to do this, and if so, how?

Post by silene »

TofuOgre wrote:It unstores them where you stored them
Yes and no. It unstores them where the x and y fields of the variables tell it to unstore them. By default, x and y have the original values. But nothing prevents you to modify x and y before unstoring the variables. In fact, you don't even have to modify x and y, you can just pass the new values to [unstore_unit], they will overwrite the stored fields.
User avatar
Turuk
Sithslayer
Posts: 5283
Joined: February 28th, 2007, 8:58 pm
Contact:

Re: Is it possible to do this, and if so, how?

Post by Turuk »

TofuOgre wrote:Scenario in the past--

Code:

Scenario where you want him--
Do not use color to identify your code, just use the provided code tags. It is much easier for others to read your code this way.
Mainline Maintainer: AOI, DM, NR, TB and THoT.
UMC Maintainer: Forward They Cried, A Few Logs, A Few More Logs, Start of the War, and Battle Against Time
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Is it possible to do this, and if so, how?

Post by Gambit »

TofuOgre wrote: It unstores them where you stored them--unless you unstore them at the end of the scenario, so that recalling them drops them off like a normal recall.
Apologies. I assumed what Silene said went without saying.

[set_variable] is your friend 8)
User avatar
Huston
Posts: 1070
Joined: April 29th, 2009, 8:26 pm
Location: Somewhere in this World(I Think)

Re: Is it possible to do this, and if so, how?

Post by Huston »

Thanks everyone. i think i understand how both work now.
coded Rebellion During the Dark Age
Currently working on:
Era of the Future
Post Reply