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.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top