• 🏆 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] MUI ability bugged

Status
Not open for further replies.
I tried to make a MUI ability but it's is bugged and I don't know what's wrong.
Here is the trigger
  • DisembowelStart
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Disembowel (Neutral Hostile)
    • Actions
      • -------- Indexing --------
      • Set DBCurrentIndex = (DBCurrentIndex + 1)
      • Set DBMaxIndex = (DBMaxIndex + 1)
      • -------- Configurable --------
      • Set DBTarget[DBMaxIndex] = (Target unit of ability being cast)
      • Set DBCaster[DBMaxIndex] = (Triggering unit)
      • Set DBDamagePS[DBMaxIndex] = 35.00
      • Set DBHealPS[DBMaxIndex] = 10.00
      • Set DBDuration[DBMaxIndex] = 10.00
      • Set DBEffect[DBMaxIndex] = Objects\Spawnmodels\Undead\UndeadBlood\UndeadBloodNecromancer.mdl
      • Unit - Make DBCaster[DBMaxIndex] Invulnerable
      • Animation - Play DBCaster[DBMaxIndex]'s stand channel animation
      • -------- Run Loop --------
      • Trigger - Turn on DisembowelLoop <gen>
  • DisembowelLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DBCurrentIndex) from 1 to DBMaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DBTarget[DBCurrentIndex] is alive) Equal to True
              • DBDuration[DBCurrentIndex] Greater than 0.00
            • Then - Actions
              • Set DBDuration[DBCurrentIndex] = (DBDuration[DBCurrentIndex] - 0.03)
              • Set DBTargetLoc[DBCurrentIndex] = (Position of DBTarget[DBCurrentIndex])
              • Set DBCasterLoc[DBCurrentIndex] = (Position of DBCaster[DBCurrentIndex])
              • Unit - Move DBCaster[DBCurrentIndex] instantly to (DBTargetLoc[DBCurrentIndex] offset by -100.00 towards (Facing of DBCaster[DBCurrentIndex]) degrees), facing (Angle from DBCasterLoc[DBCurrentIndex] to DBTargetLoc[DBCurrentIndex]) degrees
              • Unit - Cause DBCaster[DBCurrentIndex] to damage DBTarget[DBCurrentIndex], dealing (DBDamagePS[DBCurrentIndex] / 33.00) damage of attack type Normal and damage type Normal
              • Unit - Set life of DBCaster[DBCurrentIndex] to ((Life of DBCaster[DBCurrentIndex]) + (DBHealPS[DBCurrentIndex] / 33.00))
              • Special Effect - Create a special effect attached to the chest of DBTarget[DBCurrentIndex] using DBEffect[DBCurrentIndex]
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation( udg_DBTargetLoc[udg_DBCurrentIndex] )
              • Custom script: call RemoveLocation( udg_DBCasterLoc[udg_DBCurrentIndex] )
            • Else - Actions
              • Unit - Make DBCaster[DBCurrentIndex] Vulnerable
              • Animation - Play DBCaster[DBCurrentIndex]'s stand animation
              • Set DBCurrentIndex = (DBCurrentIndex - 1)
              • Set DBMaxIndex = (DBMaxIndex - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DBMaxIndex Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
The bug is that sometimes it fails to make the caster vulnerable again and fail to play it's stand animation at the end when multiple instance occurs.
Also when multipe instance it update duration off all instance and they all end at the same time of the last instance.
I think my indexing is not right but I don't know how.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Remove this line in your indexing trigger. It is completely useless.
  • Set DBCurrentIndex = (DBCurrentIndex + 1)
This leaks a location.
  • (DBTargetLoc[DBCurrentIndex] offset by -100.00 towards (Facing of DBCaster[DBCurrentIndex]) degrees), facing (Angle from DBCasterLoc[DBCurrentIndex] to DBTargetLoc[DBCurrentIndex])
Your main problem that is causing this to fail is that you never de-index your spell instances.

Look at my tutorial Things you should know when using Triggers / GUI. The chapter on how to index will show you how to index and de-index your spell.
 
Ah thank you I deindex caster target and duration like this and it worked.
  • DisembowelLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer DBCurrentIndex) from 1 to DBMaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DBTarget[DBCurrentIndex] is alive) Equal to True
              • DBDuration[DBCurrentIndex] Greater than 0.00
            • Then - Actions
              • Set DBDuration[DBCurrentIndex] = (DBDuration[DBCurrentIndex] - 0.03)
              • Set DBTargetLoc[DBCurrentIndex] = (Position of DBTarget[DBCurrentIndex])
              • Set DBCasterLoc[DBCurrentIndex] = (Position of DBCaster[DBCurrentIndex])
              • Set DBEffectLoc[DBCurrentIndex] = (DBTargetLoc[DBCurrentIndex] offset by -100.00 towards (Angle from DBCasterLoc[DBCurrentIndex] to DBTargetLoc[DBCurrentIndex]) degrees)
              • Unit - Move DBCaster[DBCurrentIndex] instantly to DBEffectLoc[DBCurrentIndex], facing (Angle from DBCasterLoc[DBCurrentIndex] to DBTargetLoc[DBCurrentIndex]) degrees
              • Unit - Cause DBCaster[DBCurrentIndex] to damage DBTarget[DBCurrentIndex], dealing (DBDamagePS[DBCurrentIndex] / 33.00) damage of attack type Normal and damage type Normal
              • Unit - Set life of DBCaster[DBCurrentIndex] to ((Life of DBCaster[DBCurrentIndex]) + (DBHealPS[DBCurrentIndex] / 33.00))
              • Special Effect - Create a special effect attached to the chest of DBTarget[DBCurrentIndex] using DBEffect[DBCurrentIndex]
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation( udg_DBTargetLoc[udg_DBCurrentIndex] )
              • Custom script: call RemoveLocation( udg_DBCasterLoc[udg_DBCurrentIndex] )
              • Custom script: call RemoveLocation( udg_DBEffectLoc[udg_DBCurrentIndex] )
            • Else - Actions
              • Unit - Make DBCaster[DBCurrentIndex] Vulnerable
              • Animation - Play DBCaster[DBCurrentIndex]'s stand animation
              • Set DBCaster[DBCurrentIndex] = DBCaster[DBMaxIndex]
              • Set DBCaster[DBMaxIndex] = No unit
              • Set DBTarget[DBCurrentIndex] = DBTarget[DBMaxIndex]
              • Set DBTarget[DBMaxIndex] = No unit
              • Set DBDuration[DBCurrentIndex] = DBDuration[DBMaxIndex]
              • Set DBDuration[DBMaxIndex] = 0.00
              • Set DBMaxIndex = (DBMaxIndex - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DBMaxIndex Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
Should I deindex more thing like damage, effect strings?
 
You should deindex dynamicly. Have a look in the tutorial "Dynamic Indexing" in my signure. There, it' explained very well!

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DBMaxIndex Equal to 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
^This can be moved into your deindex part.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
You should deindex dynamicly. Have a look in the tutorial "Dynamic Indexing" in my signure. There, it' explained very well!

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DBMaxIndex Equal to 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
^This can be moved into your deindex part.

He is de-indexing dynamically.

@TO

You need to reduce the looping integer after you reduce the maxIndex integer.
As said above this should be done.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DBMaxIndex Equal to 0
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
^This can be moved into your deindex part.
 
Status
Not open for further replies.
Top