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
889
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
889
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
889
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
889
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
889
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
889
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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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