1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Spell stopped working out of nowhere!?

Discussion in 'Triggers & Scripts' started by Krakenn99, Mar 23, 2019.

  1. Krakenn99

    Krakenn99

    Joined:
    Jun 26, 2014
    Messages:
    480
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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
     
  2. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,162
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    • 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
     
  3. Krakenn99

    Krakenn99

    Joined:
    Jun 26, 2014
    Messages:
    480
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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.