• 🏆 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!

[Solved] Need Help with a Trigger

Status
Not open for further replies.
Level 3
Joined
May 28, 2012
Messages
32
Hey guys,

I'm currently working on my map again and I need help 'cause I cant figure out which condition is missing for this trigger to work as I want.
Short Description (So you'll understand what the trigger is supposed to do):
Spell Shield: Absorbs the next Spell that is hitting you. After absorbing, a timer starts; when timer ends it can absorb again.
Problem is: When a Unit with "Spell Shield" attacks while the "Spell Shield" is still on cooldown, it will instantly create a "Spell Shield" ignoring the remaining time of timer.
Of course I am using Bribe's awesome Damage Engine System.
So here is the code maybe you can help me finding an additional condition or another way to fix it.
  • Spell Shield GetDmg
    • Events
      • Spiel - DamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventTarget has buff Spell Shield (Buff) ) Equal to True
      • IsDamageSpell Equal to True
    • Actions
      • Unit - Remove Spell Shield (Buff) buff from DamageEventTarget
      • -------- ----------------------------------------------------------------- --------
      • -------- ----------------------------------------------------------------- --------
      • Unit Group - Add DamageEventTarget to ZS_Group
      • -------- ----------------------------------------------------------------- --------
      • Set ZS_RefreshTime[UDex] = 3.00
      • -------- ----------------------------------------------------------------- --------
      • Trigger - Turn on Spell Shield Loop <gen>
      • -------- ----------------------------------------------------------------- --------
  • Spell Shield Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ZS_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • ((Picked unit) is in ZS_Group_Debuff) Equal to False
              • ((Picked unit) has buff Spell Shield (Buff) ) Equal to False
            • 'THEN'-Actions
              • Set ZS_RefreshTime[UDex] = (ZS_RefreshTime[UDex] - 0.03)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Conditions
                  • ZS_RefreshTime[UDex] Kleiner gleich 0.00
                • 'THEN'-Actions
                  • Quest - Display to (All players) the Quest-Update message: Get Shield
                  • Unit Group - Remove (Picked unit) from ZS_Group
                  • -------- ----------------------------------------------------------------- --------
                  • -------- ----------------------------------------------------------------- --------
                  • Set ZS_TempLoc = (Position of (Picked unit))
                  • Unit - Create 1 A Dummy For All for (Owner of (Picked unit)) at ZS_TempLoc facing 0.00 degrees
                  • Unit - Add Spell Shield - (Buff Ability) to (Last created unit)
                  • Unit - Order (Last created unit) to Human-Priest - 'Inner Fire' (Picked unit)
                  • Unit - Add a 1.00 second Standard expiration timer to (Last created unit)
                  • -------- ----------------------------------------------------------------- --------
                  • -------- ----------------------------------------------------------------- --------
                  • Custom script: call RemoveLocation(udg_ZS_TempLoc)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Conditions
                      • (ZS_Group is empty) Equal to True
                    • 'THEN'-Actions
                      • Trigger - Turn off (This trigger)
                    • 'ELSE'-Actions
                • 'ELSE'-Actions
            • 'ELSE'-Actions
I would appreciate your help and will give +rep of course to those helping me SOLVING the problem.

EDIT: Code Updated
 
Last edited:

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
Unit - Set the custom value of DamageEventTarget to ZS_Index:
Bribe's damage engine also uses his unit indexer. The unit indexer gives every unit a unique index by changning its custom value. If using this system you should not use custom value in any other way. You can easily use the unit indexer to store an integer to the unit.

What is ZS_Index used for? I assume you use this to make the spell MUI by storing the values in arrays with index ZS_Index.
You should use a better method to recycle the indices.
You can use the unit indexer here as well.
 
Level 3
Joined
May 28, 2012
Messages
32
Well, since I don't know how to relate his Indexing System to my trigger (even if he explained it in his instruction xD) I had to use a self-created and inefficient way to make the spell MUI.
I would be very glad and thankful if you could help me at this point.

EDIT: I replaced ZS_Index with UDex and deleted ZS_Index. The bug is fixed now; the attacker doesn't get the shield immediately after he attacks. But the timer is shorter than in the settings (3 Seconds). It is like 2 seconds or less.
 
Last edited:
Level 3
Joined
May 28, 2012
Messages
32
Yea, I still need help since it's not completely fixed.
When i changed that, the unit's immediately get the shield again after they absorb a spell. Don't know why, since your advice seems logic to me.
 
Status
Not open for further replies.
Top