• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Solved] Time Enhancement

Status
Not open for further replies.
Level 9
Joined
Dec 16, 2017
Messages
313
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 24
Joined
Feb 9, 2009
Messages
1,783
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 58
Joined
Aug 10, 2018
Messages
5,843
@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 9
Joined
Dec 16, 2017
Messages
313
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