Right click and modify the object, give it something easy to remember by, not a big deal what you name it. We mostly need this for the damage effect itself (outlined in red). Change it to whatever you want, this copy will only be used for your critical strike ability. Once you're done, head over to the trigger editor.
Create a new trigger, and pick the event "Unit Takes Damage". Using this, we can detect when a unit is being damaged, and check what unit is damaging him. Do note that damage falls under several categories, such as melee, ranged, and spells. So you might need to create two instances if your unit acts as both ranged and melee,
After all of that, you're going to need to set some stuff up.
The first part, are our local variables. The first one, unit variable, "Hero" dictates which unit critical strike affects. Second one is simply an integer variable that randomizes between 0-100. Third and fourth one are the unit variables representing the attack and defender, attack variable is equal to the "damaging unit" and the defender variable is equal to the "triggering unit", meaning the unit that triggered this event will be stored here.
The next part is our conditions, random, will dictate when this condition is true. Random <= 14 represents a 15% crit chance, while Random <= 49 represents a 50% crit chance. This will generate a random number every time the trigger is initialized. (Note, you should probably set the random variable to some number that is not in the range after you've executed it).
The next part, the actions, the first three actions are simply for the red "2.0x" to show up. You will need Create Text Tag for the first one, Show Text Tag for the second one and Set Time of Text Tag for the third one, once done, this will show up "2.0x" every time the trigger fires. The last part is the actual damage. You want to use "Create Effect on Unit (From Unit)", and then link the effect that you created in the first part. This acts like a critical strike, only applying the damage. And there you have it! My only problem is chain crits, still looking for a way to put a cooldown on it.
NOTE: I'm not sure if memory leaks are still present in Starcraft II, but to be safe, add a 1.5 second wait after everything is done, and then destroy the last created tag / dark templar - critical strike effect to be safe, for now.
Things to do:
Linking critical strike to an ability (so that it can level up)
Attachments:
Post has been edited 6 time(s), last time on Apr 30 2010, 9:01 pm by Taylor Swift.
None.