- Joined
- Jun 4, 2006
- Messages
- 127
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
-
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)
-
Loop - Actions
- Custom script: call DestroyGroup(udg_UnitGroupVar)
-
Else - Actions
- Trigger - Add to Critical Strike <gen> the event (Unit - (Triggering unit) Takes damage)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
> 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)
-
Critical Strike
- Events
-
Conditions
- (Level of Critical Strike for (Damage source)) Greater than 0
- (Damage taken) Greater than 0.00
- ((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%.
-
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 - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
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.
-
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
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
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.
-
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
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
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.
Last edited: