Triggered Critical Strike?

J3LADE

New Member
Reaction score
7
Triggered Critical Strike?

Can someone make me a trigger to do this?

Don't answer to this thread if your just gonna say "This is to hard for me" or "Just use the normal one" or "Why do you want a triggered critical".
 

Slapshot136

Divide et impera
Reaction score
471
event - a unit is attacked
conditions - level of (crit strike) for (attacking unit) is greater then 0
actions -
if (math random # between 1 and 100) is less that (level of crit strike x 5 + 10)
then cause (attacked unit) to take (x) damage

something like that
dont think u can get direct damage from it, best u can do is primary stat
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
If it's possible, use the Unit - Unit Takes Damage, because the event Unit - A Unit is Attacked fires when a unit first begins its attack.
 

Slapshot136

Divide et impera
Reaction score
471
i would but that needs a specific target, and unless u add every single unit on the map under events i dont think u can make it work

that would also help with the damage taken function..
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Ugh. This is abominably over-asked/requested thing.

You're going to need to use an Attack-Detect engine to detect when a unit deals damage by attacking (the event "a unit is damaged" registers when a unit deals damage via spells) and then (since the map will freeze if you damage a unit instantly after the attack-detect engine detects the attack), start 0.01 second non-repeating timer. To this timer, you'll need to store the damage done, attacking unit, and target with attached variables.

When the timer expires, have the damager damage the damaged unit for the damage*YourCritMultiplier.


AKA: It's hard, complicated, annoying, and requires JASS and GameCache systems.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
I did this not too long ago as a three level ability:

Code:
Critical Strike Ability
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Owner of (Damage source)) Not equal to Player 12 (Brown)
                (Damage taken) Greater than 20.00
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Critical Strike Attack  for (Damage source)) Equal to 1
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Random integer number between 1 and 100) Less than or equal to 20
                            Then - Actions
                                Unit - Cause (Damage source) to damage (Triggering unit), dealing ((Damage taken) x 2.00) damage of attack type Pierce and damage type Normal
                                Floating Text - Create floating text that reads Doubled! 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 - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                Floating Text - Change (Last created floating text): Disable permanence
                                Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                                Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                            Else - Actions
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Critical Strike Attack  for (Damage source)) Equal to 2
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Random integer number between 1 and 100) Less than or equal to 25
                            Then - Actions
                                Unit - Cause (Damage source) to damage (Triggering unit), dealing ((Damage taken) x 3.00) damage of attack type Pierce and damage type Normal
                                Floating Text - Create floating text that reads Tripled!! 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 - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                Floating Text - Change (Last created floating text): Disable permanence
                                Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                                Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                            Else - Actions
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Critical Strike Attack  for (Damage source)) Equal to 3
                    Then - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Random integer number between 1 and 100) Less than or equal to 30
                            Then - Actions
                                Unit - Cause (Damage source) to damage (Triggering unit), dealing ((Damage taken) x 4.00) damage of attack type Pierce and damage type Normal
                                Floating Text - Create floating text that reads QUADRUPLED! 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 - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                                Floating Text - Change (Last created floating text): Disable permanence
                                Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                                Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                            Else - Actions
                    Else - Actions
            Else - Actions

I have another trigger add events to trigger this:

Code:
Unit Group - Pick every unit in Tempgroup and do (Actions)
    Loop - Actions
        Trigger - Add to Critical Strike Ability <gen> the event (Unit - (Picked unit) Takes damage)

It works fine and wasn't that hard to create. If you wanted to use Unit - A Unit Is Attacked, it would be even easier because you wouldn't have to use the second trigger.
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Ghan_04, that trigger will fire when a unit with that critical strike ability deals damage to a unit by using a spell also. If you had a spell that did 120 damage to target unit, it would be possible to get a "critical" and do 480+120 damage to the unit instead.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
That's true. The trigger would register any type of damage since it just says Takes Damage. You might be able to circumvent that a little by doing a current order check on the attacking unit.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
It wouldn't work if the spell takes time to do damage, and you were checking that the unit's order is attack, because the unit could have switched back to regular attacking by the time the spell would have done the damage, but it's something to investigate. Though you might be able to do it by process of elimination. Just check that it's NOT smart, none, move, attack, harvest, holdposition, patrol, etc., because then all that would be left are abilities.
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
If a unit auto-acquires a target, there is no order; either that, or it's "null".

