Word of warning: The critical strike I'm showing here just adds flat bonus damage, not a multiplier like 2x damage. You can search sc2mapster if you want that, it's more complex from what I found.
Anyway, here I show how to make your hero/unit have a % chance to deal bonus damage on attacks (and have a visual for it). You can follow the video or use the text version below (or both). The text version is rather dry but the video has actual explanations of why we do things.
Text version of tutorial:
(Assuming you are in a new map already)
Basic idea is a behavior buff on the hero that has the Damage Response+ field set so that when he attacks it'll (possibly) deal bonus damage.
Data Editor -> Behaviors tab.
Right click, add behavior. Name it Critical Strike and click Suggest. Type -> Buff.
Set Icon and Tooltip fields to whatever you like.
Alignment: set it to Positive.
Double Click the Combat - Damage Response+ field:
Chance: set to 0.35.
(this field is way below) Location: Attacker.
Now hit OK and switch to the Effects tab.
Right click, add new effect, name it "Critical Strike Damage" and hit suggest. Type: Damage.
Combat - Amount: 20.
Armor reduction: 1.
Kind: Ranged.
Flags: Notification.
Search Flags: Call for help, offset area by angle, offset by unit radius, same cliff level.
Go back to Behavior tab, click on our behavior (Critical Strike).
Go to the Damage Response+ field again (double click). Find the Handled field. Change the effect to be our Critical Strike Damage one.
Go to the Buttons tab, right click and add a button (name it Critical Strike and hit suggest and then OK). Set the Icon to whatever you wish. Set the Tooltip to be:
The Marine has a <d ref="100 *(Behavior,CriticalStrike,DamageResponse[0].Chance[0])"/>% chance to deal <d ref="Effect,CriticalStrikeDamage,Amount[0]"/> bonus damage.
Go to the Units tab, find Marine unit (or your unit), give this behavior to him in behavior-behaviors+ field. Also go to Ability - Command Card+ field, find a grid spot, click the green X to add a button, choose our critical strike button (search for it) and hit OK. Set the Command Type to Passive, and Behavior to Critical Strike. Hit OK.
Terrain Editor: Place Marine (player 1) and zerglings (player 15) on the field to test (in my case). In data I also increased marine hp to 5000 for testing.
Back in the Data editor:Actors tab. Right click, add actor. Name Critical Strike and suggest. Type: Model. Based on: BuffOneshot.
Set Art - Model = Zerg Small Unit Death.
Double click Event - Events+:
- Right click, add event.
- Msg type: Effect
- Source Name: Critical Strike Damage
- Sub Name: Start
- Now make the action be "Create". Hit OK.
Bonus (for overhead text of the crit amount)... see video for how to actually make this trigger:
Note, this ^ will not factor in buff bonuses on the critical damage effect. Doing this would involve a lot of work but it is doable. Involves looping through each behavior on the damaging unit and getting the 'catalog value' of the damage bonus (ranged) of that buff and adding it to the Full Damage var.
EDIT: I forgot that you can use 'triggering effect damage amount', and in place of my complicated value for Crit Damage variable, you could just add this amount to the base dmg for the full damage.
Yeah that would be a great title. It's funny because Blizz DOTA even did their critical strike through a trigger which just applied the unit's damage effect again to make it 2x. That has problems...
Word of warning: The critical strike I'm showing here just adds flat bonus damage, not a multiplier like 2x damage. You can search sc2mapster if you want that, it's more complex from what I found.
Anyway, here I show how to make your hero/unit have a % chance to deal bonus damage on attacks (and have a visual for it). You can follow the video or use the text version below (or both). The text version is rather dry but the video has actual explanations of why we do things.
Text version of tutorial:
(Assuming you are in a new map already)
Basic idea is a behavior buff on the hero that has the Damage Response+ field set so that when he attacks it'll (possibly) deal bonus damage.
Data Editor -> Behaviors tab.
Right click, add behavior. Name it Critical Strike and click Suggest. Type -> Buff.
Set Icon and Tooltip fields to whatever you like.
Alignment: set it to Positive.
Double Click the Combat - Damage Response+ field:
Chance: set to 0.35.
(this field is way below) Location: Attacker.
Now hit OK and switch to the Effects tab.
Right click, add new effect, name it "Critical Strike Damage" and hit suggest. Type: Damage.
Combat - Amount: 20.
Armor reduction: 1.
Kind: Ranged.
Flags: Notification.
Search Flags: Call for help, offset area by angle, offset by unit radius, same cliff level.
Go back to Behavior tab, click on our behavior (Critical Strike).
Go to the Damage Response+ field again (double click). Find the Handled field. Change the effect to be our Critical Strike Damage one.
Go to the Buttons tab, right click and add a button (name it Critical Strike and hit suggest and then OK). Set the Icon to whatever you wish. Set the Tooltip to be:
The Marine has a <d ref="100 *(Behavior,CriticalStrike,DamageResponse[0].Chance[0])"/>% chance to deal <d ref="Effect,CriticalStrikeDamage,Amount[0]"/> bonus damage.
Go to the Units tab, find Marine unit (or your unit), give this behavior to him in behavior-behaviors+ field. Also go to Ability - Command Card+ field, find a grid spot, click the green X to add a button, choose our critical strike button (search for it) and hit OK. Set the Command Type to Passive, and Behavior to Critical Strike. Hit OK.
Terrain Editor: Place Marine (player 1) and zerglings (player 15) on the field to test (in my case). In data I also increased marine hp to 5000 for testing.
Back in the Data editor: Actors tab. Right click, add actor. Name Critical Strike and suggest. Type: Model. Based on: BuffOneshot.
Set Art - Model = Zerg Small Unit Death.
Double click Event - Events+:
- Right click, add event.
- Msg type: Effect
- Source Name: Critical Strike Damage
- Sub Name: Start
- Now make the action be "Create". Hit OK.
Bonus (for overhead text of the crit amount)... see video for how to actually make this trigger:
Note, this ^ will not factor in buff bonuses on the critical damage effect. Doing this would involve a lot of work but it is doable. Involves looping through each behavior on the damaging unit and getting the 'catalog value' of the damage bonus (ranged) of that buff and adding it to the Full Damage var.
EDIT: I forgot that you can use 'triggering effect damage amount', and in place of my complicated value for Crit Damage variable, you could just add this amount to the base dmg for the full damage.
I would call this "Random Bonus damage with Visible Text" rather then crit..... but yeah
@SouLCarveRR: Go
Yeah that would be a great title. It's funny because Blizz DOTA even did their critical strike through a trigger which just applied the unit's damage effect again to make it 2x. That has problems...
@OneTwoSC: Go
Wait is blizz DOTA out?
By the way, nice tutorial once again :D
@zeldarules28: Go
Not out but someone extracted some data and found it out; I forget.