• 🏆 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!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Spelleffects won't be destroyed if another unit with the same spell casts it at the same time.

Status
Not open for further replies.
Level 14
Joined
Jul 19, 2007
Messages
774
Well I got some spells in my map which uses triggers to make some spelleffects before the spell is cast but the problem is if there is more than one of that unit which casts the same spell at the same time, the spelleffect isn't gone... It's a bit hard to explain but I hope you get it.
Here is the triggers...
  • Star Spells
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Star Serious Laser
          • (Ability being cast) Equal to Star Sensitive Inferno
          • (Ability being cast) Equal to Star Gentle Uterus
    • Actions
      • Set VariableSet StarIndex = (StarIndex + 1)
      • Set VariableSet StarCount[StarIndex] = 0
      • Special Effect - Create a special effect attached to the left hand of (Triggering unit) using war3mapImported\WaterAurora.mdx
      • Set VariableSet StarEffect[StarIndex] = (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StarIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on Star Spells periodic <gen>
        • Else - Actions
  • Star Spells periodic
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer LoopInteger) from 1 to StarIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • StarCount[LoopInteger] Greater than or equal to 3
            • Then - Actions
              • Special Effect - Destroy StarEffect[LoopInteger]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • StarIndex Not equal to LoopInteger
                • Then - Actions
                  • Set VariableSet StarCount[LoopInteger] = StarCount[StarIndex]
                  • Set VariableSet StarEffect[LoopInteger] = StarEffect[StarIndex]
                  • Set VariableSet LoopInteger = (LoopInteger - 1)
                • Else - Actions
              • Set VariableSet StarIndex = (StarIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • StarIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • Set VariableSet StarCount[LoopInteger] = (StarCount[LoopInteger] + 1)
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
It looks like you want a Special Effect to appear while the unit is channeling and then disappear when it stops.

If so, the trigger is very simple, using a Unit Indexer do this:
  • Star Spells
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Star Serious Laser
          • (Ability being cast) Equal to Star Sensitive Inferno
          • (Ability being cast) Equal to Star Gentle Uterus
    • Actions
      • Special Effect - Create a special effect attached to the left hand of (Triggering unit) using war3mapImported\WaterAurora.mdx
      • Set VariableSet StarEffect[Custom value of (Triggering unit)] = (Last created special effect)
  • Star Spells
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Star Serious Laser
          • (Ability being cast) Equal to Star Sensitive Inferno
          • (Ability being cast) Equal to Star Gentle Uterus
    • Actions
      • Special Effect - Destroy StarEffect[Custom value of (Triggering unit)]
So this links the Special Effect to the Unit by using it's custom value as the [index] in your Special Effect array. And the Unit Indexer guarantees that each Unit will have it's own unique custom value so the [indexes] will never conflict with one another.
 
Last edited:
Level 14
Joined
Jul 19, 2007
Messages
774
It looks like you want a Special Effect to appear while the unit is channeling and then disappear when it stops.

If so, the trigger is very simple, using a Unit Indexer do this:
  • Star Spells
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Star Serious Laser
          • (Ability being cast) Equal to Star Sensitive Inferno
          • (Ability being cast) Equal to Star Gentle Uterus
    • Actions
      • Special Effect - Create a special effect attached to the left hand of (Triggering unit) using war3mapImported\WaterAurora.mdx
      • Set VariableSet StarEffect[Custom value of (Triggering unit)] = (Last created special effect)
  • Star Spells
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Star Serious Laser
          • (Ability being cast) Equal to Star Sensitive Inferno
          • (Ability being cast) Equal to Star Gentle Uterus
    • Actions
      • Special Effect - Destroy StarEffect[Custom value of (Triggering unit)]
So this links the Special Effect to the Unit by using it's custom value as the [index] in your Special Effect array. And the Unit Indexer guarantees that each Unit will have it's own unique custom value so the [indexes] will never conflict with one another.
I want it to appear and disappear every 0.50 seconds of the casting time because it has a casting time of 1.75 sec and it seems to work fine as long as not another unit with one of these three spells is casting it at the same time, then the effect wont be gone...
 
Status
Not open for further replies.
Top