Storing unit and changing side removes hero ellipse (1.14)
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.
Storing unit and changing side removes hero ellipse (1.14)
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.
This is from first scenario where I define the unit and define hero overlay and ellipse.
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,
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]
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}
Campaigns that I have created (now updated to 1.14):
Bitter Revenge, The Dark Alliance, Battle Against Time, Talentless Mage
Bitter Revenge, The Dark Alliance, Battle Against Time, Talentless Mage
- Lord-Knightmare
- Discord Moderator
- Posts: 2364
- 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)
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
Hope it helps.
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}
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
Re: Storing unit and changing side removes hero ellipse (1.14)
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.
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
Bitter Revenge, The Dark Alliance, Battle Against Time, Talentless Mage
Re: Storing unit and changing side removes hero ellipse (1.14)
When adding canrecruit=yes, you can UNMAKE_HERO so that they get the leader ellipse instead. Another approach is to change the original
There's something about UNMAKE_HERO in UnitTypeWML's ellipse docs.
{IS_HERO}
to {IS_EXPENDABLE_LEADER}
.There's something about UNMAKE_HERO in UnitTypeWML's ellipse docs.
- Celtic_Minstrel
- Developer
- Posts: 2227
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Storing unit and changing side removes hero ellipse (1.14)
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]