Dealing Double Damage with a trigger

Dark_Phoenix

New Member
Reaction score
3
Code:
Critical Strikes
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) is A Hero) Equal to True
    Actions
        Set CritInteger = (Random integer number between 0 and 100)
        Set CritInteger2 = (Agility of (Attacking unit) (Include bonuses))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((CritInteger2 / 30) + 5) Less than or equal to CritInteger
            Then - Actions
                Unit - Cause (Attacking unit) to damage (Attacked unit), dealing [B](Damage taken)[/B] damage of attack type Hero and damage type Normal
            Else - Actions
                Do nothing
Probably not right.

Is there a way to have a unit deal damage equal to its normal attack to a unit in a trigger?
 

Glaivesrit

New Member
Reaction score
8
well one way to do it that works (forgive me for no WE)

Events:
Unit - A unit Is attacked
Condtions
((Attacking unit) is A Hero) Equal to True
Actions
Pick a random integer between (x and y, any values here) if number ((equal to or less than etc.)) damage (attacking unit) for X

you can also alter the dmg bonus of atts i think to try to balance it
 

Vassilev

New Member
Reaction score
39
You need to use this trigger for registering damage events.

Code:
TRIGGER NAME
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Triggering unit) is in TempGroup) Equal to False
                Level of ability for Attacking unit of Critical Strike is > 0
            Then - Actions
                Unit Group - Add (Triggering unit) to TempGroup
                Trigger - Add to TRIGGER NAME 2 <gen> the event (Unit - (Triggering unit) Takes damage)
Else - Actions


Code:
TRIGGER NAME 2
Events
Conditions
Actions
 Set CritInteger = (Random integer number between 0 and 100)
        Set CritInteger2 = (Agility of (Attacking unit) (Include bonuses))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((CritInteger2 / 30) + 5) Less than or equal to CritInteger
            Then - Actions
                Unit - Cause (Attacking unit) to damage ([B]Triggering unit[/B]), dealing (Damage taken) damage of attack type Hero and damage type Normal
            Else - Actions
                Do nothing

You dont need to use attacked unit, it is a function used to call Triggering unit. This should work fine..
 

FireBladesX

Eating my wings!
Reaction score
123
You need to use this trigger for registering damage events.

Code:
 Set CritInteger = (Random integer number between 0 and 100)
        Set CritInteger2 = (Agility of (Attacking unit) (Include bonuses))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((CritInteger2 / 30) + 5) Less than or equal to CritInteger
            Then - Actions
                Unit - Cause ([COLOR="Red"]Attacking unit[/COLOR]) to damage ([B]Triggering unit[/B]), dealing (Damage taken) damage of attack type Hero and damage type Normal
            Else - Actions
                Do nothing

You dont need to use attacked unit, it is a function used to call Triggering unit. This should work fine..

Just thinking, few points:
Couldn't that potentially hit a unit multiple times? Also, I don't know if using attacking unit will work. Damage source for the event takes damage.

Also, another side note: the more agility, the less chance to crit? It balances things, I guess.
Side note # 2: Floating texts? <3
 

Vassilev

New Member
Reaction score
39
Damage source for the event takes damage.

Ah yes, that is true :p

Code:
 Set CritInteger = (Random integer number between 0 and 100)
        Set CritInteger2 = (Agility of ([B]Damage source[/B]) (Include bonuses))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((CritInteger2 / 30) + 5) Less than or equal to CritInteger
            Then - Actions
                Unit - Cause ([B]Damage source[/B]) to damage (Triggering unit), dealing (Damage taken) damage of attack type Hero and damage type Normal
            Else - Actions
                Do nothing
 

Dark_Phoenix

New Member
Reaction score
3
Just thinking, few points:
Couldn't that potentially hit a unit multiple times? Also, I don't know if using attacking unit will work. Damage source for the event takes damage.

Also, another side note: the more agility, the less chance to crit? It balances things, I guess.
Side note # 2: Floating texts? <3

Actually decided to make a different system for crit, but here it is:
Code:
Critical Strikes
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) is A Hero) Equal to True
    Actions
        Set CritInteger = (Random integer number between 0 and 100)
        Set CritInteger2 = (((Agility of (Attacking unit) (Include bonuses)) / 30) + 5)
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If ((Item-type of (Item carried by (Attacking unit) in slot (Integer A))) Equal to Dark Orb) then do (Set CritInteger2 = (CritInteger2 + 10)) else do (Do nothing)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                CritInteger2 Greater than or equal to CritInteger
            Then - Actions
                Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Real(((((Hero level of (Attacking unit)) + (Strength of (Attacking unit) (Include bonuses))) + (Agility of (Attacking unit) (Include bonuses))) + (Intelligence of (Attacking unit) (Include bonuses))))) damage of attack type Hero and damage type Normal
                Floating Text - Create floating text that reads Critical! above (Attacked unit) 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 1.00 seconds
                Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
            Else - Actions
                Do nothing

Yes floating texts<3
 

vypur85

Hibernate
Reaction score
803
Actually, it's best to use the code posted in Post#3. Damage taken event is more useful than 'A unit is attacked' event. With the code in Post#6, the event can be fired when the stop button is being spammed.

Also, it should be noted that the code in Post#3 will include spell damage.


Code:
TRIGGER NAME 2
Events
Conditions
Actions
 [B]Trigger - Turn off (This trigger)[/B]
 Set CritInteger = (Random integer number between 0 and 100)
        Set CritInteger2 = (Agility of (Attacking unit) (Include bonuses))
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((CritInteger2 / 30) + 5) Less than or equal to CritInteger
            Then - Actions
                Unit - Cause (Damage source) to damage (Triggering unit), dealing (Damage taken) damage of attack type Hero and damage type Normal
            Else - Actions
 [B]Trigger - Turn on (This trigger)[/B]
 
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