• 🏆 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] Spell stopped working out of nowhere!?

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
497
Hello, here's what the spell is: Throw weapon in a line, deal damage to first enemy hit and slow it. Destroy projectile after contact.
It worked perfectly fine and out of the nowhere it stopped working.
Now here's the following bugs:
-When it hits a unit and it doesn't kill it it works fine, but when the unit dies, the projectile continues to fly until it hits something again (or expires).
How do I fix this?
P.S: If I try to kill the projectile first before the damage is dealt, no damage is dealt at all nor does the slow work, but the special effects still work. (No idea why this happens)
  • Cleaver
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Cleaver
    • Actions
      • Set spCleaverIndex = (spCleaverIndex + 1)
      • Set spCleaverMui = (spCleaverMui + 1)
      • Set spCleaverCaster[spCleaverMui] = (Triggering unit)
      • Set tempPoint[0] = (Position of (Triggering unit))
      • Set tempPoint[1] = (Target point of ability being cast)
      • Unit - Create 1 Cleaver for (Owner of (Triggering unit)) at tempPoint[0] facing tempPoint[1]
      • Unit - Add a 0.75 second Generic expiration timer to (Last created unit)
      • Set spCleaverDummy[spCleaverMui] = (Last created unit)
      • Custom script: call RemoveLocation(udg_tempPoint[0])
      • Custom script: call RemoveLocation(udg_tempPoint[1])
      • Trigger - Turn on Cleaver Loop <gen>
  • Cleaver Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to spCleaverMui, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (spCleaverDummy[(Integer A)] is alive) Equal to True
            • Then - Actions
              • Set tempPoint[0] = (Position of spCleaverDummy[(Integer A)])
              • Set tempPoint[1] = (tempPoint[0] offset by 35.00 towards (Facing of spCleaverDummy[(Integer A)]) degrees)
              • Unit - Move spCleaverDummy[(Integer A)] instantly to tempPoint[1]
              • Set tempGroup[0] = (Units within 100.00 of tempPoint[0] matching ((((Matching unit) belongs to an enemy of (Owner of spCleaverCaster[(Integer A)])) Equal to True) and (((Matching unit) is alive) Equal to True)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in tempGroup[0]) Greater than 0
                • Then - Actions
                  • Unit Group - Pick every unit in tempGroup[0] and do (Actions)
                    • Loop - Actions
                      • Set tempPoint[2] = (Position of (Picked unit))
                      • Unit - Create 1 Cleaver (Slow) for (Owner of spCleaverCaster[(Integer A)]) at tempPoint[2] facing Default building facing degrees
                      • Unit - Add a 0.30 second Generic expiration timer to (Last created unit)
                      • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                      • Unit - Cause spCleaverCaster[(Integer A)] to damage (Picked unit), dealing ((30.00 + (50.00 x (Real((Level of Cleaver for spCleaverCaster[(Integer A)]))))) + (1.70 x (Real((Strength of spCleaverCaster[(Integer A)] (Include bonuses)))))) damage of attack type Hero and damage type Normal
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Weapons\GlaiveMissile\GlaiveMissileTarget.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Kill spCleaverDummy[(Integer A)]
                      • Custom script: call RemoveLocation(udg_tempPoint[2])
                • Else - Actions
              • Custom script: call RemoveLocation(udg_tempPoint[0])
              • Custom script: call RemoveLocation(udg_tempPoint[1])
              • Custom script: call DestroyGroup(udg_tempGroup[0])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • spCleaverDummy[(Integer A)] Not equal to No unit
                • Then - Actions
                  • Set spCleaverDummy[(Integer A)] = No unit
                  • Set spCleaverIndex = (spCleaverIndex - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • spCleaverIndex Less than or equal to 0
                    • Then - Actions
                      • Set spCleaverIndex = 0
                      • Set spCleaverMui = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
 
  • Killing a unit will fire triggers that registered "Unit - A unit dies" event
  • If "Integer A" is used/changed in such a Unit-Death trigger, this this is bad, so after your "Unit cause damage" line, IntegerA would hold a different value then
  • The usage of the indices/mui-called variable seems a bit werid.
Try following
  • Use one own variable for "MaxIndex" of your spell, this is always +1 at cast
  • Use one own variable always for your "CurrentIndex" of your spell, this will be aways the currently used index
  • Change"IntegerA Loop" to "Custom Integer Loop" and use there the current index variable.
  • Also have a look for the dexining here Visualize: Dynamic Indexing
 
Level 11
Joined
Jun 26, 2014
Messages
497
  • Killing a unit will fire triggers that registered "Unit - A unit dies" event
  • If "Integer A" is used/changed in such a Unit-Death trigger, this this is bad, so after your "Unit cause damage" line, IntegerA would hold a different value then
  • The usage of the indices/mui-called variable seems a bit werid.
Try following
  • Use one own variable for "MaxIndex" of your spell, this is always +1 at cast
  • Use one own variable always for your "CurrentIndex" of your spell, this will be aways the currently used index
  • Change"IntegerA Loop" to "Custom Integer Loop" and use there the current index variable.
  • Also have a look for the dexining here Visualize: Dynamic Indexing

I make my MUI and Index variables for each spells, but the problem really was using a different IntegerA for all my MUI loops, thank you.
 
Status
Not open for further replies.
Top