• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Creating a GUI-friendly damage shield?

Status
Not open for further replies.
Level 4
Joined
Jun 10, 2019
Messages
69
Hello again everyone,

Today I'm working on a spell that, when cast on a unit, absorbs the next incoming X damage that occurs within a set time range.

I have it working for 1 unit at a time, but I'm struggling to get it to work for multiple instances at the same time.

Here are my triggers:

  • Photon Barrier Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Photon Barrier
    • Actions
      • Set PhotonBarrier_Instances = (PhotonBarrier_Instances + 1)
      • Set PhotonBarrier_Casters[PhotonBarrier_Instances] = (Triggering unit)
      • Set PhotonBarrier_Targets[PhotonBarrier_Instances] = (Target unit of ability being cast)
      • Set PhotonBarrier_Level[PhotonBarrier_Instances] = (Level of Photon Barrier for PhotonBarrier_Casters[PhotonBarrier_Instances])
      • Set PhotonBarrier_INT[PhotonBarrier_Instances] = (Intelligence of PhotonBarrier_Casters[PhotonBarrier_Instances] (Include bonuses))
      • Special Effect - Create a special effect attached to the chest of PhotonBarrier_Targets[PhotonBarrier_Instances] using Abilities\Spells\Undead\FrostArmor\FrostArmorTarget.mdl
      • Set PhotonBarrier_SpecialEffect[PhotonBarrier_Instances] = (Last created special effect)
      • Special Effect - Set Color of PhotonBarrier_SpecialEffect[PhotonBarrier_Instances] to r: 255, g: 55, b: 55
      • Set PhotonBarrier_TotalShielding[PhotonBarrier_Instances] = ((20.00 + (40.00 x (Real(PhotonBarrier_Level[PhotonBarrier_Instances])))) + (7.00 x (Real(PhotonBarrier_INT[PhotonBarrier_Instances]))))
      • Set PhotonBarrier_TotalDamage[PhotonBarrier_Instances] = 0.00
      • Set PhotonBarrier_IncomingDamage[PhotonBarrier_Instances] = 0.00
      • Trigger - Add to Photon Barrier Damage Taken <gen> the event (Unit - PhotonBarrier_Targets[PhotonBarrier_Instances] Takes damage)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PhotonBarrier_Instances Equal to 1
        • Then - Actions
          • Trigger - Turn on Photon Barrier Damage Taken <gen>
          • Trigger - Turn on Photon Barrier Loop <gen>
        • Else - Actions
  • Photon Barrier Damage Taken
    • Events
    • Conditions
      • ((Triggering unit) has buff Photon Barrier (Buff) ) Equal to True
    • Actions
      • For each (Integer PhotonBarrier_Loop) from 1 to PhotonBarrier_Instances, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to PhotonBarrier_Targets[PhotonBarrier_Loop]
            • Then - Actions
              • Set PhotonBarrier_IncomingDamage[PhotonBarrier_Loop] = (Damage taken)
              • Set PhotonBarrier_TotalDamage[PhotonBarrier_Instances] = (PhotonBarrier_TotalDamage[PhotonBarrier_Loop] + PhotonBarrier_IncomingDamage[PhotonBarrier_Loop])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PhotonBarrier_TotalDamage[PhotonBarrier_Loop] Less than or equal to PhotonBarrier_TotalShielding[PhotonBarrier_Loop]
                • Then - Actions
                  • Event Response - Set Damage of Unit Damaged Event to 0.00
                • Else - Actions
                  • Event Response - Set Damage of Unit Damaged Event to (PhotonBarrier_TotalDamage[PhotonBarrier_Loop] - PhotonBarrier_TotalShielding[PhotonBarrier_Loop])
                  • Unit - Remove Photon Barrier (Buff) buff from PhotonBarrier_Targets[PhotonBarrier_Loop]
                  • Special Effect - Destroy PhotonBarrier_SpecialEffect[PhotonBarrier_Loop]
                  • Set PhotonBarrier_Casters[PhotonBarrier_Loop] = PhotonBarrier_Casters[PhotonBarrier_Instances]
                  • Set PhotonBarrier_Targets[PhotonBarrier_Loop] = PhotonBarrier_Targets[PhotonBarrier_Instances]
                  • Set PhotonBarrier_Level[PhotonBarrier_Loop] = PhotonBarrier_Level[PhotonBarrier_Instances]
                  • Set PhotonBarrier_INT[PhotonBarrier_Loop] = PhotonBarrier_INT[PhotonBarrier_Instances]
                  • Set PhotonBarrier_SpecialEffect[PhotonBarrier_Loop] = PhotonBarrier_SpecialEffect[PhotonBarrier_Instances]
                  • Set PhotonBarrier_TotalShielding[PhotonBarrier_Loop] = PhotonBarrier_TotalShielding[PhotonBarrier_Instances]
                  • Set PhotonBarrier_TotalDamage[PhotonBarrier_Loop] = PhotonBarrier_TotalDamage[PhotonBarrier_Instances]
                  • Set PhotonBarrier_IncomingDamage[PhotonBarrier_Loop] = PhotonBarrier_IncomingDamage[PhotonBarrier_Instances]
                  • Set PhotonBarrier_Loop = (PhotonBarrier_Loop - 1)
                  • Set PhotonBarrier_Instances = (PhotonBarrier_Instances - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • PhotonBarrier_Instances Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
            • Else - Actions
I'll keep playing around with it in the meanwhile, but any advice would be greatly appreciated!
 
Level 4
Joined
Jun 10, 2019
Messages
69
I'll definitely look into that, but at this point, I still want to figure this out using my (admittedly worse) system; it's a matter of pride, and I will not be defeated by these triggers hahaha.
 
Level 4
Joined
Jun 10, 2019
Messages
69
Oh my god, I figured it out. As a last resort, I tried switching:

Triggering Unit equal to PhotonBarrier_Targets (PhotonBarrier_Loop)

to

PhotonBarrier_Targets (PhotonBarrier_Loop) equal to Triggering Unit

and that actually made it work.

I'm tempted to delete this post because I feel a little stupid right now that it was such a simple fix, but I guess I should leave it up in case someone in the future has this problem?
 
Last edited:
Level 24
Joined
Feb 9, 2009
Messages
1,783
serveimage
 
Status
Not open for further replies.
Top