Additionally, the first cast of storm bolt showed no order (same as above), but all subsequent casts showed "stormbolt" twice. Odd. Here are the triggers I used:
Code:
Untitled Trigger 001
    Events
    Conditions
    Actions
        Game - Display to (All players) the text: (String((Current order of (Damage source))))
Code:
Untitled Trigger 002
    Events
        Map initialization
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                Trigger - Add to Untitled Trigger 001 <gen> the event (Unit - (Picked unit) Takes damage)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Well, like I said, it might help a little. :D

Hmm... I have an idea....

What if you used another trigger that detected when a unit uses an ability, then got the target of the ability being cast, and like changed its custom value so that a check of the custom value in the crit. trigger would kill the function there? Then, you would change the custom value back after like 1 second.
 

elmstfreddie

The Finglonger
Reaction score
203
Don't answer to this thread if your just gonna say "This is to hard for me" or "Just use the normal one" or "Why do you want a triggered critical".

Why not? IF someone asks "Why do you want a triggered critical?" and you answer, then we may find some loophole around it. So I'd like to know, why you want to trigger a critical strike, to see if there's a way around it.

BTW this is untested and very stupid, but why not just make a global boolean, and have a trigger that just goes E - a unit is attacked A - set the boolean = true, wait 0.01, set it to false. Then on the damage trigger, check if the boolean is true.
It would only work to an extent, it'd probably mess up a lot if you have a lot of units :p
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
BTW this is untested and very stupid, but why not just make a global boolean, and have a trigger that just goes E - a unit is attacked A - set the boolean = true, wait 0.01, set it to false. Then on the damage trigger, check if the boolean is true.
It would only work to an extent, it'd probably mess up a lot if you have a lot of units :p

I don't get that at all. It doesn't have a set chance of triggering, does it? How would that work when it takes 0.01 sec. to change back to false?
 

ertaboy356b

Old School Gamer
Reaction score
86
I've triggered this once... Including Critical Strike, Block Chance, Evasion and Accuracy System, and Defence System....

PM me if you want the trigger... I'll help you.. By the way, its in Jass..
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
...wouldn't it be better for you just to post it here? There may be other people interested in that (me, for instance).
 

J3LADE

New Member
Reaction score
7
Thanks Chocobo

I think i'll make my own versions of these triggers now. Because i have different things i need to do with them.
 

ertaboy356b

Old School Gamer
Reaction score
86
Uhmmm.. Here's how I do it..

JASS:
function FloatingText takes string message, integer red, integer green, integer blue returns nothing
local texttag Text = CreateTextTag()
local integer a = 16
call SetTextTagPosUnit(Text, GetTriggerUnit(), 0)
call SetTextTagText(Text, message, TextTagSize2Height(16.00))
call SetTextTagColor(Text, red, green, blue, 0)
call SetTextTagVelocityBJ(Text,20.00,90.00)
loop
exitwhen a&lt;8
set a = a - 1
call SetTextTagText(Text, message, TextTagSize2Height(a))
call TriggerSleepAction(0.10)
endloop
call DestroyTextTag(Text)
endfunction

function CriticalStrike takes real Multiplier, integer Chance returns nothing
local real Damage = GetEventDamage()
local unit DamageSource = GetEventDamageSource()
local unit Damagee = GetTriggerUnit()
local integer CriticalDamage
if GetRandomInt(1,100) &lt;= Chance then
call SetUnitState(Damagee,UNIT_STATE_LIFE, GetUnitState(Damagee,UNIT_STATE_LIFE) + Damage)
set CriticalDamage = R2I(Damage) * R2I(Multiplier)
call UnitDamageTarget(DamageSource,Damagee,(I2R(CriticalDamage)),true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call FloatingText(I2S(CriticalDamage) + &quot;!&quot;,255,0,0)
endif
set DamageSource = null
set Damagee = null
endfunction
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top