[unit] multiple doesnt work

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
absinthia
Posts: 10
Joined: June 3rd, 2021, 7:03 am

[unit] multiple doesnt work

Post by absinthia »

im trying to place multiple Ghost1 and Shadow1 inside a event in the scenario.cfg , but it spawns just the first units of both and not the rest, what am i doing wrong?

Code: Select all

    [unit]
        side=3
        type=Ghost1
        x=3,9,12,11,15,15,20,24,11,22
        y=11,11,11,13,22,27,35,38,39,45
    [/unit]
    [unit]
        side=3
        type=Shadow1
        x,y=5,25 5,31 3,54
    [/unit]
 {NOTRAIT_UNIT 3 (Ghost1) 19 16}
 
ps: when i try this macro {NOTRAIT_UNIT 3 (Ghost1) 19 16} , i get a lua error and i tried to make a screenshot but on the shot the lua error doesnt show...
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: [unit] multiple doesnt work

Post by Lord-Knightmare »

absinthia wrote: June 6th, 2021, 10:53 am im trying to place multiple Ghost1 and Shadow1 inside a event in the scenario.cfg , but it spawns just the first units of both and not the rest, what am i doing wrong?

Code: Select all

    [unit]
        side=3
        type=Ghost1
        x=3,9,12,11,15,15,20,24,11,22
        y=11,11,11,13,22,27,35,38,39,45
    [/unit]
    [unit]
        side=3
        type=Shadow1
        x,y=5,25 5,31 3,54
    [/unit]
 {NOTRAIT_UNIT 3 (Ghost1) 19 16}
 
ps: when i try this macro {NOTRAIT_UNIT 3 (Ghost1) 19 16} , i get a lua error and i tried to make a screenshot but on the shot the lua error doesnt show...
Yeah, you cannot do that.

instead do:

Code: Select all

{GENERIC_UNIT 3 "Ghost" 3 9}
{GENERIC_UNIT 3 "Ghost" 3 9}
{GENERIC_UNIT 3 "Ghost" 3 9}
{GENERIC_UNIT 3 "Ghost" 3 9}
{GENERIC_UNIT 3 "Ghost" 3 9}
{GENERIC_UNIT 3 "Ghost" 3 9}
WML is not really a programming language, but if you want to place units in a list of co-ords, you might want to do Lua, or a pyscript to generate the WML.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

Re: [unit] multiple doesnt work

Post by vghetto »

You could use [store_locations] to set the x,y coords then loop over the location variable using [foreach] and call [unit] within that.
Hope that makes sense.
Post Reply