[anitmation] conditionals

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
white_haired_uncle
Posts: 1230
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

[anitmation] conditionals

Post by white_haired_uncle »

I'm creating a unit, the suicide drone. It has a weapon special 'explosive detonation' whereby if it hits it explodes doing self.hitpoints to himself and all adjacent units. It also has trait 'unstable', so if you hit it with impact, again an Earth-shattering kaboom! Kind of a fun little guy. This all works fine.

I want him to have a spectacular death when he detonates. I've set up a [death] for him, and I like it. However, I only want that to happen on an explosive detonation/unstable attack. If he's killed otherwise, I just want a boring death (or perhaps just a different one).

I've looked at the conditionals for animations (seriously, they had to work differently than WML?) and filters.

1) The only thing I see for the animation-if is hits=yes|no. I can't find a list of conditionals. Is there a list?
2) There's also a hits= listed as a filter for [animation]. Not sure how this differs from the above, if at all?
3) There are filters like [filter_second_attack], which seem the most promising. I assume [filter_attack] and [filter_second_attack] might depend on if he dies while attacking or defending (under normal circumstances). However, his death will come via a [harm_unit] fired by attacker|defender_hits event. I'm not sure if [harm_unit] passes primary_unit, second_attack, etc when using animate=yes.

I can try this that and the other thing, but I'm hoping someone knows the answer.
Speak softly, and carry Doombringer.
white_haired_uncle
Posts: 1230
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [anitmation] conditionals

Post by white_haired_uncle »

Thanks. Looking at that got me thinking that I don't necessarily need to concentrate on [death], since if my unit hits on offense he's going to die. I'd still like to get the filters working (special_id_active I think on attack) just to understand them.

Defense is a bit harder. I'm not sure what

Code: Select all

 [defense] hits=yes 
would mean, my unit hitting as a defender, or my unit being hit by the defender while my unit attacks, or ... It seems there are like 8 states total (I am attacker/defender * I hit/miss/I am hit/I am missed) but only 4 configurable options ([attack_anim] hit=yes/no, [defend] hit=yes/no).

Actually, in my case I don't really need a unit animation. I'm initiating the death via [harm_unit], so I could just display an animation at the same time, assuming there's a way to show an animation that's not part of a [unit_type] -- there must be, right?
Speak softly, and carry Doombringer.
User avatar
Celtic_Minstrel
Developer
Posts: 2243
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [anitmation] conditionals

Post by Celtic_Minstrel »

white_haired_uncle wrote: April 18th, 2024, 6:07 pm 1) The only thing I see for the animation-if is hits=yes|no. I can't find a list of conditionals. Is there a list?
My understanding is that the content of the [if] and [else] subtags are essentially just an animation – that is to say, anything that can be put at the top level of the animation can also be put inside the condition. From the standpoint of "what conditions can you use", then, the answer would be the list of Animation Filters.
white_haired_uncle wrote: April 18th, 2024, 6:07 pm 2) There's also a hits= listed as a filter for [animation]. Not sure how this differs from the above, if at all?
So basically they are the same thing.
white_haired_uncle wrote: April 18th, 2024, 6:07 pm 3) There are filters like [filter_second_attack], which seem the most promising. I assume [filter_attack] and [filter_second_attack] might depend on if he dies while attacking or defending (under normal circumstances). However, his death will come via a [harm_unit] fired by attacker|defender_hits event. I'm not sure if [harm_unit] passes primary_unit, second_attack, etc when using animate=yes.
The primary unit is always the unit being animated, and it's the attack that the unit being animated is using. So for example, in a defend animation, the primary unit is the unit being targeted, and in an attack animation, it's the unit currently attacking. Or to phrase it much more simply, it's always the unit you're defining the animation in – the unit that the animation belongs to.
white_haired_uncle wrote: April 18th, 2024, 9:21 pm Defense is a bit harder. I'm not sure what

