• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Buff Burn (Need help fixing)

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
Picking unit with most buffs to target spell (Need help making MUI)



  • BuffBurn
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Unit-type of GDD_DamageSource) Equal to Arcane Spell Breaker
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (GDD_DamagedUnit has buff Buff Burn (Calculate Initial Damage) ) Equal to True
        • Then - Actions
          • Unit - Remove Buff Burn (Calculate Initial Damage) buff from GDD_DamagedUnit
          • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing ((Real((Number of All buffs considered Magic or physical on (Triggering unit) (Exclude expiration timers, Exclude auras)))) x 5.00) damage of attack type Spells and damage type Normal
          • Unit - Remove All buffs considered Magic or physical from GDD_DamagedUnit (Exclude expiration timers, Exclude auras)
        • Else - Actions
Buffs are not removed, no damage is done. Base spell is Frost Arrows, it has the proper buff.

Using this: GUI-Friendly Damage Detection System


EDIT: It turns out, something was wrong with the spell that was causing the issue. I have no idea what, though...It's fixed now.

Onto what I want to do:

I want to make this spell's autocast target units that have the most positive buffs on them. How would I do that?

This is what I have so far:

  • BuffBurn AutoCast On
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Ordered unit)) Equal to Arcane Spell Breaker
          • (Issued order) Equal to (Order(poisonarrows))
        • Then - Actions
          • Set BuffBurnAutoCastOn = True
        • Else - Actions
  • BuffBurn AutoCast Off
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Ordered unit)) Equal to Arcane Spell Breaker
          • (Issued order) Equal to (Order(unpoisonarrows))
        • Then - Actions
          • Set BuffBurnAutoCastOn = False
        • Else - Actions
  • BuffBurn Autocast
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in BBUnitGroup and do (Actions)
        • Loop - Actions
          • Set BBUnit = (Picked unit)
          • Unit Group - Pick every unit in (Units within 700.00 of (Position of BBUnit)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • BuffBurnAutoCastOn Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of Positive buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than 0
                    • Then - Actions
                      • Unit - Order BBUnit to Neutral - Poison Arrows (Picked unit)
                    • Else - Actions
                • Else - Actions
This is as far as I can go...How could I go about making it pick the unit with the most positive buffs?
Then, after that, it needs to be MUI compatible of course...

EDIT2: I think I'll need a unit indexer to make it MUI, so would this (GUI Unit Indexer) work?

EDIT3: How does this look for making it MUI compatible?

  • BuffBurn AutoCast Toggle
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Arcane Spell Breaker
          • (Issued order) Equal to (Order(poisonarrows))
        • Then - Actions
          • Set BBUnit[BBAutoMaxIndex] = (Triggering unit)
          • Set BuffBurnAutoCastOn[BBAutoMaxIndex] = True
          • Set BBAutoMaxIndex = (BBAutoMaxIndex + 1)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Arcane Spell Breaker
              • (Issued order) Equal to (Order(unpoisonarrows))
            • Then - Actions
              • Set BuffBurnAutoCastOn[BBAutoMaxIndex] = True
              • For each (Integer BBAutoTempInit) from 1 to BBAutoMaxIndex, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Triggering unit) Equal to BBUnit[BBAutoTempInit]
                    • Then - Actions
                      • Set BBUnit[BBAutoTempInit] = No unit
                      • Set BBAutoTempInit2 = (BBAutoTempInit + 1)
                      • For each (Integer BBAutoTempInit) from BBAutoTempInit2 to BBAutoMaxIndex, do (Actions)
                        • Loop - Actions
                          • Set BBUnit[BBAutoMaxIndex] = No unit
                          • Set BBUnit[BBAutoTempInit] = BBUnit[(BBAutoTempInit - 1)]
                          • Set BuffBurnAutoCastOn[BBAutoMaxIndex] = False
                          • Set BBAutoMaxIndex = (BBAutoMaxIndex - 1)
                    • Else - Actions
            • Else - Actions
