Storing unit and changing side removes hero ellipse (1.14)

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
Wonderboy
Posts: 55
Joined: July 4th, 2006, 6:53 am
Location: Finland

Storing unit and changing side removes hero ellipse (1.14)

Post by Wonderboy »

I'm updating my old campaign Bitter Revenge to Wesnoth 1.14. In scenario 2 I change side of a hero unit and give them ability to recruit. This unfortunately removes the hero ellipse from the unit. Here is my code that used to work in Wesnoth 1.12 and prior.

Code: Select all

                [unit]
                    type=Black Mage
                    id=Enia
                    name= _ "Enia"
                    side=1
                    x=6
                    y=4
                    unrenamable=yes
                    random_traits=no
                    {IS_HERO}
                    [modifications]
                        {TRAIT_LOYAL}
                    [/modifications]
                [/unit]

This is from first scenario where I define the unit and define hero overlay and ellipse.

Code: Select all

        [store_unit]
            [filter]
                id=Enia
            [/filter]

            kill=yes
            variable=stored_Enia
        [/store_unit]

        {VARIABLE stored_Enia.side 2}
        {VARIABLE stored_Enia.canrecruit yes}

        [unstore_unit]
            variable=stored_Enia
        [/unstore_unit]

	{CLEAR_VARIABLE stored_Enia}
	
This is from second scenario where I store and change the units side and give the ability to recruit. This seems to remove the hero ellipse,
Campaigns that I have created (now updated to 1.14):
Bitter Revenge, The Dark Alliance, Battle Against Time, Talentless Mage
User avatar
Lord-Knightmare
Forum Regular
Posts: 1182
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: Storing unit and changing side removes hero ellipse (1.14)

Post by Lord-Knightmare »

Hi,

I was working on something exactly like this earlier today and in my case, the hero unit retained the ellipse.

Here is my code:
The storing and unstoring is handled by the core macro MODIFY_UNIT

Code: Select all

{MODIFY_UNIT (id="Mahir") side 9}
{MODIFY_UNIT (id="Mahir") canrecruit yes}
Hope it helps.
User avatar
Wonderboy
Posts: 55
Joined: July 4th, 2006, 6:53 am
Location: Finland

Re: Storing unit and changing side removes hero ellipse (1.14)

Post by Wonderboy »

Thanks for the reply the reply Lord-Knightmare. Unfortunately I had the no ellipse problem with MODIFY_UNIT macro. I tried only changing side and unit retained ellipse. Apparently canrecruit trait messes with the ellipse.

I have included the campaign and savefile to start of scenario 2 if someone wants to take a closer look (edit: removed files because it is working now).

EDIT: It's working now, here is the working code for future reference.

Code: Select all

     {MODIFY_UNIT (id="Enia") side 2}   
        
  [modify_unit]
      [filter]
            id=Enia
      [/filter]
      ellipse="misc/ellipse"
[/modify_unit]
[modify_unit]
      [filter]
            id=Enia
      [/filter]
      canrecruit=yes
[/modify_unit]
Campaigns that I have created (now updated to 1.14):
Bitter Revenge, The Dark Alliance, Battle Against Time, Talentless Mage
User avatar
octalot
Developer
Posts: 509
Joined: July 17th, 2010, 7:40 pm

Re: Storing unit and changing side removes hero ellipse (1.14)

Post by octalot »

When adding canrecruit=yes, you can UNMAKE_HERO so that they get the leader ellipse instead. Another approach is to change the original {IS_HERO} to {IS_EXPENDABLE_LEADER}.

There's something about UNMAKE_HERO in UnitTypeWML's ellipse docs.
User avatar
Celtic_Minstrel
Developer
Posts: 1692
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Storing unit and changing side removes hero ellipse (1.14)

Post by Celtic_Minstrel »

Wonderboy wrote: September 1st, 2020, 2:54 pm EDIT: It's working now, here is the working code for future reference.
That code can be simplified into a single call:

Code: Select all

[modify_unit]
      [filter]
            id=Enia
      [/filter]
      side=2
      ellipse="misc/ellipse"
      canrecruit=yes
[/modify_unit]
Author of The Black Cross of Aleron campaign and Default++ era.
Maintainer of Steelhive.
Post Reply