This trigger done in a better way?

FannyShaver

Well-Known Member
Reaction score
31
Trigger:
  • Cursed Shield
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Vampire Lord
      • ((Attacked unit) has buff Cursed Shield ) Equal to True
    • Actions
      • Set CursedShield = (Random integer number between 1 and 1000)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Level of Cursed Shield for (Attacked unit)) Equal to 1) and (CursedShield Less than or equal to 15)
        • Then - Actions
          • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Level of Cursed Shield for (Attacked unit)) Equal to 2) and (CursedShield Less than or equal to 30)
            • Then - Actions
              • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Level of Cursed Shield for (Attacked unit)) Equal to 3) and (CursedShield Less than or equal to 45)
                • Then - Actions
                  • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Level of Cursed Shield for (Attacked unit)) Equal to 4) and (CursedShield Less than or equal to 60)
                    • Then - Actions
                      • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Level of Cursed Shield for (Attacked unit)) Equal to 5) and (CursedShield Less than or equal to 75)
                        • Then - Actions
                          • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Level of Cursed Shield for (Attacked unit)) Equal to 6) and (CursedShield Less than or equal to 90)
                            • Then - Actions
                              • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Level of Cursed Shield for (Attacked unit)) Equal to 7) and (CursedShield Less than or equal to 105)
                                • Then - Actions
                                  • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • ((Level of Cursed Shield for (Attacked unit)) Equal to 8) and (CursedShield Less than or equal to 120)
                                    • Then - Actions
                                      • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • ((Level of Cursed Shield for (Attacked unit)) Equal to 9) and (CursedShield Less than or equal to 135)
                                        • Then - Actions
                                          • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • ((Level of Cursed Shield for (Attacked unit)) Equal to 10) and (CursedShield Less than or equal to 150)
                                            • Then - Actions
                                              • Unit - Cause (Attacked unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
                                            • Else - Actions
                                              • Do nothing
 

DuelPlayer

Member
Reaction score
21
You could have just use the condition
Random integer less than or equal to (Level of ability of unit) x 15
 

sentrywiz

New Member
Reaction score
25
Yeah, there is a better way. Much better. And less pile of triggers...

DuelPlayer is right, use that instead of all those if else


And what is this ability meant to do?
 

Bogrim

y hello thar
Reaction score
154
What DualPlayer said:
Trigger:
  • Cursed Shield
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Vampire Lord
      • ((Triggering unit) has buff Cursed Shield ) Equal to True
      • ((Level of Cursed Shield for (Triggering unit)) x 15) Less than or equal to (Random integer number between 1 and 100)
    • Actions
      • Unit - Cause (Triggering unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic
 

hgkjfhfdsj

Active Member
Reaction score
55
[DEL]((Level of Cursed Shield for (Triggering unit)) x 15) Less than or equal to (Random integer number between 1 and 150)[/DEL]
EDIT
wait actually, nvm
curseshield between 1 - 1000?
 

DuelPlayer

Member
Reaction score
21
What DualPlayer said:
Trigger:
  • Cursed Shield
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Vampire Lord
      • ((Triggering unit) has buff Cursed Shield ) Equal to True
      • ((Level of Cursed Shield for (Triggering unit)) x 15) Less than or equal to (Random integer number between 1 and 100)
    • Actions
      • Unit - Cause (Triggering unit) to damage (Attacking unit), dealing 2000.00 damage of attack type Spells and damage type Magic

DuelPlayer*
 

roXplosive

New Member
Reaction score
15
I know the level of a buff is only 1 or 0 so you can determine only the fact if a unit has or has not a buff . To determine the level of a buff for a unit you could : add the unit an ability based off channel that is not visible and set that ability's level to the desired buff level or use some arrays to retain the level of buffs for buffed units or attach that data to the unit handle (sen it done in some of emljr3's dota heroes map regarding bristleback's nasal goo ) .

The fact that the buff might display lvl in game might make you think the buff level varies but you check if an unit has a buff is using
JASS:

native GetUnitAbilityLevel takes unit whichunit , integer abilcode returns integer

and isntead of using an ability's code you use the code of the buff . As i have already stated it returns only 0 and 1 in the case of buffs so try a workaround to make your ability level condition work as supposed .
 
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