Code: Select all

 [defense] hits=yes 
would mean, my unit hitting as a defender, or my unit being hit by the defender while my unit attacks, or ... It seems there are like 8 states total (I am attacker/defender * I hit/miss/I am hit/I am missed) but only 4 configurable options ([attack_anim] hit=yes/no, [defend] hit=yes/no).
From above, it's obvious that it would mean that your unit has been hit in combat. On the other hand, in an attack animation, hits=yes would mean your unit has hit the opponent in combat.
white_haired_uncle wrote: April 18th, 2024, 6:07 pm Actually, in my case I don't really need a unit animation. I'm initiating the death via [harm_unit], so I could just display an animation at the same time, assuming there's a way to show an animation that's not part of a [unit_type] -- there must be, right?
There's haloes which support the same progressive notation, but you could also define a custom animation in the unit type using [extra_anim] and trigger that instead of the death animation.

You can also specify exactly what's passed into the animation filters via [harm_unit], for example using the [primary_attack] tag, but I don't know if that's really useful in this scenario.

By the way, if you have any suggestions for improving the AnimationWML page, please let me know – it was very awkward and confusing for the longest time and I recently tried to clean it up and organize it better.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
white_haired_uncle
Posts: 1230
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: [anitmation] conditionals

Post by white_haired_uncle »

Celtic_Minstrel wrote: April 19th, 2024, 1:14 am The primary unit is always the unit being animated, and it's the attack that the unit being animated is using. So for example, in a defend animation, the primary unit is the unit being targeted, and in an attack animation, it's the unit currently attacking. Or to phrase it much more simply, it's always the unit you're defining the animation in – the unit that the animation belongs to.

...

By the way, if you have any suggestions for improving the AnimationWML page, please let me know – it was very awkward and confusing for the longest time and I recently tried to clean it up and organize it better.
Thank you. If you could get that info onto the wiki, I think it would help a lot. Or maybe it's there and I skimmed the page looking for what I wanted instead of reading from start to finish.

In the end, I simply could not get the [if] hits=yes stuff to work. As soon as I added it to a working example, copying as closely as possible from the wiki, even though I knew there was a hit by watching what happened in attacker_hits that section would never be used. I need to set up a super simple test case and check to make sure it isn't broke.

And I had issues with the animation being in [attack_anim], I just couldn't get the timing I wanted.

So, since I'm firing the killing blow out of attacker hits and friends anyway, I just added a [death] animation there, with no conditions since I knew the unit was about to die, and die from the type of attack I wanted to animate.

If I ever, for some reason, decide to mess with animation again I'm doing it in lua so I don't have to restart the scenario with f5 every single time I make a change.
Speak softly, and carry Doombringer.
User avatar
Celtic_Minstrel
Developer
Posts: 2243
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: [anitmation] conditionals

Post by Celtic_Minstrel »

white_haired_uncle wrote: April 19th, 2024, 2:08 am Thank you. If you could get that info onto the wiki, I think it would help a lot. Or maybe it's there and I skimmed the page looking for what I wanted instead of reading from start to finish.
I added more info clarifying that the content of [if] is the same as the content of the toplevel animation, but as for which unit the filters apply to, I think that's clearly stated in the Animation Filtering section? For example, under [filter] it clearly says "the animated unit". If something about that is unclear, please feel free to offer suggestions on how to improve it.
white_haired_uncle wrote: April 19th, 2024, 2:08 am In the end, I simply could not get the [if] hits=yes stuff to work. As soon as I added it to a working example, copying as closely as possible from the wiki, even though I knew there was a hit by watching what happened in attacker_hits that section would never be used. I need to set up a super simple test case and check to make sure it isn't broke.
I looked at the relevant section of the documentation and noticed that it doesn't mention hits at all. It's possible that the flag isn't even used for defend animations… seems like an oversight to me if so. Though maybe it was done for technical reasons.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply