• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Triggered special attack animation

Status
Not open for further replies.
Level 9
Joined
Sep 20, 2015
Messages
385
Hello, i need a solution for this problem. I'm making a passive ability that makes the hero do a special attack every 5th basic attacks. I need the model to play a specific animation but it's hard to do so.

I used Birbe DDS to detect when the specal attack have to trigger, it works perfectly but the animation isnt played properly. Using this :

Events
DamageModifierEvent become equal to 1
Conditions
DamageEventSource equal to Myhero
HeroAtkcount equal to 5
Actions
Animations - Reset MyHero's animation
Wait 0.01 seconds
CustomScript: callSetUnitAnimationbyIndex(gg_myhero,3)​

Using this trigger will make the unit play the animation right after the normal attack animation, making it pretty ugly to watch cause it isn't in sync with the damage. i need to change the next normal attack animation.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
You can do it with an animation tag, but you can also do it on "Unit - A unit is attacked"

Simply increase the attack count on the DDS event as you do, but check at "Unit - A unit is attacked" if the attacker's count is at 5.
If it is at 5, just leave it there, the DDS event trigger will reset it to 0 or 1 and apply the damage effect.
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
Nothing I said precludes using both like you implied. I answered his question about why not to use that event usually. Not every post is about you, you know.

Even using DDS with "is attacked" to do the animations, you could still cancel the attack that would use the special animation, resulting in the animation playing all the way through even though the attack never goes off. You are correct that as long as you only change your AttackCount variable in the DDS trigger it will always play the right animation at the right time and won't get out of sync... it's just that it can ALSO play the right animation at the wrong time if you cancel the attacks.

Hence "always some sort of problem".
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Even using DDS with "is attacked" to do the animations, you could still cancel the attack that would use the special animation, resulting in the animation playing all the way through even though the attack never goes off.

I assumed the unit in question was melee.
If not, you have to extend your possibilities first and replace the DDS event with the launch event.

But in any case, if you cancel the attck, the animation will also be cancelled, so there is no problem with it.
 
Level 9
Joined
Sep 20, 2015
Messages
385
You can do it with an animation tag, but you can also do it on "Unit - A unit is attacked"

Simply increase the attack count on the DDS event as you do, but check at "Unit - A unit is attacked" if the attacker's count is at 5.
If it is at 5, just leave it there, the DDS event trigger will reset it to 0 or 1 and apply the damage effect.

Well, my apologies for not belive in you but you were right. If i use a melee hero the animation in perfectly in sync with the damage. Thank you! :) +rep
But i wanted to do a ranged hero with a similar skill aswell (like every attack he increase his aim and does more dmg until a x number he unleash a bullseye-instakill shot) im gonna try some stuff....
 
Level 9
Joined
Jul 3, 2008
Messages
495
Im not modding wc3 anymore, so my idea might not be possible or the best. But its still an idea.


Create a dummy Critical Strike ability. Hide the red floating text. Set the damage factor to 1x and chances to 100%. You should be able to define which animation to play under one of the art fields. Use spellbook trick to hide the icon.

When your count = 4, add the ability to the unit. When your count >= 5, remove the ability.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
It is generally better to not be bound to Object Editor data if it isnt necessary.
If a certain effect can be done completely by triggers, then that is the by statistics already one of the top approaches of your situation... because of configuration (importing-wise).
(But that doesnt mean that a (Semi-) Object Editor approach is not better in every case.)

IIrc, critical strike's doesnt use the animations listed in the object editor.
At least the standard critical strike abilities dont have them.
 
Level 9
Joined
Sep 20, 2015
Messages
385
Im not modding wc3 anymore, so my idea might not be possible or the best. But its still an idea.


Create a dummy Critical Strike ability. Hide the red floating text. Set the damage factor to 1x and chances to 100%. You should be able to define which animation to play under one of the art fields. Use spellbook trick to hide the icon.

When your count = 4, add the ability to the unit. When your count >= 5, remove the ability.

Thy for the suggestion but i tried this way, and with Critical Strike or Bash, the animation is always Attask Slam in the model has it, it works perfectly for me with triggers :)
 
Level 10
Joined
Oct 5, 2008
Messages
355
Well, for ranged characters, the main possibilities which could cancel the animation are:

Any order to the unit, like canceling
Stunning/pausing/disabling the unit
(If someone comes up with other cases, he can contribute)

If you can detect these you could use the time of the attack animation of the unit. Just put the unit into a group and then count down the time for the attack needed (Would require some more effort, like using hashtables, you could also go for timers or any other method). If you detect any of the upper cases, you can terminate the timer/counter/whatever you use. Else, if it runs out, which should be the case if the unit played through its animation, you can set the counter up.

But ofc the better case would be if you could directly deect the launch of the missile. Unfortunally i dont know any possibility which wouldnt require to completely trigger the missile via dummies.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
mmm IIRC the ''Unit is attacked'' event is triggered if the unit get in acquisition range, not if an auto attack actually hit the target. That's why i didn't use this but i'll give it a try, thank you for your suggestion :)
You are correct but there's no solution to this that doesn't have SOME sort of problem. Pick your poison.
Wait, what??

Im not modding wc3 anymore, so my idea might not be possible or the best. But its still an idea.


Create a dummy Critical Strike ability. Hide the red floating text. Set the damage factor to 1x and chances to 100%. You should be able to define which animation to play under one of the art fields. Use spellbook trick to hide the icon.

When your count = 4, add the ability to the unit. When your count >= 5, remove the ability.
You are my kinda guy. Very cool. : )

It is generally better to not be bound to Object Editor data if it isnt necessary.
If a certain effect can be done completely by triggers, then that is the by statistics already one of the top approaches of your situation... because of configuration (importing-wise).
(But that doesnt mean that a (Semi-) Object Editor approach is not better in every case.)
Re-he-he-he-eally? That's interesting, because I have the exact opposite mindset.

I figure that Object Editor stuff is already the 'most native' to the system (additional triggers & lines of code are 'less native'), so when I can I use OE stuff almost exclusively, or perhaps minorly modified by TE stuff. Even if that means dealing with some nasty side-effects interesting features. : )
 
Level 10
Joined
Oct 5, 2008
Messages
355
Well, it really depends on what you are trying to achieve.
An ability is still a set of data, using space and time to create/load.

For example if i need a simple modified chain lightning, without much configuration, i refer to the one in WE. I could trigger it, but i can be sure that the trigger would consume more recources than the object data.
In this case, you need the tiners/triggers anyway to get that spell to work. You can also recycle them for other abilities. So the object data would replace a line in the trigger editor, which you would need anyway to add the ability in the first place (and to remove it). Making it rather pointless.

Its always depends on what you really need your spell to do. Making it more complicated for the sake of having ut triggered only bloats up map space. But if you want to achieve something the object data can't, or really need more customability or even need to let it work with other triggers, then go for it.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
How did you never know this? It's THE reason anything that requires damage detection is a pain in the ass if you don't have a favorite one picked out and ready to go.
Wait... I'm not talking Damage Detection. The quote was something about the 'Unit is Attacked' field, and how it is messed up somehow (something to do with acquisition range & what-not).

I have used it for years with no issue (being aware of the exploit where a player orders an attack & then cancels it quickly enough, stopping the attack but continuing the triggered effect; this exploit was, in general, a non-issue for the kinds of abilities I was making), but was I wrong?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
@Pyrogasm damage detection systems are a pain wether you like one or not.

