how can I make names for a specific unit type?

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
melinath
Posts: 1298
Joined: May 20th, 2009, 7:42 am

Re: how can I make names for a specific unit type?

Post by melinath »

nobody5 wrote:Nay, it has to be Horseman, otherwise nothing happens, except when a Knight advances.
Are you sure? Cause I just tested, and

Code: Select all

	    [event]
        name=post_advance
        first_time_only=no
   
        [filter]
            type=Knight
        [/filter]
   
        {VARIABLE unit.name "Sir $unit.name"}
   
        [unstore_unit]
            variable=unit
            find_vacant=no
        [/unstore_unit]
    [/event]
seems to work perfectly.
Wiki wrote:post advance
Triggers just after the primary unit has advanced to another unit.
So doing it this way makes more sense... the type=Horseman has advanced and is a type=Knight, and only then does the event trigger. Also, as mentioned, it works. This is also handy, since you don't have to deal with Lancers.

Also, the advance bug makes sense, sort of. Unstore_unit has an advance key. It defaults to true and tries to advance the unit if it has enough xp. So if you unstore a unit that has full experience, Wesnoth tries to advance it. Then, oh look, a unit is advancing! Trigger the advance event, which unstores the unit and advances it, which triggers the advance event, which...
Oddly, setting advance=false crashes Wesnoth.
User avatar
nobody5
Posts: 32
Joined: June 17th, 2009, 8:06 am
Location: The Oblivion

Re: how can I make names for a specific unit type?

Post by nobody5 »

:lol2: What the heck was I doing all the time?! It works! But it seems to me that I could write that all the way in the beginning, and now I have the solution when I practically gave up! It's. So. SIMPLE!
Post Reply