• 🏆 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!

How To Detect Critical Strike

Status
Not open for further replies.
Thanks again for taking interest!!! Especially you, Pharoah_. Thanks, I'm pretty sure you'll answer this one, too :grin:

Alright, here's my problem. I made my own custom critical strike, and I want to make a custom skill that when the critical strike is 'landed', the unit will get (Bonus).

  • Crit Detect
    • Events
      • Unit - Unit begins casting an ability
    • Conditions
      • (Ability Being Cast) Equal to Critical Strike
      • (Level of (Ability Being Cast)) Equal to 1
    • Actions
      • Unit - (Bonus)
That's the trigger I made. I'll make separate triggers for each level. Thanks for helping! :smile:
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
your going to have to make the the crit strike spell with triggers and use a dummy spell instead of crit strike and add your effects in the crit strike trigger

use the event
  • Unit - A unit Is attacked
with the conditions you have also add the condition
  • (Random integer number between 1 and 100) Less than or equal to (your chance you want to crit strike)
you also said u will do seperate triggers for each level you could do it all in one trigger
 
Level 11
Joined
Feb 11, 2010
Messages
199
The problem is that "Unit is Attacked" doesn't detect when the unit actually *completes* an attack, but rather when it begins animating. Thus, if you used "Unit is Attacked" a skilled player can get an incredibly fast virtual "attack" speed (without ever actually completing an attack, but still triggerring the critical hits) by spamming attack and stop commands in succession.

I think what he wants to know is how exactly you detect when a melee attack lands. And it can't just be "when a unit takes damage" either, since that could be damage from any source. The only thing I know of is using an orb effect and checking when a unit has the orb buff applied, but that presents problems as well since orb effects don't stack! =(
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
And it can't just be "when a unit takes damage" either, since that could be damage from any source. The only thing I know of is using an orb effect and checking when a unit has the orb buff applied, but that presents problems as well since orb effects don't stack! =(

You could check if damage source has the ability learnt and execute an ITE handle afterwards.
 
Level 11
Joined
Feb 11, 2010
Messages
199
You could check if damage source has the ability learnt and execute an ITE handle afterwards.

No, the damage source can have the ability learned and be using something other than a melee attack to deal damage to you. You don't want to critical hit with Flame Strike, for example...
Or you're putting something terribly crucial in that "ITE" that you're not mentioning.
 
Level 9
Joined
Jun 25, 2009
Messages
427
  • Critical Strike
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Critical Strike for (Attacking unit)) Greater than 0
      • (Random integer number between 1 and 10) Less than or equal to (Level of Critical Strike for (Attacking unit))
    • Actions
      • Set Critical_Striker = (Attacking unit)
      • Set Critical_Striked = (Triggering unit)
      • Trigger - Add to Critical Damaged <gen> the event (Unit - Critical_Striked Takes damage)
      • Trigger - Turn off (This trigger)
  • Critical Damaged
    • Events
    • Conditions
      • (Damage source) Equal to Critical_Striker
    • Actions
      • Set Critical_Striked_Pos = (Position of Critical_Striker)
      • Set Critical_Damage = ((Integer((Damage taken))) x 2)
      • Unit - Create 1 Footman for (Owner of Critical_Striker) at Critical_Striked_Pos facing Default building facing degrees
      • Unit - Cause (Last created unit) to damage (Triggering unit), dealing (Real(Critical_Damage)) damage of attack type Hero and damage type Normal
      • Floating Text - Create floating text that reads (String(Critical_Damage)+!) at Critical_Striked_Pos with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change the color of (Last created floating text) to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 50.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 2.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.75 seconds
      • Unit - Add Bloodlust to (Last created unit)
      • Unit - Set level of Bloodlust for (Last created unit) to (Level of Critical Strike for (Damage source))
      • Unit - Order (Last created unit) to Orc Shaman - Bloodlust (Damage source)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Set Critical_Striked = No unit
      • Set Critical_Striker = No unit
      • Custom script: call RemoveLocation(udg_Critical_Striked_Pos)
      • Trigger - Turn on Critical Strike <gen>
But there's a problem that it can have a 5k events, so :/
 
Level 11
Joined
Feb 11, 2010
Messages
199
  • Critical Strike
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Critical Strike for (Attacking unit)) Greater than 0
      • (Random integer number between 1 and 10) Less than or equal to (Level of Critical Strike for (Attacking unit))
    • Actions
      • Set Critical_Striker = (Attacking unit)
      • Set Critical_Striked = (Triggering unit)
      • Trigger - Add to Critical Damaged <gen> the event (Unit - Critical_Striked Takes damage)
      • Trigger - Turn off (This trigger)
  • Critical Damaged
    • Events
    • Conditions
      • (Damage source) Equal to Critical_Striker
    • Actions
      • Set Critical_Striked_Pos = (Position of Critical_Striker)
      • Set Critical_Damage = ((Integer((Damage taken))) x 2)
      • Unit - Create 1 Footman for (Owner of Critical_Striker) at Critical_Striked_Pos facing Default building facing degrees
      • Unit - Cause (Last created unit) to damage (Triggering unit), dealing (Real(Critical_Damage)) damage of attack type Hero and damage type Normal
      • Floating Text - Create floating text that reads (String(Critical_Damage)+!) at Critical_Striked_Pos with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change the color of (Last created floating text) to (100.00%, 0.00%, 0.00%) with 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 50.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 2.50 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.75 seconds
      • Unit - Add Bloodlust to (Last created unit)
      • Unit - Set level of Bloodlust for (Last created unit) to (Level of Critical Strike for (Damage source))
      • Unit - Order (Last created unit) to Orc Shaman - Bloodlust (Damage source)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Set Critical_Striked = No unit
      • Set Critical_Striker = No unit
      • Custom script: call RemoveLocation(udg_Critical_Striked_Pos)
      • Trigger - Turn on Critical Strike <gen>
But there's a problem that it can have a 5k events, so :/

Again: You still don't actually need to hit with a melee attack in order for this to work. Unless I am mistaken I could, for example, try a melee attack, have it get evaded (or just cancel it with Stop), then flame strike the enemy, then crit with the flame strike instead of the melee attack that turned the damage trigger on.

And you suggest adding an order catch (for, say, "stop" or "starts casting flame strike"), that won't work *either,* because then you could have a DoT crit instead of the melee attack. For example, you could have *already* cast flame strike before beginning the attack, and the damage interval would come up after you begin animating the attack, but before you deal damage. Simply using "a unit is damaged" completely recklessly doesn't work. You have to know what it was actually damaged by.

What we need isn't damage detection, it's damage source detection, and I don't mean with the unit as the source, but the actual attack. As I said, the only way I know to do this is to use one of blizzard's abilities that gives a buff on attack (such as orbs), but that presents obvious problems in itself that I personally don't know how to fix.
 
Level 11
Joined
Feb 11, 2010
Messages
199
Hmm, I had no idea what Tiche3 just said. Isn't that great.


So you guys are saying that there's no way to detect a Crit OR any % chance skills?

As I already said, there is a way. You need to use orbs and detect when a unit receives the buff. I'm just not sure how to mitigate the "orbs don't stack" issue, but I'm sure other people do.

The problem here is people suggesting wrong solutions that outright break under such simple conditions as "A unit has Immolation."
 
Level 9
Joined
Jun 25, 2009
Messages
427
Well, I'm still trying to figure out how to do it well (searching through old threads and the like). If/when I do, I'll be sure to send you a message.

You may use critical strike, give it a buff, then add a duration with 0.01 and it mini mini mini mini mini stuns the opponent for 0.01 and places the buff, that's how you get the crit strike. If you add the duration to crit strike, whenever he crits, he stuns for the duration. :)
 
Level 11
Joined
Feb 11, 2010
Messages
199
You may use critical strike, give it a buff, then add a duration with 0.01 and it mini mini mini mini mini stuns the opponent for 0.01 and places the buff, that's how you get the crit strike. If you add the duration to crit strike, whenever he crits, he stuns for the duration. :)

A mini stun is still a big deal, it interrupts animations, actions, and such. If a fast attacking character is mini stunning on every attack... Well, I'm sure you can figure out the rest.
 
Level 11
Joined
Feb 11, 2010
Messages
199
Not on each attack :) Only when the critical %s :) And by the way, is 0.01 very long? Yup i guess so........

An interrupt is an interrupt, no matter how long. An interrupt is *very* conspicuous (and mechanically useful). So yes, even 0.01 is too long a stun, because it's not like it stops mid-animation then resumes its animation, it has to *start over again.*
 
Level 11
Joined
Feb 11, 2010
Messages
199
I don't get you. Whut?

He's saying "don't fix the code to do what you actually want, just make code that does something else and change the descriptions of your abilities to let people know about what it does." In this case, that your critical strike would interrupt actions instead of, you know, working like critical strike. Not terribly nice advice, I daresay, since it doesn't actually help you make the ability you asked for at all.

mayby this spell can help you?

Just so you know, the spell you linked is rejected because it doesn't function properly. That's kinda important.
 
Status
Not open for further replies.
Top