@Kyrbi0 & @Lord_Earthfire
The biggest aspect is the ability to modify your spell to whatever you need.
If you keep using OE spells and never trigger anything, you wont get any interesting results... like never.
If you keep using TE to make your own spells, you will be able to recode any of the default spells and change them to your liking.
Not to mention that modifying triggered spells is a matter of minutes when you get used to it.
If you have to think of 3 workarounds, test them in every single scenario and create shitload of OE data that is also a pain to copy and paste, then I would just give up and code as much as I can instead.
 
Level 39
Joined
Feb 27, 2007
Messages
5,023
Wait... I'm not talking Damage Detection. The quote was something about the 'Unit is Attacked' field, and how it is messed up somehow (something to do with acquisition range & what-not).

I have used it for years with no issue (being aware of the exploit where a player orders an attack & then cancels it quickly enough, stopping the attack but continuing the triggered effect; this exploit was, in general, a non-issue for the kinds of abilities I was making), but was I wrong?
It fires when the attack is started. Which is when the target unit comes within the source unit's acquisition range (presuming there are no other nearby targets). This is exactly what you described.

If acquisition and attack range are different as I understand the lower value will determine when the event fires as the attack can't technically start until the distance to target is <= both.
 
Level 10
Joined
Oct 5, 2008
Messages
355
Well, this is true in case the unit is idle and thus gets aggroed by a unit within aquistion range and the range is equal to the aquistion range. If the aquistion range is higher than the range, the unit will be aggroed and tries to move till it can trigger the attack.

But these things don't apply when a unit is issued an attack.. When the unit is issued an attack, the aquistion range doesn't affect anything. The Unit moves till it can reach its target within range. As far as i know the event won't fire until it done so.

There are some cases as far as i know. If the range is higher than the aquistion range, then the range is capped at that aquistion range at map initiation. This isn't the case vise versa (see before). But its still possible then to increase the range via upgrades. In this case the aquistion range is lower than the normal range, so the unit could possible attack a father away target, but wont do it except its directly ordered because the target is not within the aquistion range and so it isn't aggroed (Had that problem when i was playing around with a TD idea the towers kept their old range until i increased their aquistion range in the Editor).

Well, i believe the confusion came up because it sounded in the post before that everytime a unit enters the aquistion range the trigger fires. At least for me.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
The Unit is attacked event runs when a unit is starting the attack sequence. Or at least, that is what it is supposed to do.
Ofcourse the target will be in the range of the attacker, because that check is done natively to start the attack sequence.

So I dont really see a problem with it.
 
Well you can pause the unit for complete animations control or change its visibility to basically hide it and show a dummy unit of it with the animation you want. The second option would likely be best for gameplay and control even though the first option is better in terms of controlling animation, it will horribly interrupt gameplay depending on the genre of your map/game.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
@Kyrbi0 & @Lord_Earthfire
The biggest aspect is the ability to modify your spell to whatever you need.
If you keep using OE spells and never trigger anything, you wont get any interesting results... like never.
If you keep using TE to make your own spells, you will be able to recode any of the default spells and change them to your liking.
Not to mention that modifying triggered spells is a matter of minutes when you get used to it.
If you have to think of 3 workarounds, test them in every single scenario and create shitload of OE data that is also a pain to copy and paste, then I would just give up and code as much as I can instead.
Well, that's useful if I need to be able to modify spells to that level.

I should probably say that I don't do only GUI; just that I try & maximize the amount of work done by the native abilities in the Object Editor. Take a look at any of my previous Contest entries (Hero Contest & Zephyr Contest, mainly), and you'll see what I mean.

It fires when the attack is started. Which is when the target unit comes within the source unit's acquisition range (presuming there are no other nearby targets). This is exactly what you described.

If acquisition and attack range are different as I understand the lower value will determine when the event fires as the attack can't technically start until the distance to target is <= both.
Ok... I'm not seeing the problem?

So wait, but there is a separate event catching "unit acquires a target" (have had fun with that one), so isn't there a reasonable gap?

So maybe I should ask: what's the significance of this?
 
Status
Not open for further replies.
Top