Triggered Critical Strike

ZelNaga

New Member
Reaction score
5
Ok so I decided that I wanted to trigger Crit Strike, don't ask why Idk. So as I'm going along everything is going great till I get to the part with the text that reads off how much damage you do. I don't know what to put there for the floating text. Can anyone point me in the right direction?
 

WolfieeifloW

WEHZ Helper
Reaction score
372
You'll need a damage detection system to do this.

I'm pretty sure there's one here on TH.net, use the Search function to try and find it :) .
 

Light Alkmst

New Member
Reaction score
20
Set the Floating Text to display the Damage Dealt with the multiplier casted into a string.

BTW: With the default Critical Strike, it displays the damage with the multiplier before armor. Triggered, it will show the damage after armor.
 

ZelNaga

New Member
Reaction score
5
Ok so I don't know what I'm doing wrong. I've followed the tutorial provided and not only will the floating text not display the correct amount, but the damage also will not work. I've changed the multipier so it would do [damage delt x 1,000,000] so I know that the damage doesn't even wanna do anything. The text does however always display "0!". Help?


My Skill/Trigger (Inner Focus = Crit Strike).

Inner Focus:
The skill's based off Roar and gives you a buff that lasts for 5, 10, 15, 20, & 25 seconds.
Level 1: For a short period of time the Sniper has a 5% chance to do 1.5 times normal damage. Lasts for 5 seconds. Cooldown 40 seconds.
Level 2: For a short period of time the Sniper has a 10% chance to do 2 times normal damage. Lasts for 10 seconds. Cooldown 40 seconds.
Level 3: For a short period of time the Sniper has a 15% chance to do 2.5 times normal damage. Lasts for 15 seconds. Cooldown 40 seconds.
Level 4: For a short period of time the Sniper has a 20% chance to do 3 times normal damage. Lasts for 20 seconds. Cooldown 40 seconds.
Level 5: For a short period of time the Sniper has a 25% chance to do 3.5 times normal damage. Lasts for 25 seconds. Cooldown 40 seconds.


"DamageDealt" = Real
"Loc" = Point

Code:
Inner Focus
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has buff Inner Focus ) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Level of Inner Focus  for (Attacking unit)) x 5) Greater than or equal to (Random integer number between 1 and 100)
            Then - Actions
                Set Loc = (Position of (Attacking unit))
                Set DamageDealt = ((Damage taken) x (1.50 + (0.50 x ((Real((Level of Inner Focus  for (Attacking unit)))) - 1.00))))
                Trigger - Turn off (This trigger)
                Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (DamageDealt - (Damage taken)) damage of attack type Hero and damage type Universal
                Trigger - Turn on (This trigger)
                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
                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
                Custom script:   call RemoveLocation(udg_Loc)
            Else - Actions


Tutorial.
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
 

Lyle.

New Member
Reaction score
32
You'll need a damage detection system to do this.

I'm pretty sure there's one here on TH.net, use the Search function to try and find it :) .

If he has triggered the Critical Strike he should not need a damage detection system. He should know how much he is dealing.

Set your damage to a variable before you deal it, then convert that number to a string and place it in Floating Text.

EDIT: Above Crap is late


Could you also post what the skill is suppose to do? As in damage and chance.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Triggers made at top are bad and leaks. Add chance and attacker to condition is better. The buff is bad too.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Use Damage detection system is good and put chance and ability in the trigger's condition.
 

Nexor

...
Reaction score
74
You don't have to use damage detection system, simply give a disabled spellbook with the critical strike to your hero for some seconds and set the level of the crit strike at the cast.
 

ZelNaga

New Member
Reaction score
5
You don't have to use damage detection system, simply give a disabled spellbook with the critical strike to your hero for some seconds and set the level of the crit strike at the cast.

Wouldn't that use up a slot on the inventory?
 

Sevion

The DIY Ninja
Reaction score
413
Spell book is an "ability" that holds up to 8 more abilities, so the answer to your question is "no".
 

warden13

New Member
Reaction score
32
If you really want it to trigger idk but:
For inner focus ability, you can add a normal critical strike with trigger then remove it after 30 seconds.
 

Fire-Wolf

S.P.D Smoke Pot Daily, Legalize It!
Reaction score
54
I would do what Nexor said. Make a spellbook, put the ability in it, disable it then set it to a variable, then after so many seconds remove. This wont be MUI, but I saw a way to make a MUI wait on The Hive, but you will have to look for it.
 

Light Alkmst

New Member
Reaction score
20
The event Unit is Attacked triggers at the start of the attack, not when it would hit. I'm pretty sure you would need the damage detection system as has been previously stated. There is no Generic Unit Takes Damage event. You would have to substitute with whatever trigger would run when the unit takes damage, and have another trigger that would trigger whenever a unit enters the game to add the Specific Unit Takes Damage event for that unit to the damage-based trigger.
 

ZelNaga

New Member
Reaction score
5
Light Alkmst I love you! <3

It works, sorta. The thing that seems to not be working is the damage multiplier, when it's level 5 it does not do 3.5 times normal damage as it should. Oh, another thing is it seems like after I crit once on the same target, i'll always crit on it until it's dead, is that because I didn't custom script remove DamageDealt? and if so, what do I type for removing a real?
 

jig7c

Stop reading me...-statement
Reaction score
123
you can't remove reals... you might have to setup a more random way of dealing damage...
 
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