• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Time Enhancement

Status
Not open for further replies.
Level 10
Joined
Dec 16, 2017
Messages
405
Hello guys,i am having a little issue here regarding removing abilities from hero and get the SFX destroyed. What shall i change? I have some spells where i create the SFX and destroy it the same way i do in this spell, but for some reason it doesn't remove.
  • Time Enhancement Talent Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Time Warp (Chronomancer TIMER)
      • (Current research level of Time Enhancement (Chronomancer Talent) for (Owner of (Triggering unit))) Greater than or equal to 1
    • Actions
      • Set TE_Index = (TE_Index + 1)
      • Set TE_Caster[TE_Index] = (Triggering unit)
      • Set TE_Target[TE_Index] = (Target unit of ability being cast)
      • Set TE_Spell1[TE_Index] = Time Enhancement All Stats (Chronomancer-Talent)
      • Set TE_Spell2[TE_Index] = Time Enhancement Armor (Chronomancer-Talent)
      • Set TE_Spell3[TE_Index] = Time Enhancement Attack (Chronomancer-Talent)
      • Set TE_Spell4[TE_Index] = Time Enhancement Lifesteal (Chronomancer-Talent)
      • Set TE_Duration[TE_Index] = 10
      • Special Effect - Create a special effect attached to the origin of TE_Target[TE_Index] using SoulArmor.mdx
      • Set TE_SFX[TE_Index] = (Last created special effect)
      • Unit - Add TE_Spell1[TE_Index] to TE_Caster[TE_Index]
      • Unit - Add TE_Spell2[TE_Index] to TE_Caster[TE_Index]
      • Unit - Add TE_Spell3[TE_Index] to TE_Caster[TE_Index]
      • Unit - Add TE_Spell4[TE_Index] to TE_Caster[TE_Index]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TE_Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Time Enhancement Talent Loop <gen>
        • Else - Actions
  • Time Enhancement Talent Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TE_Loop) from 1 to TE_Index, do (Actions)
        • Loop - Actions
          • Set TE_Duration[TE_Loop] = (TE_Duration[TE_Loop] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TE_Duration[TE_Loop] Greater than or equal to 0
              • (TE_Target[TE_Loop] is alive) Equal to True
            • Then - Actions
              • Unit - Set life of TE_Target[TE_Loop] to ((Life of TE_Target[TE_Loop]) + 50.00)
              • Special Effect - Create a special effect attached to the chest of TE_Target[TE_Loop] using HealTargetBlack005.mdx
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Unit - Remove TE_Spell1[TE_Loop] from TE_Caster[TE_Loop]
              • Unit - Remove TE_Spell2[TE_Loop] from TE_Caster[TE_Loop]
              • Unit - Remove TE_Spell3[TE_Loop] from TE_Caster[TE_Loop]
              • Unit - Remove TE_Spell4[TE_Loop] from TE_Caster[TE_Loop]
              • Special Effect - Destroy TE_SFX[TE_Loop]
              • Set TE_Caster[TE_Loop] = TE_Caster[TE_Index]
              • Set TE_Target[TE_Loop] = TE_Target[TE_Index]
              • Set TE_Duration[TE_Loop] = TE_Duration[TE_Index]
              • Set TE_Spell1[TE_Loop] = TE_Spell1[TE_Index]
              • Set TE_Spell2[TE_Loop] = TE_Spell2[TE_Index]
              • Set TE_Spell3[TE_Loop] = TE_Spell3[TE_Index]
              • Set TE_Spell4[TE_Loop] = TE_Spell4[TE_Index]
              • Set TE_Index = (TE_Index - 1)
              • Set TE_Loop = (TE_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • TE_Index Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 25
Joined
Feb 9, 2009
Messages
1,798
TE_Sfx is not deindexed, you destroyed the sfx but the variable isn't reshuffled back into the index.

Noticed it when I hit CTRL + F on this page and looked for "TF_SFX" and found only two results in your triggers.
Add "Set TE_SFX[TE_Loop] = TE_SFX[TE_Index]" when you end the spell.


If you set a variable with "[Index]" you must de-index!
Go through this tutorial for more detail.
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,397
@P3in
There's no reason to make the TE_Spell1/2/3/4 variables into Arrays assuming these are always going to be the same abilities.
If that's the case then you can use a single array to track them:
  • Set Variable TE_Spell[0] = All Stats
  • Set Variable TE_Spell[1] = Armor
  • Set Variable TE_Spell[2] = Attack
  • Set Variable TE_Spell[3] = Lifesteal
And remove them:
  • Unit - Remove TE_Spell[0] TE_Caster[TE_Loop]
  • Unit - Remove TE_Spell[1] TE_Caster[TE_Loop]
  • Unit - Remove TE_Spell[2] TE_Caster[TE_Loop]
  • Unit - Remove TE_Spell[3] TE_Caster[TE_Loop]
Edit: And what Devalut said.
 
Last edited:
Level 10
Joined
Dec 16, 2017
Messages
405
I've found the mistake, i was turning on another trigger with similar name.

But yeah, forgot to deindex the sfx too 😄

I've made those variables for the spells like that so i can change later and they won't be the dame.

Thanks again!
 
Status
Not open for further replies.
Top