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

[Trigger] Spell Problem

Status
Not open for further replies.
I can't find where it goes wrong, but here's what it's supposed to do, and what it actually does.

The spell is an Aoe stomp, and when cast, all units are "dazed". Dazed units have 60% movement speed for 3/5/7 seconds, and if they take 75/150/225 damage they lose the movement speed slow before the timer expires. Something weird is happening, because the timer never expires. Moreover, the movement speed reduction isn't working at all, and the damage is. They're both in the same block of the [then] statement. Here are triggers

  • Tauren Smash Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Tauren Smash
    • Actions
      • Set TS_Caster = (Triggering unit)
      • Set TS_Point1 = (Position of TS_Caster)
      • Set TS_Level = (Level of Tauren Smash for TS_Caster)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 300.00 of TS_Point1 matching ((((Matching unit) belongs to an enemy of (Owner of TS_Caster)) Equal to True) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is A structure) Equal to False) and (((Matching unit) is and do (Actions)
        • Loop - Actions
          • Set Beast_Knockbackunit = (Picked unit)
          • Set TS_Point2 = (Position of Beast_Knockbackunit)
          • Custom script: set udg_Beast_Handle = GetHandleId(udg_Beast_Knockbackunit)
          • Unit Group - Add Beast_Knockbackunit to Beast_Knockbackgroup
          • Unit Group - Add Beast_Knockbackunit to TS_Group
          • Unit - Turn collision for Beast_Knockbackunit Off
          • Unit - Cause TS_Caster to damage Beast_Knockbackunit, dealing TS_Damage[TS_Level] damage of attack type Spells and damage type Normal
          • Unit - Set Beast_Knockbackunit movement speed to (0.40 x (Default movement speed of Beast_Knockbackunit))
          • Special Effect - Create a special effect attached to the overhead of Beast_Knockbackunit using Abilities\Spells\Orc\StasisTrap\StasisTotemTarget.mdl
          • Hashtable - Save Handle Of(Last created special effect) as 9 of Beast_Handle in Beastkin_Hash
          • Set TS_Health = ((Life of (Triggering unit)) x (50.00 x (Real(TS_Level))))
          • Set TS_Timer = (1.00 + (2.00 x (Real(TS_Level))))
          • Hashtable - Save TS_Health as 6 of Beast_Handle in Beastkin_Hash
          • Hashtable - Save TS_Timer as 7 of Beast_Handle in Beastkin_Hash
          • Hashtable - Save TS_Level as 8 of Beast_Handle in Beastkin_Hash
          • Set Beast_Knockbacktimer = 1.20
          • Set Beast_Angle = (Angle from TS_Point1 to TS_Point2)
          • Set Beast_Distance = 30.00
          • Set Beast_Slidedistance = (300.00 - (Distance between TS_Point1 and TS_Point2))
          • Hashtable - Save Beast_Knockbacktimer as 20 of Beast_Handle in Beastkin_Hash
          • Hashtable - Save Beast_Angle as 21 of Beast_Handle in Beastkin_Hash
          • Hashtable - Save Beast_Distance as 22 of Beast_Handle in Beastkin_Hash
          • Hashtable - Save (Beast_Slidedistance / 8.00) as 23 of Beast_Handle in Beastkin_Hash
          • Set TS_Loops = (TS_Loops + 1)
          • Custom script: call RemoveLocation(udg_TS_Point2)
          • Trigger - Turn on Tauren Smash Damage Check <gen>
      • Custom script: call RemoveLocation(udg_TS_Point1)
      • Set KnockbackLoops = (KnockbackLoops + 1)
      • Trigger - Turn on Knockback <gen>
  • Tauren Smash Damage Check
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TS_Group and do (Actions)
        • Loop - Actions
          • Set Beast_Knockbackunit = (Picked unit)
          • Custom script: set udg_Beast_Handle = GetHandleId(udg_Beast_Knockbackunit)
          • Set TS_Timer = (Load 7 of Beast_Handle from Beastkin_Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TS_Timer Not equal to 0.00
            • Then - Actions
              • Set TS_Health = (Load 6 of Beast_Handle from Beastkin_Hash)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TS_Health Less than or equal to (Life of Beast_Knockbackunit)
                • Then - Actions
                  • Hashtable - Clear all child hashtables of child TS_Handle in Beastkin_Hash
                  • Unit - Set Beast_Knockbackunit movement speed to (Default movement speed of Beast_Knockbackunit)
                  • Unit Group - Remove Beast_Knockbackunit from TS_Group
                  • Set TS_Loops = (TS_Loops - 1)
                  • Special Effect - Destroy (Load 9 of Beast_Handle in Beastkin_Hash)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TS_Loops Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
              • Hashtable - Save (TS_Timer - 0.10) as 7 of Beast_Handle in Beastkin_Hash
            • Else - Actions
              • Hashtable - Clear all child hashtables of child Beast_Handle in Beastkin_Hash
              • Unit - Set Beast_Knockbackunit movement speed to (Default movement speed of Beast_Knockbackunit)
              • Unit Group - Remove Beast_Knockbackunit from TS_Group
              • Set TS_Loops = (TS_Loops - 1)
              • Special Effect - Destroy (Load 9 of Beast_Handle in Beastkin_Hash)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TS_Loops Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
Just in case you're wondering, the hashtable values 20 and up are used for a universal knockback trigger I have between all my spells.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
where is TS_Damage???...

in else part of the loop, you should get the units back to normal first before clearing the hash, otherwise the Beast_Knockbackunit and sfx would lost data...

why TS_Loops there?, coz from what I noticed this >>> Set TS_Loops = (TS_Loops - 1) makes the timer expires really fast...put debug messages for this to test...
 
It doesn't need to be indexing, archangel told me that using an integer to check is more efficient. And TS_Damage is different values (not just multiples, its 65, 135, and 165) I used an array to put the value corresponding to level. It isn't about that stuff, its about the fact that the ms slow isn't working and neither does the timer
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
imagine, if you're using index your creating 1 'extra' variable and calling 2 if/then/else operations while if you use group is empty, no extra variable is needed plus calls only 1 if/then/else...so which is more efficient?...

also, Set TS_Loops = (TS_Loops - 1) is running 10 times faster because of the timer 0.1 so no wonder that your trigger is not working, to fix this you need a boolean setup then save it in hash to true, then when the spell is over set it to false then reduce the index...once again you're calling another function and creating 1 more variable...

like I said before, put a debug MSG for testing...or better give me a sample map...
 
Status
Not open for further replies.
Top