Changing unit type of a Leader?
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.
-
- Posts: 38
- Joined: June 17th, 2011, 1:26 am
Re: Changing unit type of a Leader?
I have a new question, related to my previous one: How can I remove the undead trait, or at least its effects? Transforming a unit doesn't remove any of its traits, including the undead trait, and I can't find anything on the wiki about removing traits. I tried adding a different trait that added something that looks like this:
But it doesn't remove the immunity to poison, drain, plague effect of the undead trait. (Do new abilities always get applied before preexisting ones? Because if so, that not_living bit gets reapplied after my new trait anyway.)
Code: Select all
[effect]
apply_to=status
remove=not_living
[/effect]
But it doesn't remove the immunity to poison, drain, plague effect of the undead trait. (Do new abilities always get applied before preexisting ones? Because if so, that not_living bit gets reapplied after my new trait anyway.)
Currently working on various ideas using 1.9.8.9
Re: Changing unit type of a Leader?
You can remove the traits by storing the unit into a variable, using CLEAR_VARIABLE on the traits, then unstoring the unit variable. The attribute generate_traits=yes will cause new traits appropriate to the unit type to automatically be generated.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
-
- Posts: 38
- Joined: June 17th, 2011, 1:26 am
Re: Changing unit type of a Leader?
I'm not entirely sure how, but this code intended to get rid of all traits (especially undead) managed to duplicate them

Code: Select all
[store_unit]
[filter]
side={SIDE}
canrecruit=yes
[/filter]
variable=leader
kill=yes
[/store_unit]
{CLEAR_VARIABLE leader.modifications.trait.id}
{CLEAR_VARIABLE leader.modifications.trait.effect.add}
[unstore_unit]
variable=leader
[/unstore_unit]
Currently working on various ideas using 1.9.8.9
Re: Changing unit type of a Leader?
Try this:
{CLEAR_VARIABLE leader.modifications.trait[0]}
Also, make sure you do this after changing the unit's race to something other than undead.
Disclaimer: untested
{CLEAR_VARIABLE leader.modifications.trait[0]}
Also, make sure you do this after changing the unit's race to something other than undead.
Disclaimer: untested
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: Changing unit type of a Leader?
Hi
I did not read every post, your problem may be solved.
The problem with modifying only the type, is that the attack, resistance, moves etc. values will remain. But there is another solution:
And for removing and creating traits, there is a macro I wrote (of course not by only myself, I got lots of help from others):
I did not read every post, your problem may be solved.
The problem with modifying only the type, is that the attack, resistance, moves etc. values will remain. But there is another solution:
Code: Select all
[store_unit]
[filter]
id=<Your-leaders-id>
[/filter]
kill=yes
variable=leader_stored
[/store_unit]
[unit]
type=<the new type you want>
id=$leader_stored.id
name=$leader_stored.name
profile=$leader_stored.profile
side=$leader_stored.side
experience=$leader_stored.experience
hitpoints=$leader_stored.hitpoints
# Max hitpoints and experience will depend on the new type, so it don't have to be set to the original value
x=$leader_stored.x
y=$leader_stored.y
canrecruit=yes
# In theory, the leader don't have any traits, so there's no need of copying them
[/unit]
{CLEAR_VARIABLE leader_stored}
And for removing and creating traits, there is a macro I wrote (of course not by only myself, I got lots of help from others):
Spoiler:
Spoiler:
Main UMC campaigns: The Ravagers - now for 1.18, with even more bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny