[closed] Merge unit animaions

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.
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

[closed] Merge unit animaions

Post by ZombieKnight »

Hi,
My code that gives unit "explosion" animation halo:

Code: Select all

[effect]
                              apply_to = new_animation
                                [animation]
                                    apply_to=explosion
                                    [frame]
                                        halo="projectiles/fireball-impact-[1~16].png:[60*16]"
                                    [/frame]
                                [/animation]
I'd like to give unit animation "explosion" which should be unit's defend animation + my custom halo
An idea how to do so?
Last edited by ZombieKnight on April 20th, 2024, 9:58 am, edited 1 time in total.
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
beetlenaut
Developer
Posts: 2827
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Merge unit animaions

Post by beetlenaut »

The [animation] tag doesn't support "apply_to." All tags ONLY support specific keys and subtags. You can specify an "id" though, which can be selected by an event. (If you are new to WML, animations are not the easiest thing to start with.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

I won't call myself new... I'd like to merge six dwarven cannon smokes into one, without editing ~16 images.
#explosion animation was solved using lua animations.
Can I merge more halo's? (Maybe like ~SCALE())
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Celtic_Minstrel
Developer
Posts: 2241
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Merge unit animaions

Post by Celtic_Minstrel »

beetlenaut wrote: April 16th, 2024, 6:49 pm The [animation] tag doesn't support "apply_to."
…what are you talking about? Yes it does. The [animation] tag is rarely actually used for animations though, so you won't see it very often. None of the animation tags that are generally used support apply_to – only [animation] specifically. For this specific use-case, [extra_anim] is usually used, which takes flag instead of apply_to for the same meaning.
ZombieKnight wrote: April 16th, 2024, 3:11 pm I'd like to give unit animation "explosion" which should be unit's defend animation + my custom halo
An idea how to do so?
I'm afraid you're going to have to manually duplicate the content of the unit's defend animation. Look up the definition of the DEFENSE_ANIM macro, copy-paste it into your explosion animation, and modify it as needed. And if needed, add the extra [frame] tag described here (maybe rename the tag to [flash_frame] though).
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

Oh, the thing is idk what unit will be animation explosion given in advance(depends on my "best ranged target" finder).
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Celtic_Minstrel
Developer
Posts: 2241
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Merge unit animaions

Post by Celtic_Minstrel »

Since the default defend animation is pretty formulaic, you might be able to get away with just substituting $this_unit appropriately into the definition of the DEFENSE_ANIM macro (which requires you to use [modify_unit] to add the animation), and otherwise do just as I described above. However, it really depends on what set of units could possibly receive the animation, and how their defend animations are constructed. It may be necessary to make a different version of the explosion for every unit.

Given that your animation is very simple, there might be another alternative, as long as you're not using it on something like a Mage of Light (or if you're okay with an illuminates halo disappearing). You could use the following effect instead of the one in your opening post:

Code: Select all

[effect]
	apply_to=halo
	halo="projectiles/fireball-impact-[1~16].png:[60*16]"
[/effect]
I'm not sure how well that'll work, but it could be worth a try.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

I'm using lua.add.hex_overlay now, but its glitchy...
I'll stick with it for now, if I won't find a repair until release, I'll try these too (tho the'll maybe glitchy too)
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

Btw can I use ~BLIT to make an animation from two animations?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Celtic_Minstrel
Developer
Posts: 2241
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Merge unit animaions

Post by Celtic_Minstrel »

BLIT works on images, not animations. So no.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

Aaand any idea how to merge more animation halos into one?
(I'd like my unit attack animation "smoke bomb" = gun smoke into all six directions)
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Celtic_Minstrel
Developer
Posts: 2241
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Merge unit animaions

Post by Celtic_Minstrel »

It's pretty likely that that's not possible (short of image editing).
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

It has to be!
I really don't like the idea of putting over 100 offseted images together
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
Celtic_Minstrel
Developer
Posts: 2241
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Merge unit animaions

Post by Celtic_Minstrel »

Well, it's possible in a unit animation. Maybe you could also try putting several items on the same hex, each with a different halo.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

Jup that is possible... but how to put it into:

Code: Select all

[effect]
     apply_to=new_animation
Any idea?
I had saurian in profile before, but I've merged my discord profile with forum one...
User avatar
ZombieKnight
Posts: 180
Joined: June 27th, 2022, 2:26 pm
Location: Czech Republic

Re: Merge unit animaions

Post by ZombieKnight »

I've found a solution... just put there [missile1_frame] ... [missile6_frame] and different halos in there ...
What's weird is that there's nowhere a word about your frame tags in the documentation.
I had saurian in profile before, but I've merged my discord profile with forum one...
Post Reply