Chocobo
White-Flower
- Reaction score
- 409
This tutorial will show you how to show the damage dealt by all the units, and most of varients used by it (Critical Strike, Damage Bonus, Delay Damage, Evasion, Damage Combo..)
Damage Combo is the hardest part, you must use WEU and enable Advanced Triggers, to allow the utilisation of Custom Real Values.
Note: Requires TFT Editor
1. What is damages?
Damages are what causes unit to have their healthbar lowered, and also to cause their death when they haven't enough life to resist to the damage dealt.
1.1 Show Damage Dealt
We will use WEU to show the damage dealt by all units, in a Floating Text. Floating Texts are texts that stands until they have a specific function that orders them to have a velocity towards a degree, to be hidden for certain players, to have a specific lifespan to get cleaned, and to have a fading age to order the text to fade over a fixed amount of time.
Here is the triggers to show the Damage Dealt by all units.
I strongly recommand you to read the Tutorial by Daelin localted here : Variables in Detail
Why? Because there is a leak that appears whenever the trigger fires : The Location.
1.2 How to remove the Location Leak, and what are leaks?
1.21 What are leaks?
Most of people heard about leaks, but most of them does not know why they appear. We will explain why they appear.
1.22 When Leaks appears?
All know the computer can not handle infinite amount of Virtual Memory until it crashes (RAM = 0). We know that if something is created on the playable map, it will increase your memory size a bit, and if you combine them, it will create a small size of around 4 kb/thing in the map (Sometimes 512 bytes, 1 kb, or 2 kb).
Leaks appear when you use an Action (Function), example :
As we see, there seems to be no leaks, but if we go to (Center of (Rect 000 <gen>)), it returns a location, which is equal to ((MinX+MaxX)/2);((MinY+MaxY)/2).
The Value is stored with a path to the Virtual Memory, and will consume in size.
Most of functions returns a path to the handle (Units, Destructables, Items..), that won't be used later.. it will still there and will do nothing, and also, it will increase exit time.
A location returns 2 reals, X and Y, which indicates the point of the unit.
A real takes 4 bytes and are called Floats.
Space taken by Variables
If we count, a location is 2 reals, so it returns 8 bytes in the Virtual Memory.
It seems hilarious, don't you think? You can wonder if 8 bytes requires to be cleaned because of its small size. The answer is : Yes.
Read the part 1.25 for the reason.
1.23 How to clean the Leak?
To clean the leak, we will use a Global Variable (Go in Variable, the X thing in the Trigger Editor).
We will use a location variable to clean up the leak.
Now, there is no leak. We have used a location Variable to store the center of the rect 000, then because it returns a location that is not created by an another function, it won't store to the Virtual Memory.
1.24 What type of leaks there can be?
Possible Leaks : Example : Size Taken : Removable Leak?
Location : (Center of (Rect 000 <gen>)) : 8 bytes : Can be removed
Unit Groups : (Pick Every Units in (Playable map area)) : 32 bytes*Amount of picked units IF bj_wantDestroyGroup = false (Will be clarified at end of this) : Can be removed
Strings : Display to (Triggering player) the text : ((Name of (Triggering Player) + has been killed.) : Size depends on size of the string : Can not be cleared
Booleans : ((Triggering unit) is dead) Equal to False : 1 bit (1/32 bytes, very small and rarely affects Virtual Memory)
Most of them can be cleared via setting a variable to what you want, then to do the action with that variable, but only strings ever leaks.
Only Integers, Reals do not leak, but if you use Random integr/real between A and B, it will leak.
1.25 Why would I clear leaks if there is only one? (Or two)
Good Question. Lets say we uses a Slide Trigger.
All Leaks are bolded and underlined.
This creates a group (As we know, it leaks if we do not set it in a variable), which won't be cleared until you exit the game. You know that a unit takes 32 bytes in a Group, so lets take an example, that there are 500 units that matches conditions, and only 100 units pass, we will have 3200 bytes created every 0,03 seconds.
You know why it leaks. It does a Polar Offset, which moves instantly the unit with an offset of 11.00, and a toward of its facing. As we see, it creates 2 locations, so it takes 16 bytes, and for 100 units, it does a total of 1600 bytes every 0,03 seconds, equal to 200 locations.
If we calculate, it does : (3200*(1/0,33))+(1600*(1/0,33)) = Around 14545,45455... bytes = 13,87925052... kb
You may say "13 kb is small", but if you repeat it over 1 hour (3600 seconds), the result becomes really bigger : 3600*((3200*(1/0,33))+(1600*(1/0,33))) = 52363636,36.. bytes = 51136,36364... kb = 49,9378511.. mb, it starts become big... so its why we should clean up leaks.
That is the new trigger. But you may say, "THERE STILL THE BIG LEAK", but not. The script at the top is :
You may say : "What is that?? HAX OMG", it is a fix for the function called ForGroupBJ (Pick Every Units in ..), which if bj_wantDestroyGroup is equal to true, it destroys the created group so it does not leak.
You may say again : "What is that?? FFS I DON'T UNDERSTAND", it destroys the location that has been set to array variable Position.
And again : "WOA WHAT'S THAT??", udg_ means ; "User Defined Global", then it suits with the name of the global variable.
1.3 Cleaned Leak in Show Damage Text
Here is the trigger without the leak.
Finished with that. Lets go working with its varients.
2.0 Sidenote
For all next triggers, there must be the Register Units trigger.
2.1 A Critical Strike Varient
Note : The Critical Strike Varient affects Spells that deal damages, and also splash attacks.
We will learn how to do a Critical Strike Varient, which has 15% chance to deal 2x to 4x damage (In real, so 2, 3 or 4x like 2,01x, 2,02x..). To do that, we will create an aura based on Brillance Aura that does nothing and has a Custom Buff called Critical Strike.
Here is the code :
Finished. If you want to customize it, you can use multiples buffs, then copy and paste original IF THEN ELSE that fixes all values.
We will not work on Evasion.
2.2 An Evasion varient.
Note : Like the Critical Strike, this Evasion style may evade Spells. And also, if the must die and evaded the attack, it will die.
We will now learn how to make a Evasion varient. For that, we will create (again) an ability based on Brillance Aura, and we give it a custom buff called Evasion, which gives 35% chance to evade an attack.
Here is the code :
This trigger is now finished.
2.3 A Damage Bonus Ability combined with Hardened Skin Ability, triggered
Note : Like the Critical Strike, this Hardened Skin may reduce damage from Spells.
Again, we create 2 ability based on Brillance Aura with no effect, the first one with Damage Bonus buff, and the second one with Hardened Skin buff (Create them). Lets say, the Damage Bonus increases damage dealt by 50 with 25% chance, and Hardened Skin reduces damage by 35 with 80% chance.
Here the whole trigger :
Damage Bonuses and Hardened Skin is now finished.
2.4 Delay Damage Style
The power of the Delay Damage (Called in reality Venom or Slow Poison) requires a little knowledge of JASS Scripts (Local Variables). We will use locals in Half-GUI Mode (Locals assigned as Globals but are Locals), to try to make a Venom Strike from 65% damage to 110% damage with a factor 0,33 seconds for 5% (70, 75, 80, 85, 90..., 105, 110), it ends over 9 loops (around 3 sec)
First, we will again create an ability based on Brillance Aura without the mana regeneration bonus, and with a custom buff we will call Delay Damage. Then you add the Ability to your unit you want to perform the Delay Damage. (Can be assigned to Multiple Units)
Second, you just write the code.
The Trigger is now finished.
2.5 Damage Combo Styles
There are 2 Combo Styles. The first one is damage dealt depending on target's percentage life, and the second is the damage dealt depending on a real combo. The first one can be easily done whereas the second will require 2 Unit's Custom Value, and so it requires WEU.
2.51 Damage Combo Style 1
The Damage Dealt to the target would easily known, the Algorithm is (100 - (Percentage life of target) - 100).
Example, a unit has 25% life, it will take (100 - (25 - 100)) = (100 - (-75)) = 175% of damages.
Here is the trigger :
This trigger can be easily modified for higher or lesser damage dealt.
This is the part you can modify. You can change the 100 value to a lesser value for higher damage, or to a higher value for lesser damage.
Example, you changed 100 to 50. The target had only 25% life when it took the damage (175% of total damage normally). In total, the unit will take ((175 / 50) x (Damage taken)) = ((3.50) x (Damage taken)) = 350% of damage dealt.
An another example, you changed 100 to 150. Again, the target had 25% life, the damage % would be ((175 / 150) x (Damage taken)) = 116.66..7% of damage taken.
Sidenote : If you increase the value of 100 to a higher value, the unit may take negative damages, so it will heal. Simply create a condition, and if the Variable DamageDealt is lesser than Damage taken, then order the trigger to do nothing, else Unit - Cause damage..
2.52 Damage Combo Style 2
An unvaluable trigger for PvP Games or NcpvP. I will explain the trigger at the bottom of it and how it works. Note, it requires Unit's Custom Value, Unit's Custom Real, and Unit's Custom Boolean.
I will explain each part of the trigger.
This first part sets the Custom Value of the target to its value +1. We use a Condition because sometimes the Custom Value goes to a value lesser than 0.
It also determines how many the target will take in percentage later.
This part should be clear : It changes target's Custom Boolean value to True.
If True = Damage Combos On
If False = Damage Combos Off
When the target's custom value is greater than 1, it allows the source to do attacks that do more damages. To change the damage dealt, you simply change the 20.00 to your own value. After, it changes target's custom real value to its old value + DamageDealt. If you want to show the total combo damage, you must change the next floating text.
Lesser Value of 20.00 = Higher Damage
Higher Value of 20.00 = Lesser Damage
Floating Text to do how many Combos done, you can modify to show the damage combo done to :
It returns a text like that : Combo 1 (15)
So : Combo X (Y)
X = Actual Combo Chain
Y = Damage Chain
Shows the Damage Dealt in total (Not the Combo Damage).
When a Combo is dealt, Damage taken should be lesser than DamageDealt (Sometimes not if you wrong value for the "20.00"). If yes, this trigger does extra damages to the target.
After 1 second, it changes target's custom value to its old value -1, and if it is equal to 0 after the fix, the combo ends, the Boolean goes to False, and the real value to 0. You can change the delay (Wait 1.00 seconds) to a lesser value if you want. More the value is less, more the combo is harder to be performed, and more the value is high, more it is easier to do a combo.
2.6 Thorns Aura Style
You all know what Thorns Aura does. Whenever a melee unit attacks a unit, it takes returned damage depending on the damage dealt. Maybe you want to modify it to have a random percentage. You may do that easily with that trigger, only one part to modify as you want.
You can change the Thorn Factor, which handles the percentage of the damage dealt. Here, its value is 0.25, you can change it to have a higher returned damage if you increase its value, and vice-versa. For 0.25, it does 25%. For 1.00, it does 100%. This style of Thorns Aura returns directly damages from melee (Ignores if ranged) in a range of 100, ignoring damage source's attack range.
2.7 Vampiric Aura Style
Working like the Thorns Aura Style, the Vampiric Aura can be again easily done with triggers.
You can change the StoleFactor value which handles percentage to a higher value for higher steal, and also you can add a special effect. Example, a unit deals 50 damage, if StoleFactor = 0.25, it returns (50*0.25) HP, so : 12.5 Hp.
The Algorithm is : (Damage Dealt * StoleFactor) = Stole Health
2.8 Frenzy Style
Later, no time for the moment.. sorry.
Known Issues
Pre-Placed Units
Those triggers posted does not acquire pre-placed units in the map, you may (Should?) use this trigger :
The Map didn't work after optimization of Vexorian's Optimizer (3.9d)
Be sure to check the Force UpperCase Names, else Half-GUI Mode will screw up your map. This only applies to Delay Damage Style.
I hope this is clear for you, this tutorial ends for the moment.
Will be Added to the tutorial
Will be added later : Frenzy Attacks Style.
Frenzy Attacks Style will contain : A demo map and how is it used (Requires a leveled Endurance Aura), from 1% attack speed bonus to a huge bonus, which lowers until go back to 0%. I mean, when you attack a unit, and if you do a combo, you get an extra attack speed until a limited a time.
Have fun with it.
Fixed Problems
- Delay Damage was infinite loop
- Delay Damage can use Loops
A small note
Because the file limit is reached, you may find the other files at the post 16.
You can find it here : Post 16
Or at : http://www.thehelper.net/forums/attachment.php?attachmentid=6379&d=1157543387 (7 files)
Damage Combo is the hardest part, you must use WEU and enable Advanced Triggers, to allow the utilisation of Custom Real Values.
Note: Requires TFT Editor
1. What is damages?
Damages are what causes unit to have their healthbar lowered, and also to cause their death when they haven't enough life to resist to the damage dealt.
1.1 Show Damage Dealt
We will use WEU to show the damage dealt by all units, in a Floating Text. Floating Texts are texts that stands until they have a specific function that orders them to have a velocity towards a degree, to be hidden for certain players, to have a specific lifespan to get cleaned, and to have a fading age to order the text to fade over a fixed amount of time.
Here is the triggers to show the Damage Dealt by all units.
Code:
Detect Unit
Events
Unit - A unit enters (Playable map area)
Conditions
Actions
Trigger - Add to Show Damages <gen> the event (Unit - (Triggering unit) Takes damage)
Code:
Show Damages
Events
Conditions
Actions
Floating Text - Create floating text that reads ((String((Integer((Damage taken))))) + !) at (Position of (Triggering unit)) 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
I strongly recommand you to read the Tutorial by Daelin localted here : Variables in Detail
Why? Because there is a leak that appears whenever the trigger fires : The Location.
1.2 How to remove the Location Leak, and what are leaks?
1.21 What are leaks?
Most of people heard about leaks, but most of them does not know why they appear. We will explain why they appear.
1.22 When Leaks appears?
All know the computer can not handle infinite amount of Virtual Memory until it crashes (RAM = 0). We know that if something is created on the playable map, it will increase your memory size a bit, and if you combine them, it will create a small size of around 4 kb/thing in the map (Sometimes 512 bytes, 1 kb, or 2 kb).
Leaks appear when you use an Action (Function), example :
Code:
Unit - Create 1 Footman for Player 1 (Red) at (Center of (Rect 000 <gen>)) facing Default building facing degrees
As we see, there seems to be no leaks, but if we go to (Center of (Rect 000 <gen>)), it returns a location, which is equal to ((MinX+MaxX)/2);((MinY+MaxY)/2).
The Value is stored with a path to the Virtual Memory, and will consume in size.
Most of functions returns a path to the handle (Units, Destructables, Items..), that won't be used later.. it will still there and will do nothing, and also, it will increase exit time.
A location returns 2 reals, X and Y, which indicates the point of the unit.
A real takes 4 bytes and are called Floats.
Space taken by Variables
If we count, a location is 2 reals, so it returns 8 bytes in the Virtual Memory.
It seems hilarious, don't you think? You can wonder if 8 bytes requires to be cleaned because of its small size. The answer is : Yes.
Read the part 1.25 for the reason.
1.23 How to clean the Leak?
To clean the leak, we will use a Global Variable (Go in Variable, the X thing in the Trigger Editor).
We will use a location variable to clean up the leak.
Code:
Set location = (Center of (Rect 000 <gen>))
Unit - Create 1 Footman for Player 1 (Red) at location facing Default building facing degrees
Now, there is no leak. We have used a location Variable to store the center of the rect 000, then because it returns a location that is not created by an another function, it won't store to the Virtual Memory.
1.24 What type of leaks there can be?
Possible Leaks : Example : Size Taken : Removable Leak?
Location : (Center of (Rect 000 <gen>)) : 8 bytes : Can be removed
Unit Groups : (Pick Every Units in (Playable map area)) : 32 bytes*Amount of picked units IF bj_wantDestroyGroup = false (Will be clarified at end of this) : Can be removed
Strings : Display to (Triggering player) the text : ((Name of (Triggering Player) + has been killed.) : Size depends on size of the string : Can not be cleared
Booleans : ((Triggering unit) is dead) Equal to False : 1 bit (1/32 bytes, very small and rarely affects Virtual Memory)
Most of them can be cleared via setting a variable to what you want, then to do the action with that variable, but only strings ever leaks.
Only Integers, Reals do not leak, but if you use Random integr/real between A and B, it will leak.
1.25 Why would I clear leaks if there is only one? (Or two)
Good Question. Lets say we uses a Slide Trigger.
Code:
Ice Slide
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in [B][U](Units in (Playable map area) matching ((((Owner of (Matching unit)) controller) Equal to User) and ((Terrain type at (Position of (Matching unit))) Equal to Icecrown Glacier - Ice)))[/U][/B] and do (Actions)
Loop - Actions
Unit - Move (Picked unit) instantly to [B][U]((Position of (Picked unit)) offset by 11.00 towards (Facing of (Picked unit)) degrees)[/U][/B]
All Leaks are bolded and underlined.
Code:
(Units in (Playable map area) matching ((((Owner of (Matching unit)) controller) Equal to User) and ((Terrain type at (Position of (Matching unit))) Equal to Icecrown Glacier - Ice)))
This creates a group (As we know, it leaks if we do not set it in a variable), which won't be cleared until you exit the game. You know that a unit takes 32 bytes in a Group, so lets take an example, that there are 500 units that matches conditions, and only 100 units pass, we will have 3200 bytes created every 0,03 seconds.
Code:
Unit - Move (Picked unit) instantly to [B][U]((Position of (Picked unit)) offset by 11.00 towards (Facing of (Picked unit)) degrees)[/U][/B]
You know why it leaks. It does a Polar Offset, which moves instantly the unit with an offset of 11.00, and a toward of its facing. As we see, it creates 2 locations, so it takes 16 bytes, and for 100 units, it does a total of 1600 bytes every 0,03 seconds, equal to 200 locations.
If we calculate, it does : (3200*(1/0,33))+(1600*(1/0,33)) = Around 14545,45455... bytes = 13,87925052... kb
You may say "13 kb is small", but if you repeat it over 1 hour (3600 seconds), the result becomes really bigger : 3600*((3200*(1/0,33))+(1600*(1/0,33))) = 52363636,36.. bytes = 51136,36364... kb = 49,9378511.. mb, it starts become big... so its why we should clean up leaks.
Code:
Events
Game - Every 0.04 seconds of game-time //0.04 is enough for a fluid action and a less lag to around 0.3 sec instead of 0.5 with 0.03
Conditions
None
Actions
Custom Script : set bj_wantDestroyGroup = true
Pick Every Units in (Units in (Playable map area) matching ((Terrain type at (Position of (Matching unit)) Equal to Icecrown Glacier - Ice) and do Actions
Set Position[1] = (Position of (Picked unit))
Set Facing = (Facing of (Picked unit))
Set Position[2] = (Position[1] offset by <Whatever you want> towards Facing degrees)
Unit - Move instantly (Picked unit) to (Position[2])
Custom script: call RemoveLocation(udg_Position[1])
Custom script: call RemoveLocation(udg_Position[2])
That is the new trigger. But you may say, "THERE STILL THE BIG LEAK", but not. The script at the top is :
Code:
Custom Script : set bj_wantDestroyGroup = true
You may say : "What is that?? HAX OMG", it is a fix for the function called ForGroupBJ (Pick Every Units in ..), which if bj_wantDestroyGroup is equal to true, it destroys the created group so it does not leak.
Code:
Custom script: call RemoveLocation(udg_Position[1])
Custom script: call RemoveLocation(udg_Position[2])
You may say again : "What is that?? FFS I DON'T UNDERSTAND", it destroys the location that has been set to array variable Position.
Code:
udg_
And again : "WOA WHAT'S THAT??", udg_ means ; "User Defined Global", then it suits with the name of the global variable.
1.3 Cleaned Leak in Show Damage Text
Here is the trigger without the leak.
Code:
Detect Unit
Events
Unit - A unit enters (Playable map area)
Conditions
Actions
Trigger - Add to Show Damages <gen> the event (Unit - (Triggering unit) Takes damage)
Code:
Show Damages
Events
Conditions
Actions
Set loc = (Position of (Triggering unit))
Floating Text - Create floating text that reads ((String((Integer((Damage taken))))) + !) 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
Finished with that. Lets go working with its varients.
2.0 Sidenote
For all next triggers, there must be the Register Units trigger.
2.1 A Critical Strike Varient
Note : The Critical Strike Varient affects Spells that deal damages, and also splash attacks.
We will learn how to do a Critical Strike Varient, which has 15% chance to deal 2x to 4x damage (In real, so 2, 3 or 4x like 2,01x, 2,02x..). To do that, we will create an aura based on Brillance Aura that does nothing and has a Custom Buff called Critical Strike.
Here is the code :
Code:
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
Finished. If you want to customize it, you can use multiples buffs, then copy and paste original IF THEN ELSE that fixes all values.
We will not work on Evasion.
2.2 An Evasion varient.
Note : Like the Critical Strike, this Evasion style may evade Spells. And also, if the must die and evaded the attack, it will die.
We will now learn how to make a Evasion varient. For that, we will create (again) an ability based on Brillance Aura, and we give it a custom buff called Evasion, which gives 35% chance to evade an attack.
Here is the code :
Code:
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
-------- Random Chance --------
Set RandomReal = (Random real number between 0.00 and 100.00)
-------- Chance to Evade --------
Set EvasionChance = 35.00
Else - Actions
Set DamageDealt = (Damage taken)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomReal Less than EvasionChance
Then - Actions
-------- Heals the unit --------
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + DamageDealt)
-------- Show "miss" text --------
Floating Text - Create floating text that reads miss 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 Evasion 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
This trigger is now finished.
2.3 A Damage Bonus Ability combined with Hardened Skin Ability, triggered
Note : Like the Critical Strike, this Hardened Skin may reduce damage from Spells.
Again, we create 2 ability based on Brillance Aura with no effect, the first one with Damage Bonus buff, and the second one with Hardened Skin buff (Create them). Lets say, the Damage Bonus increases damage dealt by 50 with 25% chance, and Hardened Skin reduces damage by 35 with 80% chance.
Here the whole trigger :
Code:
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 Damage Bonus ) Equal to True
Then - Actions
-------- Bonus Damage Dealt --------
Set DamageBonus = 50.00
-------- Random Chance, we use an array because there are 2 differants skills. Hardened Skin may override it. --------
Set RandomReal[1] = (Random real number between 0.00 and 100.00)
-------- Chance to perform Damage Bonus --------
Set BonusPercentage = 25.00
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Damage source) has buff Hardened Skin ) Equal to True
Then - Actions
-------- Bonus Damage Dealt --------
Set DamageReduce = 35.00
-------- Random Chance --------
Set RandomReal[2] = (Random real number between 0.00 and 100.00)
-------- Chance to perform Hardened Skin --------
Set SkinPercentage = 80.00
Else - Actions
-------- Give a value to DamageDealt --------
Set DamageDealt = (Damage taken)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomReal[1] Less than BonusPercentage
Then - Actions
-------- Give a value to DamageDealt from its original value. --------
Set DamageDealt = (DamageDealt + DamageBonus)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
RandomReal[2] Less than SkinPercentage
Then - Actions
-------- Give a value to DamageDealt from its old value. --------
Set DamageDealt = (DamageDealt - DamageReduce)
Else - Actions
-------- Damage Bonus part --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Damage taken) Less than DamageDealt
Then - Actions
-------- 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)
Else - Actions
-------- Hardened Skin part --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Damage taken) Greater than DamageDealt
Then - Actions
-------- Heal --------
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Damage taken) - DamageDealt))
Else - Actions
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
Damage Bonuses and Hardened Skin is now finished.
2.4 Delay Damage Style
The power of the Delay Damage (Called in reality Venom or Slow Poison) requires a little knowledge of JASS Scripts (Local Variables). We will use locals in Half-GUI Mode (Locals assigned as Globals but are Locals), to try to make a Venom Strike from 65% damage to 110% damage with a factor 0,33 seconds for 5% (70, 75, 80, 85, 90..., 105, 110), it ends over 9 loops (around 3 sec)
First, we will again create an ability based on Brillance Aura without the mana regeneration bonus, and with a custom buff we will call Delay Damage. Then you add the Ability to your unit you want to perform the Delay Damage. (Can be assigned to Multiple Units)
Second, you just write the code.
Code:
Show Damages
Events
Conditions
Actions
Custom script: local unit udg_LocalSource
Custom script: local real udg_LocalDamageFactor
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 Delay Damage ) Equal to True
Then - Actions
-------- 0.65 means 65% of total damage dealt --------
Set DamageDealt = ((Damage taken) x 0.65)
-------- 0.05 means 5% of total damage dealt --------
Set DamageFactor = ((Damage taken) x 0.05)
Else - Actions
-------- Does not have the Delay Damage buff, ignore Then actions and do instantly the Else Action without other actions. --------
Floating Text - Create floating text that reads ((String((Integer((Damage taken))))) + !) 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
Skip remaining actions
-------- We replace local values to their equivalent as global variable. --------
Set LocalSource = (Damage source)
Set LocalDamageFactor = DamageFactor
-------- Heal. --------
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Damage taken) - DamageDealt))
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
-------- Loop 9 Times --------
For each (Integer A) from 1 to 9, do (Actions)
Loop - Actions
-------- LOOP (Integer A) --------
Wait 0.33 seconds
Set loc = (Position of (Triggering unit))
Trigger - Turn off (This trigger)
Unit - Cause LocalSource to damage (Triggering unit), dealing LocalDamageFactor damage of attack type Chaos and damage type Universal
Trigger - Turn on (This trigger)
Floating Text - Create floating text that reads ((String((Integer(LocalDamageFactor)))) + !) 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
-------- END --------
-------- Nullify the unit variable --------
Set LocalSource = No unit
The Trigger is now finished.
2.5 Damage Combo Styles
There are 2 Combo Styles. The first one is damage dealt depending on target's percentage life, and the second is the damage dealt depending on a real combo. The first one can be easily done whereas the second will require 2 Unit's Custom Value, and so it requires WEU.
2.51 Damage Combo Style 1
The Damage Dealt to the target would easily known, the Algorithm is (100 - (Percentage life of target) - 100).
Example, a unit has 25% life, it will take (100 - (25 - 100)) = (100 - (-75)) = 175% of damages.
Here is the trigger :
Code:
Show Damages
Events
Conditions
Actions
Set loc = (Position of (Triggering unit))
-------- Calculate Percentage Dealt in percentage. --------
Set DamageDealt = (100.00 - ((Percentage life of (Triggering unit)) - 100.00))
-------- Returns Damage Dealt depending on the real variable DamageDealt. --------
Set DamageDealt = ((DamageDealt / 100.00) x (Damage taken))
-------- Deal Extra Damage --------
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 the 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%, 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
This trigger can be easily modified for higher or lesser damage dealt.
Code:
-------- Returns Damage Dealt depending on the real variable DamageDealt. --------
Set DamageDealt = ((DamageDealt / 100.00) x (Damage taken))
This is the part you can modify. You can change the 100 value to a lesser value for higher damage, or to a higher value for lesser damage.
Example, you changed 100 to 50. The target had only 25% life when it took the damage (175% of total damage normally). In total, the unit will take ((175 / 50) x (Damage taken)) = ((3.50) x (Damage taken)) = 350% of damage dealt.
An another example, you changed 100 to 150. Again, the target had 25% life, the damage % would be ((175 / 150) x (Damage taken)) = 116.66..7% of damage taken.
Sidenote : If you increase the value of 100 to a higher value, the unit may take negative damages, so it will heal. Simply create a condition, and if the Variable DamageDealt is lesser than Damage taken, then order the trigger to do nothing, else Unit - Cause damage..
2.52 Damage Combo Style 2
An unvaluable trigger for PvP Games or NcpvP. I will explain the trigger at the bottom of it and how it works. Note, it requires Unit's Custom Value, Unit's Custom Real, and Unit's Custom Boolean.
Code:
Show Damages
Events
Conditions
Actions
Set loc = (Position of (Triggering unit))
Set DamageDealt = (Damage taken)
-------- Fixes Custom Values of the target. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Less than or equal to 0
Then - Actions
Unit - Set the custom value of (Triggering unit) to 1
Else - Actions
Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) + 1)
-------- The Boolean Custom Value means if the target is available to an another combo. --------
Advanced - Set the custom boolean value for (Triggering unit) to True
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Not equal to 1
Then - Actions
-------- Combo Damage --------
Set DamageDealt = ((Damage taken) x (((Real((Custom value of (Triggering unit)))) - 1.00) / 20.00))
-------- Combo Dealt (Total Damage of a Combo) --------
Advanced - Set the custom real value for (Triggering unit) to (((Triggering unit)'s custom real value) + DamageDealt)
Floating Text - Create floating text that reads (Combo + (String((Custom value of (Triggering unit))))) at (Point(((X of loc) + 10.00), (Y of loc))) with Z offset 0.00, using font size 6.00, color (100.00%, 0.00%, 0.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
Else - Actions
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
-------- Extra Damage Part --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DamageDealt Greater than (Damage taken)
Then - Actions
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)
Else - Actions
-------- Delay before Combo ends --------
Wait 1.00 seconds
Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Equal to 0
Then - Actions
-------- End of Combo. --------
Advanced - Set the custom boolean value for (Triggering unit) to False
Advanced - Set the custom real value for (Triggering unit) to 0.00
Else - Actions
I will explain each part of the trigger.
Code:
-------- Fixes Custom Values of the target. --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Less than or equal to 0
Then - Actions
Unit - Set the custom value of (Triggering unit) to 1
Else - Actions
Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) + 1)
This first part sets the Custom Value of the target to its value +1. We use a Condition because sometimes the Custom Value goes to a value lesser than 0.
It also determines how many the target will take in percentage later.
Code:
-------- The Boolean Custom Value means if the target is available to an another combo. --------
Advanced - Set the custom boolean value for (Triggering unit) to True
This part should be clear : It changes target's Custom Boolean value to True.
If True = Damage Combos On
If False = Damage Combos Off
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Not equal to 1
Then - Actions
-------- Combo Damage --------
Set DamageDealt = ((Damage taken) x (((Real((Custom value of (Triggering unit)))) - 1.00) / 20.00))
-------- Combo Dealt (Total Damage of a Combo) --------
Advanced - Set the custom real value for (Triggering unit) to (((Triggering unit)'s custom real value) + DamageDealt)
When the target's custom value is greater than 1, it allows the source to do attacks that do more damages. To change the damage dealt, you simply change the 20.00 to your own value. After, it changes target's custom real value to its old value + DamageDealt. If you want to show the total combo damage, you must change the next floating text.
Lesser Value of 20.00 = Higher Damage
Higher Value of 20.00 = Lesser Damage
Code:
Floating Text - Create floating text that reads (Combo + (String((Custom value of (Triggering unit))))) at (Point(((X of loc) + 10.00), (Y of loc))) with Z offset 0.00, using font size 6.00, color (100.00%, 0.00%, 0.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
Else - Actions
Floating Text to do how many Combos done, you can modify to show the damage combo done to :
Code:
Floating Text - Create floating text that reads ((Combo + (String((Custom value of (Triggering unit)))) + ( ( + ((Integer(Custom Real value of (Triggering unit))) + )) at (Point(((X of loc) + 10.00), (Y of loc))) with Z offset 0.00, using font size 6.00, color (100.00%, 0.00%, 0.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
Else - Actions
It returns a text like that : Combo 1 (15)
So : Combo X (Y)
X = Actual Combo Chain
Y = Damage Chain
Code:
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
Shows the Damage Dealt in total (Not the Combo Damage).
Code:
-------- Extra Damage Part --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DamageDealt Greater than (Damage taken)
Then - Actions
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)
Else - Actions
When a Combo is dealt, Damage taken should be lesser than DamageDealt (Sometimes not if you wrong value for the "20.00"). If yes, this trigger does extra damages to the target.
Code:
-------- Delay before Combo ends --------
Wait 1.00 seconds
Unit - Set the custom value of (Triggering unit) to ((Custom value of (Triggering unit)) - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Custom value of (Triggering unit)) Equal to 0
Then - Actions
-------- End of Combo. --------
Advanced - Set the custom boolean value for (Triggering unit) to False
Advanced - Set the custom real value for (Triggering unit) to 0.00
Else - Actions
After 1 second, it changes target's custom value to its old value -1, and if it is equal to 0 after the fix, the combo ends, the Boolean goes to False, and the real value to 0. You can change the delay (Wait 1.00 seconds) to a lesser value if you want. More the value is less, more the combo is harder to be performed, and more the value is high, more it is easier to do a combo.
2.6 Thorns Aura Style
You all know what Thorns Aura does. Whenever a melee unit attacks a unit, it takes returned damage depending on the damage dealt. Maybe you want to modify it to have a random percentage. You may do that easily with that trigger, only one part to modify as you want.
Code:
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 Thorns Aura ) Equal to True
Then - Actions
Set loc2 = (Position of (Damage source))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between loc and loc2) Less than 100.00
Then - Actions
-------- Thorn Factor*100 returns the percentage of damage returned. --------
Set ThornFactor = 0.25
Trigger - Turn off (This trigger)
Unit - Cause (Triggering unit) to damage (Damage source), dealing ((Damage taken) x ThornFactor) damage of attack type Chaos and damage type Universal
Trigger - Turn on (This trigger)
Floating Text - Create floating text that reads ((String((Integer(((Damage taken) x ThornFactor))))) + !) at loc2 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 - 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
Else - Actions
Else - Actions
-------- Does not have the Thorns Aura buff, ignore Then actions and do instantly the Else Action without other actions. --------
Floating Text - Create floating text that reads ((String((Integer((Damage taken))))) + !) 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
Skip remaining actions
You can change the Thorn Factor, which handles the percentage of the damage dealt. Here, its value is 0.25, you can change it to have a higher returned damage if you increase its value, and vice-versa. For 0.25, it does 25%. For 1.00, it does 100%. This style of Thorns Aura returns directly damages from melee (Ignores if ranged) in a range of 100, ignoring damage source's attack range.
2.7 Vampiric Aura Style
Working like the Thorns Aura Style, the Vampiric Aura can be again easily done with triggers.
Code:
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 Vampiric Aura ) Equal to True
Then - Actions
Set loc2 = (Position of (Damage source))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Distance between loc and loc2) Less than 100.00
Then - Actions
-------- Stole Factor*100 returns the percentage of damage stole. --------
Set StoleFactor = 0.25
Unit - Set life of (Damage source) to ((Life of (Damage source)) + ((Damage taken) x StoleFactor))
Floating Text - Create floating text that reads ((String((Integer(((Damage taken) x StoleFactor))))) + !) at loc2 with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.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
Else - Actions
Else - Actions
-------- Does not have the Vampiric Aura buff, ignore Then actions and do instantly the Else Action without other actions. --------
Floating Text - Create floating text that reads ((String((Integer((Damage taken))))) + !) 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
Skip remaining actions
You can change the StoleFactor value which handles percentage to a higher value for higher steal, and also you can add a special effect. Example, a unit deals 50 damage, if StoleFactor = 0.25, it returns (50*0.25) HP, so : 12.5 Hp.
The Algorithm is : (Damage Dealt * StoleFactor) = Stole Health
2.8 Frenzy Style
Later, no time for the moment.. sorry.
Known Issues
Pre-Placed Units
Those triggers posted does not acquire pre-placed units in the map, you may (Should?) use this trigger :
Code:
Register PrePlaced Units
Events
Game - Time Elasped 0.00 seconds of game-time
Conditions
Actions
Custom Script : set bj_wantDestroyGroup = true
Unit Group - Pick every units in (Units in (Playable map area)) and do actions
Loop - Actions
Trigger - Add to Show Damages <gen> the event (Unit - (Picked unit) takes damage)
The Map didn't work after optimization of Vexorian's Optimizer (3.9d)
Be sure to check the Force UpperCase Names, else Half-GUI Mode will screw up your map. This only applies to Delay Damage Style.
I hope this is clear for you, this tutorial ends for the moment.
Will be Added to the tutorial
Will be added later : Frenzy Attacks Style.
Frenzy Attacks Style will contain : A demo map and how is it used (Requires a leveled Endurance Aura), from 1% attack speed bonus to a huge bonus, which lowers until go back to 0%. I mean, when you attack a unit, and if you do a combo, you get an extra attack speed until a limited a time.
Have fun with it.
Fixed Problems
- Delay Damage was infinite loop
- Delay Damage can use Loops
A small note
Because the file limit is reached, you may find the other files at the post 16.
You can find it here : Post 16
Or at : http://www.thehelper.net/forums/attachment.php?attachmentid=6379&d=1157543387 (7 files)