HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Slowing down attack animation?

10-21-2009, 05:50 PM#1
Na_Dann_Ma_GoGo
Hio,
I wanted to create the Diablo 3 Dark Berserker in my map who can use a powerful attack from time to time, that deals extra damage but also swings slower and let him get stuck in the ground when missing the enemy.
However I dunno if the attack animation is accessibly through JASS. SetUnitTimeScale() doesn't seem to work for that.
I thought I may try to work around with Attack index 1 and attack index 2 in the object editor and giving the second attack different damage and making the attack animations slower. However I did some research and is there even a chance of doing so with 2 melee attacks?

Thus help is greatly appreciated and if there's any workaround tell me^^

If nothing helps I'll trigger it completely by just letting the unit play the animation. That way I can make it stuck when not hitting as well.
10-22-2009, 03:57 AM#2
cosmicat
Not that realism is at all relevant in Warcraft anyway, but since F=ma, a "slow" swing would actually be a lot weaker than a fast one, unless a reduction in speed greatly increases accuracy and somehow increases mass. The only animation that might get a little slower in a "strong" attack would be the backswing.
Since I've never done a whole lot with custom animations (in WE or out of it), I don't really have anything to contribute to an actual solution, though.
10-22-2009, 08:30 AM#3
DioD
trigger attack is only way.
10-22-2009, 08:52 AM#4
Earth-Fury
Slowing a unit's attack speed slows down the animation.

I'm not sure if it will work well in your situation, but it's worth a shot.

The best way to slow a unit's attack speed is with negative bonus item attack speed abilities. Or just use BonusMod that does it all for you, but that may be overkill.
10-22-2009, 09:13 AM#5
Viikuna-
Using BonusMod or UnitProperties would probably work pretty neatly.



When decereasing attack speed: add some damage and decerease attack miss chance.

When incereasing attack speed: decerease damage and incerease attack miss chance.

I dont quite get what you mean by "Getting stuck in the ground when missing enemy", but it should be possible to detect when unit misses his target, if you use some system like UnitProperties Evasion Module, to control all that miss and evasion stuff in your map. You can just easily add do some simple functions for registering some custom miss and evasion events.




But the most flexible way would probably to trigger all those attacks.

Something like this:

Give your units an instant attack which deals 0 damage. Detect this damage so you know when unit starts attacking some other unit. Adjust units timescale and play attack animation, start some timer to wait until animation has reached its damage point and then just check if target can be damaged or did the attack miss or stuff like that, and do your actions.

You should probably also prevent unit from doing those instant normal attacks when your triggered attack is being executed.

Also you need to detect if player gives some new order to unit, or some weird stuff happens to unit that should stop that triggered attack.

Now when I think of it, it might be that its quite hard stuff to trigger. But if you can make it, it would be quite cool, since then you could easily control all that attacking stuff and animations and everything.
10-22-2009, 12:09 PM#6
Na_Dann_Ma_GoGo
Well thanks for you help guys.
I actually tried to reduce the attack speed by SetUnitScale which didn't work somehow.
And when I tried to do that with an ability that decreases the attack speed it didn't work either.. .at first (which I wondered about)
Now I did it again and yeah, it seems to work.
However I decided to trigger it completely now. And lol @ cosmicat.
I wanted to use a slower attack animation because in the gameplay trailer of Diablo 3 the berserker takes a longer swing when he attacks with the extra damage and I wanted to fake the extra time by just slowing down the whole animation.
However I'll trigger it now where I can play around with the animation speed until I like it. And then I can do that "getting stuck" part as well. (which you can see in the trailer @vikuna)
10-22-2009, 01:53 PM#7
Rising_Dusk
Quote:
Originally Posted by cosmicat
F=ma, a "slow" swing would actually be a lot weaker than a fast one, unless a reduction in speed greatly increases accuracy and somehow increases mass.
Please don't use that formula when talking about mass not being constant.
10-22-2009, 06:36 PM#8
cosmicat
I'm saying the amount of total force (both that which is exerted on the weapon to accelerate it and that which would be required to stop it, as per Newton's laws) is directly proportional to both the mass and the acceleration of the weapon, and since mass is constant (duh) the force in this case is directly proportional to acceleration. The word "unless" should have indicated that much, at least...

If mass is magically increasing, acceleration can decrease (by inverse proportion) and net force is not changed; I assume this is not the case.
Therefore, slow = weak and fast = strong. Also, slow = not getting stuck.

Depending on exactly how slow, a slow swing would actually be ridiculously impractical no matter how you look at it. A really slow swing would involve controlling the weapon in opposition to gravity (exerting upward force to prevent the weapon from falling too quickly), which requires more energy than simply letting it drop. Then, the low momentum (velocity) means very little acceleration needs to happen to stop the weapon, so the enemy's armor likely counters most of the blow and little (if any) damage is actually done. The sole advantage of such a swing would be not getting stuck if you miss, although misses are a lot more likely if the swing is slow.

The difference between a long swing and a slow swing is huge, so thanks for explaining your intention. In a "long" swing, final velocity can be increased (depending on the strength and endurance of the one performing the swing) since there is more time for acceleration. In a "slow" swing, final velocity is, of course, slow, which is bad.
10-23-2009, 02:20 AM#9
Zerzax
Notice that when a "slow swing" is made, the applied force changes drastically over time - the weapon is raised up slowly and brought down rapidly in an arc once the maximum gravitational potential energy has been harnessed. I think the whole point of a slow, downward strike is that the weapon head will have a higher kinetic energy because more potential energy has been stored in it during the "slow" phase.
10-23-2009, 02:16 PM#10
Na_Dann_Ma_GoGo
Exactly, that's what I accomplished now. When the unit (with a Faceless One model) starts his attack animation I slow him down so that he slowly raises and swings the mace behind his back. And then after a short time I increase the animation speed to a bit faster than normal.
It still doesn't look that well since it's kinda weird how the whole unit slows down at first but no better way to simulate the extra swing the Diablo 3 counterpart does ;p
10-23-2009, 02:19 PM#11
Rising_Dusk
Quote:
Originally Posted by Zerzax
Notice that when a "slow swing" is made, the applied force changes drastically over time - the weapon is raised up slowly and brought down rapidly in an arc once the maximum gravitational potential energy has been harnessed. I think the whole point of a slow, downward strike is that the weapon head will have a higher kinetic energy because more potential energy has been stored in it during the "slow" phase.
I think you guys don't understand how potential and kinetic energy works. Raise a stick over your head fast, and then raise it over your head slowly. If you raise it to the same position, it doesn't matter how fast you raised it there, it has the same potential energy. The stick actually has more mechanical energy if you raised it there fast than slowly, which would make the eventual hit of the stick on your target more damaging with the faster motion than the slower one.
10-24-2009, 09:57 PM#12
Na_Dann_Ma_GoGo
But if you raise it fast and immediately try to swing it towards the enemy afterwards some of the energy used to swing down is taken away to compensate the kinetic energy from raising. And when you raise the weapon slow and have it still for a moment that won't matter at all.
(Sorry for terrible English here -.-)