EDIT: It doesn't work...


EDIT: I achieved MUI, and I only need one more issue solved.

That is, to pick units with the most buffs without using the method I used in my current triggers, as they are of course way more inefficient then I am comfortable with.


  • BuffBurn Start
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Arcane Spell Breaker
          • (Issued order) Equal to (Order(poisonarrows))
        • Then - Actions
          • Set BBAutoMaxIndex = (BBAutoMaxIndex + 1)
          • Set BBUnit[BBAutoMaxIndex] = (Triggering unit)
          • Set BuffBurnAutoCastOn[BBAutoMaxIndex] = True
          • Trigger - Turn on BuffBurn AutoCast Calc <gen>
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Triggering unit)) Equal to Arcane Spell Breaker
              • (Issued order) Equal to (Order(unpoisonarrows))
            • Then - Actions
              • Set BuffBurnAutoCastOn[BBAutoMaxIndex] = False
              • For each (Integer BBAutoTempInit) from 1 to BBAutoMaxIndex, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Triggering unit) Equal to BBUnit[BBAutoTempInit]
                    • Then - Actions
                      • Set BBUnit[BBAutoTempInit] = No unit
                      • Set BBAutoTempInit2 = BBAutoTempInit
                      • For each (Integer BBAutoTempInit) from BBAutoTempInit2 to BBAutoMaxIndex, do (Actions)
                        • Loop - Actions
                          • Game - Display to (All players) the text: ((VARIABLE + (String(BBAutoMaxIndex))) + UNSET!)
                          • Set BBUnit[BBAutoMaxIndex] = No unit
                          • Set BuffBurnAutoCastOn[BBAutoMaxIndex] = False
                          • Set BBUnit[BBAutoTempInit] = BBUnit[(BBAutoTempInit - 1)]
                          • Set BuffBurnAutoCastOn[BBAutoTempInit] = BuffBurnAutoCastOn[(BBAutoTempInit - 1)]
                          • Set BBAutoTempInit = (BBAutoTempInit - 1)
                          • Set BBAutoMaxIndex = (BBAutoMaxIndex - 1)
                    • Else - Actions
            • Else - Actions


  • BuffBurn Target Unit
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Arcane Spell Breaker) and do (Actions)
        • Loop - Actions
          • For each (Integer BBAutoTempInit) from 1 to BBAutoMaxIndex, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Equal to BBUnit[BBAutoTempInit]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Ordered unit)) Equal to Arcane Spell Breaker
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Issued order) Equal to (Order(attack))
                          • (Issued order) Equal to (Order(smart))
                          • (Issued order) Equal to (Order(move))
                    • Then - Actions
                      • Set BBAttackMove[BBAutoTempInit] = False
                      • Set BBTargetRange[BBAutoTempInit] = 150.00
                    • Else - Actions
                • Else - Actions


  • BuffBurn Target Point
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Arcane Spell Breaker) and do (Actions)
        • Loop - Actions
          • For each (Integer BBAutoTempInit) from 1 to BBAutoMaxIndex, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Equal to BBUnit[BBAutoTempInit]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Issued order) Equal to (Order(attack))
                          • (Issued order) Equal to (Order(patrol))
                    • Then - Actions
                      • Set BBAttackMove[BBAutoTempInit] = True
                      • Set BBTargetRange[BBAutoTempInit] = 700.00
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Picked unit) Equal to BBUnit[BBAutoTempInit]
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Or - Any (Conditions) are true
                                • Conditions
                                  • (Issued order) Equal to (Order(move))
                                  • (Issued order) Equal to (Order(smart))
                            • Then - Actions
                              • Set BBAttackMove[BBAutoTempInit] = False
                              • Set BBTargetRange[BBAutoTempInit] = 700.00
                            • Else - Actions
                        • Else - Actions
                • Else - Actions


  • BuffBurn NoTarget
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Arcane Spell Breaker) and do (Actions)
        • Loop - Actions
          • For each (Integer BBAutoTempInit) from 1 to BBAutoMaxIndex, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Equal to BBUnit[BBAutoTempInit]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Ordered unit)) Equal to Arcane Spell Breaker
                      • Or - Any (Conditions) are true
                        • Conditions
                          • (Issued order) Equal to (Order(holdposition))
                          • (Issued order) Equal to (Order(stop))
                    • Then - Actions
                      • Set BBAttackMove[BBAutoTempInit] = True
                      • Set BBTargetRange[BBAutoTempInit] = 250.00
                    • Else - Actions
                • Else - Actions


  • BuffBurn Idle
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Arcane Spell Breaker) and do (Actions)
        • Loop - Actions
          • For each (Integer BBAutoTempInit) from 1 to BBAutoMaxIndex, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Equal to BBUnit[BBAutoTempInit]
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Current order of (Picked unit)) Equal to (Order(none))
                    • Then - Actions
                      • Set BBAttackMove[BBAutoTempInit] = True
                      • Set BBTargetRange[BBAutoTempInit] = 700.00
                    • Else - Actions
                • Else - Actions

This is the one that needs fixing

  • BuffBurn AutoCast Calc
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer BBAutoTempInit) from 1 to BBAutoMaxIndex, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units within BBTargetRange[BBAutoTempInit] of (Position of BBUnit[BBAutoTempInit])) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • BuffBurnAutoCastOn[BBAutoTempInit] Equal to True
                      • BBAttackMove[BBAutoTempInit] Equal to True
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) is A structure) Equal to False
                      • (Picked unit) Not equal to BBUnit[BBAutoTempInit]
                      • ((Owner of (Picked unit)) is an ally of (Owner of BBUnit[BBAutoTempInit])) Equal to False
                      • Or - Any (Conditions) are true
                        • Conditions
                          • ((Owner of (Picked unit)) is an enemy of (Owner of BBUnit[BBAutoTempInit])) Equal to True
                          • (Owner of (Picked unit)) Equal to Neutral Hostile
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of Positive buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than or equal to 5
                    • Then - Actions
                      • Unit - Order BBUnit[BBAutoTempInit] to Neutral - Poison Arrows (Picked unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of Positive buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than or equal to 4
                        • Then - Actions
                          • Unit - Order BBUnit[BBAutoTempInit] to Neutral - Poison Arrows (Picked unit)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Number of Positive buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than or equal to 3
                            • Then - Actions
                              • Unit - Order BBUnit[BBAutoTempInit] to Neutral - Poison Arrows (Picked unit)
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Number of Positive buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than or equal to 2
                                • Then - Actions
                                  • Unit - Order BBUnit[BBAutoTempInit] to Neutral - Poison Arrows (Picked unit)
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • (Number of Positive buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than or equal to 1
                                    • Then - Actions
                                      • Unit - Order BBUnit[BBAutoTempInit] to Neutral - Poison Arrows (Picked unit)
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • (Number of Positive buffs considered Magic or physical on (Picked unit) (Exclude expiration timers, Exclude auras)) Greater than or equal to 0
                                        • Then - Actions
                                          • Unit - Order BBUnit[BBAutoTempInit] to Neutral - Poison Arrows (Picked unit)
                                        • Else - Actions
                • Else - Actions


  • BuffBurn Calc
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (Unit-type of GDD_DamageSource) Equal to Arcane Spell Breaker
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (GDD_DamagedUnit has buff Buff Burn (Calculate Initial Damage) ) Equal to True
        • Then - Actions
          • Unit - Remove Buff Burn (Calculate Initial Damage) buff from GDD_DamagedUnit
          • Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing ((Real((Number of Positive buffs considered Magic or physical on (Triggering unit) (Exclude expiration timers, Exclude auras)))) x 5.00) damage of attack type Spells and damage type Normal
          • Unit - Remove Positive buffs considered Magic or physical from GDD_DamagedUnit (Exclude expiration timers, Exclude auras)
        • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top