Tutorial How to: Make Critical Strike work on spells and items (GUI)

denmax

You can change this now in User CP.
Reaction score
155
THIS POST SHOULD BE PUT AT THE JUNKYARD
SOMEONE ALREADY MADE A TUTORIAL ABOUT THIS​

INTRODUCTION

Ever thought of the idea "Hey, I want to make a Passive ability where both my attacks and spell damages are doubled, or tripled!" but then you are unable to do it?

Well then I have good news for you! I, denmax, have made this tutorial for you to make a passive ability where your attacks, spell damages, and even spell damages from items are multiplied to your wanting! This tutorial only shows a One Level Critical Strike, which only triples the damages the unit does.



THE ESSENTIALS​

First things is first. You should have a Damage Detection Trigger. You may ask "What's a Damage Detection Trigger?" Well a Damage Detection Trigger is a trigger where it's actions will try to add the "Takes damage" event to a specific trigger, which would be our Critical Strike ability.

Let's name this trigger: DDT
Trigger:
  • DDT
    • Events
      • Map initialization
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BooleanVar[1] Equal to False
        • Then - Actions
          • Set BooleanVar[1] = True
          • Set UnitGroupVar = (Units in (Playable map area))
          • Unit Group - Pick every unit in UnitGroupVar and do (Actions)
            • Loop - Actions
              • Trigger - Add to Critical Strike <gen> the event (Unit - (Picked unit) Takes damage)
          • Custom script: call DestroyGroup(udg_UnitGroupVar)
        • Else - Actions
          • Trigger - Add to Critical Strike <gen> the event (Unit - (Triggering unit) Takes damage)


Variables:
> UnitGroupVar = a unit group variable
> BooleanVar = a boolean variable


This trigger plainly tries to pick all preplaced units in the map. After so, it sets a boolean "True" so it doesn't have to pick all the same unit again and again, but then picks the units that enter the Playable Map Area. A simple saying would be, it allows all units in the map to have a possibility from the Critical Strike ability unless placed with a new condition.



THE TRIGGER​

Now we are on with the trigger itself. Let's start out by creating some variables.

>IntegerVar = a integer variable

We first have to set the conditions of the trigger. Remember that the DDT adds the event to this trigger which we will be calling Critical Strike..
The condition should check if the "Damage source" has Critical Strike. We also have to make sure that the Damage taken is greater than 0 to avoid multiplying 0 damage (which usually happens for some unknown reason)
Trigger:
  • Critical Strike
    • Events
    • Conditions
      • (Level of Critical Strike for (Damage source)) Greater than 0
      • (Damage taken) Greater than 0.00

If you would want the spell to "not work" on magic immune enemies then simply place in the conditions this command

Trigger:
  • ((Damage source) is Magic immune) not Equal to True



After applying this commands, we shall continue with the actions...
To start, we must make sure that the Critical Strike is done by chances. Let's say our chance is 15.00%.
Trigger:
  • Critical Strike
    • Events
    • Conditions
      • (Level of Critical Strike for (Damage source)) Greater than 0
      • (Damage taken) Greater than 0.00
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer between 1 and 100) Less than or Equal to 15
        • Then - Actions
        • Else - Actions

If you want to change the chances, you may change the value "15" under the If conditions to anything between 1 to 100.



The next step would be to do the damage. First we must Turn off the trigger. Do not worry, this will not malfunction the trigger one bit since we will be turning it on after all actions are done.
We must set the Integer Variable to the desired damage. I want the damage to be multiplied by 3.00.
Trigger:
  • Critical Strike
    • Events
    • Conditions
      • (Level of Critical Strike for (Damage source)) Greater than 0
      • (Damage taken) Greater than 0.00
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer between 1 and 100) Less than or Equal to 15
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Set IntegerVar = (Real((Damage taken) x 2.00))
          • Unit - Cause (Damage source) to damage (Triggering unit), dealing IntegerVar damage of attack type Hero and damage type Normal

If you want to change the critical multiplication, change the field in IntegerVar where there is 2.00 to any number. Remember that the damage is done first then is multiplied. So quite frankly, it multiplied the damage taken by 2, which is already taken by the target so it then takes 3 times the damage.
In logic: Damage taken by target (from the normal attack) + Damage that has been multiplied = Total damage



Now we need the Floating Text. The Floating text is the numbers that appear above a unit when it does a normal Critical Strike. The one in Evasion and obtaining gold is also called a Floating Text
The string value should be right. We need to convert the arithmetic of (Damage taken + (IntegerVar)). Let's also make sure that the Floating text is red. So 100% red and no other percentage for the other colors. We'll also disable its Permanent Status so it can fade and be destroyed (by lifespan). We'll also allow the Floating Text to move up while fading, like most floating text do.
Trigger:
  • Critical Strike
    • Events
    • Conditions
      • (Level of Critical Strike for (Damage source)) Greater than 0
      • (Damage taken) Greater than 0.00
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer between 1 and 100) Less than or Equal to 15
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Set IntegerVar = (Real((Damage taken) x 2.00))
          • Unit - Cause (Damage source) to damage (Triggering unit), dealing IntegerVar damage of attack type Hero and damage type Normal
          • Floating Text - Create floating text that reads (String(((Damage Taken) + IntegerVar)) + !) above (Damage source) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 90.00 towards 90.00 degrees
          • Trigger - Turn on (This trigger)
        • Else - Actions


IntegerVar, as you may know, is an integer variable. You must set it to a conversion to a real to have damage taken multiplied by 2.00 (but really, the total damage is 3.00 including the damage the unit has done with his attack, not with the trigger)

