The Wesnoth.org website and forums will be taken down for maintenance this September 28 at 8 am UTC for 1-8 hours.

You can find more information about affected services in the News post. ― Iris

Changing leader 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.
Post Reply
User avatar
Geos
Posts: 115
Joined: March 20th, 2008, 1:58 pm
Location: Italy

Changing leader type=

Post by Geos »

My main character has grown up in the campaign so much that it is aobut time to change the unit. Same character, but another unit (as if it had advance, just that it advances when I want it, not when reaching a certaing amount of XP).
So, the main character must begin the scenario being a new type of unit, and so I wrote type=NewType in the [side] tag.
But, when I start the scenario, the leader doesn't change his type.

How can I change the type of the leader unit?

Thank you.
That's ridiculous, dragons have no windows...
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: Changing leader type=

Post by AI »

The leader definition inside the [side] tag works like this:
-save_id is checked, if not present, description is used (the leader's name that is) instead.
-if there is such a side, the first unit with canrecruit=yes on the recall list is selected as your leader and the rest of the definition is completely ignored
-if there isn't, the leader is created according to your specifications

So, you can either use MODIFY_UNIT or you can bump up the experience so she levels normally.
User avatar
Geos
Posts: 115
Joined: March 20th, 2008, 1:58 pm
Location: Italy

Re: Changing leader type=

Post by Geos »

That sound good, just... couldn't find MODIFY_UNIT in the Reference WML. Is that a 1.5 feature? If it is available in 1.4, how does it work? Would I need to store/unstore unit to make it work?
That's ridiculous, dragons have no windows...
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: Changing leader type=

Post by AI »

It's a macro, it's in core/macros/utils.cfg

It works like this:
{MODIFY_UNIT FILTER VAR VALUE}
so:
{MODIFY_UNIT (canrecruit=yes) type (Battle Princess)}

or something.
User avatar
Geos
Posts: 115
Joined: March 20th, 2008, 1:58 pm
Location: Italy

Re: Changing leader type=

Post by Geos »

Good. Thank you!
That's ridiculous, dragons have no windows...
User avatar
Geos
Posts: 115
Joined: March 20th, 2008, 1:58 pm
Location: Italy

Re: Changing leader type=

Post by Geos »

Worked pretty good, except for something that could be a bug. For some reason, the alignment doesn't change even if it is different between both units
That's ridiculous, dragons have no windows...
AI
Developer
Posts: 2394
Joined: January 31st, 2008, 8:38 pm

Re: Changing leader type=

Post by AI »

Yes, there are problems with changing unit-type that way, sometimes animations are also mixed up.

So that leaves you with
-handing her 100000000000 XP so she levels ;)
-just removing the previous unit and throwing in a new one with the same name
Post Reply