• 🏆 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] AOE Fear Spell

Status
Not open for further replies.
Level 4
Joined
Apr 22, 2020
Messages
53
Hi

I have an issue with a spell.

When I cast it one time, everything works perfectly.

But when I cast it two times in a row, units don't get back to their owner correctly. (2 get back but not the third one)

I don't get what I am doing wrong

[PS: Uncle if you read this, I've first made this spell as you show me how to do with my charmspell and using local variables. But after some "beta tests" I've experienced some bugs with this like some units who don't get back to their owners. Both fear spell or charm spell]

  • Fear2
    • Evénements
      • Unité - A unit Initie l'effet d'une compétence
    • Conditions
      • (Ability being cast) Egal à Fear
      • ((Owner of (Triggering unit)) Or actuel) Supérieur ou égal à 10
    • Actions
      • Joueur - Add -10 to (Owner of (Triggering unit)) Or actuel
      • Effet spécial - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Other\HowlOfTerror\HowlCaster.mdl
      • Effet spécial - Destroy (Last created special effect)
      • Custom script: set bj_wantDestroyGroup = true
      • Groupe unité - Pick every unit in (Units within 400.00 of (Position of (Triggering unit))) and do (Actions)
        • Boucle - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • (Item-type of (Item carried by (Picked unit) in slot 1)) Différent de Veil of Virtue
              • (Unit-type of (Picked unit)) Différent de Cleric
              • (Unit-type of (Picked unit)) Différent de Fury
              • (Unit-type of (Picked unit)) Différent de Paladin
              • (Unit-type of (Picked unit)) Différent de Zombie
              • (Unit-type of (Picked unit)) Différent de Gargoyl
              • (Unit-type of (Picked unit)) Différent de Ghoul
              • (Unit-type of (Picked unit)) Différent de Wraith
              • ((Picked unit) belongs to an enemy of (Triggering player)) Egal à TRUE
              • ((Picked unit) is alive) Egal à TRUE
              • ((Picked unit) is Un bâtiment) Egal à FALSE
            • Alors - Actions
              • Set Fear_Index = (Fear_Index + 1)
              • Set Fear_Counter[Fear_Index] = 0
              • Set Fear_Unit[Fear_Index] = (Picked unit)
              • Set Fear_Owner2[Fear_Index] = (Owner of (Picked unit))
              • Set Fear_UnitGroup[Fear_Index] = (Units within 400.00 of (Position of (Triggering unit)) matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Egal à TRUE) and (((Unit-type of (Matching unit)) Différent de Zombie) and (((Unit-type of (Matching unit)) Différent d
              • Unité - Change ownership of Fear_Unit[Fear_Index] to Joueur 12 (Marron) and Changer couleur
              • Effet spécial - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Other\HowlOfTerror\HowlCaster.mdl
              • Effet spécial - Destroy (Last created special effect)
              • Effet spécial - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Other\HowlOfTerror\HowlTarget.mdl
              • Set Fear_Buff2[Fear_Index] = (Last created special effect)
            • Sinon - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • Fear_Index Supérieur ou égal à 1
        • Alors - Actions
          • Déclencheur - Turn on Fear Loop <gen>
        • Sinon - Actions
  • Fear Loop
    • Evénements
      • Temps - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Fear_LoopInteger) from 1 to Fear_Index, do (Actions)
        • Boucle - Actions
          • Set Fear_EffectIntegerLoop[Fear_LoopInteger] = (Fear_EffectIntegerLoop[Fear_LoopInteger] + 1)
          • Set Fear_Counter[Fear_LoopInteger] = (Fear_Counter[Fear_LoopInteger] + 1)
          • Groupe unité - Order Fear_UnitGroup[Fear_LoopInteger] to Avancer vers (Random point in (Playable map area))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Si - Conditions
              • Fear_Counter[Fear_LoopInteger] Egal à 16
            • Alors - Actions
              • Groupe unité - Order Fear_UnitGroup[Fear_LoopInteger] to Arrêter
              • Effet spécial - Destroy Fear_Buff2[Fear_LoopInteger]
              • Unité - Change ownership of Fear_Unit[Fear_LoopInteger] to Fear_Owner2[Fear_LoopInteger] and Changer couleur
              • Set Fear_Buff2[Fear_LoopInteger] = Fear_Buff2[Fear_Index]
              • Set Fear_Owner2[Fear_LoopInteger] = Fear_Owner2[Fear_Index]
              • Set Fear_Unit[Fear_LoopInteger] = Fear_Unit[Fear_Index]
              • Set Fear_Counter[Fear_LoopInteger] = Fear_Counter[Fear_Index]
              • Set Fear_UnitGroup[Fear_LoopInteger] = Fear_UnitGroup[Fear_Index]
              • Set Fear_Index = (Fear_Index - 1)
              • Set Fear_LoopInteger = (Fear_LoopInteger - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • Si - Conditions
                  • Fear_Index Egal à 0
                • Alors - Actions
                  • Déclencheur - Turn off (This trigger)
                • Sinon - Actions
            • Sinon - Actions
 
Last edited:
Level 13
Joined
Jul 15, 2007
Messages
763
Could it be because the spell can affect units that are already feared? (triggers aren't english so hard to tell)

E.g. if a unit switches from player 1 to player 12, and then the spell is cast 1 second later on the same target, so the unit "switches" from player 12 to player 12. When the first instance expires, the unit will return to player 1, but when the 2nd instance expires, the unit will return to player 12.
 
Status
Not open for further replies.
Top