How to remove 'canrecruit=yes' golden crown?

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
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

How to remove 'canrecruit=yes' golden crown?

Post by Toranks »

I have a mod that gives their own icon to certain units they can recruit but are NOT the leader.

Code: Select all

     [modify_unit]
        [filter]
            canrecruit=no
            [filter_wml]
                [variables]
                    aww_promoted_leader=no
                [/variables]
            [/filter_wml]
        [/filter]
        canrecruit=yes
        [object]
            id=aww_promoted_icon_overlay
            [effect]
                apply_to=overlay
                replace="misc/aww-leader-crown-bronze.png"
            [/effect]
        [/object]
        [variables]
            aww_promoted_leader=1
        [/variables]
    [/modify_unit]
I'm using this to replace icon on an unit with canrecruit=yes, but doesn't work. Using replace= is the same as add=, both add my custom icon over the gold crown of the new unit that can recruit. How I can delete the gold crown? This gold crown is added automatically by the game, maybe because is added after the event when i use replace?
Sin título3.png
I have tried this other way to remove overlays at the end of the same event, but it doesn't work either

Code: Select all

	[remove_unit_overlay]
		[filter_wml]
			[variables]
				aww_promoted_leader=1
			[/variables]
		[/filter_wml]
        image=misc/leader-expendable.png
    [/remove_unit_overlay]
User avatar
Helmet
Posts: 641
Joined: December 19th, 2006, 5:28 pm
Location: Florida, USA

Re: How to remove 'canrecruit=yes' golden crown?

Post by Helmet »

Here ya go.
I used Photoshop to remove the crowns.
:)
joke.png
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How to remove 'canrecruit=yes' golden crown?

Post by beetlenaut »

As far as I know, you cannot remove the gold crown on a unit with canrecruit=yes. I think it is added permanently within the game code, and not with an [effect]. However, I know you can cover it. If you move your bronze crown down a few pixels, it looks like it would cover the gold one. (You should move it down anyway because it is covering too much of the movement orb now.)

I don't know what your second code block is demonstrating. Your previous code and image don't show that you added misc/leader-expendable.png in the first place, so of course you can't remove it. Also, you added an object.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: How to remove 'canrecruit=yes' golden crown?

Post by Toranks »

misc/leader-expendable.png, according to the IS_EXPENDABLE_LEADER macro, it is the crown held by leaders who can recruit. I was trying to remove it that way, accordingly, but it didn't work.

image-utils.cfg

Code: Select all

#define IS_EXPENDABLE_LEADER
    # Embed this into a unit declaration to add an expendable leader icon to the unit.
    [+modifications]
        [object]
            [effect]
                apply_to=overlay
                add="misc/leader-expendable.png"
            [/effect]
        [/object]
    [/modifications]
#enddef
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: How to remove 'canrecruit=yes' golden crown?

Post by Toranks »

By the way, I don't move it a few pixels lower because I don't want it to cover the "Loyal" icon on other units. In any case, the appearance of the crown covering is not bad at all, I will probably end up leaving it that way. But I was especially interested in finding out why it took a while to remove that crown that seems hard-coded.
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How to remove 'canrecruit=yes' golden crown?

Post by beetlenaut »

Toranks wrote: November 14th, 2022, 7:53 am misc/leader-expendable.png, according to the IS_EXPENDABLE_LEADER macro, it is the crown held by leaders who can recruit.
Yes, but I didn't see where you used that macro or image, so it looked like you were doing it wrong.
Toranks wrote: November 14th, 2022, 7:53 am I was trying to remove it that way, accordingly, but it didn't work.
I knew that something was wrong with your code because this does work. (I just tested it to be sure.) However, this is not the best way to remove an overlay because two objects are left in the unit--one that places the overlay, and one that removes it. It would be better to remove the object that added the first overlay instead.
Toranks wrote: November 14th, 2022, 7:56 am I don't move it a few pixels lower because I don't want it to cover the "Loyal" icon on other units.
You could make a second version of the loyal icon that is lower. It could also go in front of the crown instead of behind it.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: How to remove 'canrecruit=yes' golden crown?

Post by Toranks »

beetlenaut wrote: November 14th, 2022, 1:10 pm
Toranks wrote: November 14th, 2022, 7:53 am I was trying to remove it that way, accordingly, but it didn't work.
I knew that something was wrong with your code because this does work. (I just tested it to be sure.) However, this is not the best way to remove an overlay because two objects are left in the unit--one that places the overlay, and one that removes it. It would be better to remove the object that added the first overlay instead.
I think there is a misunderstanding...
I know this works for any overlay, normally. But NOT with the golden crown we are talking about specifically, the one added by default when we set canrecruit=yes.
Now I'm assuming there is no object in this overlay, nor can it be removed by normal ways, so I'll follow your advice to modify my own overlay to cover the possibilities.
User avatar
Toranks
Translator
Posts: 168
Joined: October 21st, 2022, 8:59 pm
Location: Sevilla
Contact:

Re: How to remove 'canrecruit=yes' golden crown?

Post by Toranks »

Done. Now I simply filter whether it's trait=loyal or not, and give each one different icons, one that replaces the gold crown with a bronze one overlay, and the loyals the same crown with the loyal bracelet attached.
Sin título.png
Thanks!
Post Reply