Turning multiple units into loyals

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
Headache
Posts: 40
Joined: December 30th, 2006, 7:04 pm
Location: Finland

Turning multiple units into loyals

Post by Headache »

I'm trying to turn multiple units into loyals with a macro but it gives some weird Game Load error.

Code: Select all

#define MAKE_LOYALS
    [store_unit]
        variable=loyaldudes
        [filter]
            [filter_wml]
                side=1
                #TODO exclude the leader
            [/filter_wml]
        [/filter]
    [/store_unit]

    {FOREACH loyaldudes dude}
    	[unit]
    		id=$loyaldudes[$dude].id
    		[modifications]
        		{TRAIT_LOYAL}
        	[/modifications]
    	[/unit]

    {NEXT dude}
    {CLEAR_VARIABLE loyaldudes}
#enddef
I'm using version 1.6
User avatar
Ken_Oh
Moderator Emeritus
Posts: 2178
Joined: February 6th, 2006, 4:03 am
Location: Baltimore, Maryland, USA

Re: Turning multiple units into loyals

Post by Ken_Oh »

[unit] doesn't go there. You need [object] and [effect].

Also, you don't need [filter_wml]. It will work, but the side key is part of http://www.wesnoth.org/wiki/StandardUnitFilter .
User avatar
Headache
Posts: 40
Joined: December 30th, 2006, 7:04 pm
Location: Finland

Re: Turning multiple units into loyals

Post by Headache »

Thanks alot! Now it works, but is it possible to disable the promt-screen that displays the name? It's rather frustrating when you have like 30 units. Leaving it blank doesn't work. It only opens a tiny blank window and at first I thought the game crashed.

Code: Select all

    {FOREACH loyaldudes dude}
    [object]
   			name= _ "$loyaldudes[$dude].name is now loyal"
            duration=forever
    	[filter]
    		id=$loyaldudes[$dude].id
    	[/filter]
    	[effect]
    		apply_to=loyal
    	[/effect]
	[/object]
    {NEXT dude}
I'm using version 1.6
User avatar
Mist
Inactive Developer
Posts: 753
Joined: February 15th, 2007, 8:44 am
Location: Milton Keynes, UK

Re: Turning multiple units into loyals

Post by Mist »

silent=yes inside [object]
Somewhere, between the sacred silence and sleep.
Disorder.
Post Reply