You may ask "Why do we have to go through an integer variable if we can just make a real variable instead?" Well, you may know that reals record the decimals within numbers in WCIII. If so, then when we show those numbers to the Floating Text, the decimals will be shown making it look very ugly. Integers, however, remove the decimals of a number thus making it look like the true Critical Strike floating texts.

Remember that the floating text of this type of Critical Strike is a multiplication of the true damage taken, not a multiplication of the ordinary damage of the Hero.


THINGS TO CONSIDER​

There are some things you have to put your attention on.

• In AoE (both spells and siege attack) and Waves multiplication of damages is by target, not by spell.
• I can't seem to make it multiply only spells or attacks. It has to multiply every damage dealt by a unit with the custom "Critical Strike".
• Floating Text appears above the Hero. If it makes multiple criticals in one time then multiple floating texts also appear above it.
• This ability is MUI
• You are able to rename the variables. If you are prepared to rename the unit group variable please be sure to edit the Custom script as well (udg_<your variable name>). Custom scripts are CASE SENSITIVE.
• Please do not remove the "Turn off" and "Turn on" triggers from the Critical Strike trigger. This keeps the trigger from infinite loops.
• You are able to recolor the Floating Texts or even change the string value. It may not be the damage but also something humorous or anything of your wanting.
• There are no problems in renaming your triggers as well
• Unauthorized duplication and copying of this tutorial is supported. I don't care about credit. The only thing I care about is the idea that I have helped people.
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
I think this is waaaay to simple to be considered as a system or something...
you haven't told us anything we haven't knew before :/

it's just a normal damage detection...

For your trigger, at the condition, it should not be damaged source but attacking unit?
it's not Damaged source, it's Damage source

he did it correctly... it wouldn't run with the attacking unit since 'Attacking unit' only responses to "Unit is attacked" event

EDIT: damn I feel so rude today :D
 

Romek

Super Moderator
Reaction score
963
You don't really explain things much.
A tutorial should explain, step by step what you are doing, and why.
"Next, make this trigger:" does not suffice.

This is a detailed explanation of how to import a custom spell in my opinion.
 

denmax

You can change this now in User CP.
Reaction score
155
You don't really explain things much.
A tutorial should explain, step by step what you are doing, and why.
"Next, make this trigger:" does not suffice.

This is a detailed explanation of how to import a custom spell in my opinion.

Well then..

I should retype this..

Quite frankly there is a very simple solution XD..
 

Chocobo

White-Flower
Reaction score
409
Triple damage but shows Double damage?

Trigger:
  • Show Damages
    • Events
    • Conditions
    • Actions
      • Set loc = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Damage source) has buff Evasion ) Equal to True
        • Then - Actions
          • Set RandomInt = (Random real number between 2.00 and 4.00)
          • -------- Damage Multiplier --------
          • Set CriticalMultiplier = RandomInt
          • -------- Random Percentage --------
          • Set RandomReal = (Random real number between 0.00 and 100.00)
          • -------- Critical Percentage --------
          • Set CriticalPercentage = 15.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomReal Less than CriticalPercentage
        • Then - Actions
          • -------- DamageDealt is a real which handles the whole damage dealt --------
          • Set DamageDealt = ((Damage taken) x CriticalMultiplier)
          • -------- Anti-Infinite Loop --------
          • Trigger - Turn off (This trigger)
          • Unit - Cause (Damage source) to damage (Triggering unit), dealing (DamageDealt - (Damage taken)) damage of attack type Chaos and damage type Universal
          • Trigger - Turn on (This trigger)
          • -------- Shows a Red Floating Text --------
          • Floating Text - Create floating text that reads ((String((Integer(DamageDealt)))) + !) at loc with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
        • Else - Actions
          • -------- If No Critical it does a white message --------
          • Floating Text - Create floating text that reads ((String((Integer(DamageDealt)))) + !) at loc with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds


http://www.thehelper.net/forums/showthread.php?t=40355
 

denmax

You can change this now in User CP.
Reaction score
155
Triple damage but shows Double damage?

Trigger:
  • Show Damages
    • Events
    • Conditions
    • Actions
      • Set loc = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Damage source) has buff Evasion ) Equal to True
        • Then - Actions
          • Set RandomInt = (Random real number between 2.00 and 4.00)
          • -------- Damage Multiplier --------
          • Set CriticalMultiplier = RandomInt
          • -------- Random Percentage --------
          • Set RandomReal = (Random real number between 0.00 and 100.00)
          • -------- Critical Percentage --------
          • Set CriticalPercentage = 15.00
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomReal Less than CriticalPercentage
        • Then - Actions
          • -------- DamageDealt is a real which handles the whole damage dealt --------
          • Set DamageDealt = ((Damage taken) x CriticalMultiplier)
          • -------- Anti-Infinite Loop --------
          • Trigger - Turn off (This trigger)
          • Unit - Cause (Damage source) to damage (Triggering unit), dealing (DamageDealt - (Damage taken)) damage of attack type Chaos and damage type Universal
          • Trigger - Turn on (This trigger)
          • -------- Shows a Red Floating Text --------
          • Floating Text - Create floating text that reads ((String((Integer(DamageDealt)))) + !) at loc with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
        • Else - Actions
          • -------- If No Critical it does a white message --------
          • Floating Text - Create floating text that reads ((String((Integer(DamageDealt)))) + !) at loc with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds

http://www.thehelper.net/forums/showthread.php?t=40355

I just realized it before you posted this o_O..

And I didn't know you had a post like this..

I guess this post should be closed then..

Bah I don't really care =P.. I only posted this to help people but I guess someone made a tutorial first about this.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top