Diiferent images for same unit

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
Elmor
Posts: 152
Joined: May 5th, 2010, 8:19 am

Diiferent images for same unit

Post by Elmor »

Hi, I have a question.

I want to make unit, that will have different images for different hp status; something like 3 images for 100% hp, 66% hp and 33% hp.
Is it real and if yes, how can I do it?
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2361
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: Diiferent images for same unit

Post by Lord-Knightmare »

Well, you could try something using these tags:-

Code: Select all

[unit]
[modifications]
     [object]
         [effect]
             apply_to=hitpoints
             increase=66%
         [/effect]
     [/object]
     [object]
         [standing_anim]
         [/standing_anim]
     [/object]
[/modifications]
[/unit]
Make sure to do this inside an event(s) tag.

Code: Select all

[event]
[/event]
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: Diiferent images for same unit

Post by trewe »

Elmor wrote:Hi, I have a question.

I want to make unit, that will have different images for different hp status; something like 3 images for 100% hp, 66% hp and 33% hp.
Is it real and if yes, how can I do it?
It could be done with the a bit forgotten variationWML
Spoiler:
User avatar
pyrophorus
Posts: 533
Joined: December 1st, 2010, 12:54 pm

Re: Diiferent images for same unit

Post by pyrophorus »

Hi !
trewe wrote: It could be done with the a bit forgotten variationWML
That's right, but you can use modify_unit to apply variations instead of objects (better I think, because objects accumulate in unit description):

Code: Select all

[modify_unit]
     [filter]
          id=$unit.id
     [/filter]
     variation=injured
[/modify_unit]
HTH,
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: Diiferent images for same unit

Post by trewe »

pyrophorus wrote:That's right, but you can use modify_unit to apply variations instead of objects (better I think, because objects accumulate in unit description):
Will not work if the stats of the variation differ from the base unit. modify_unit>variation only changes names and the images, any stats (moves, attacks, defences, hitpoints) are not applied. Although that may be irrelevant in this particular case since the OP only wants to change images anyway... Against object stacking one can use clear_variable to erase unused ones.
Post Reply