• 🏆 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] Trigger Refuses to Work

Status
Not open for further replies.
Level 3
Joined
Feb 2, 2008
Messages
41
I have a trigger that is supposed to replace a space unit with a space unit that doesn't have any abilities if a unit that can attack is on it. However, it replaces all of the spaces on the board, which is not supposed to happen.
Here is the trigger:
  • Monster Space
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Move
    • Actions
      • For each (Integer A) from 1 to NumberofSpaces, do (Actions)
        • Loop - Actions
          • Set OtherPoint = (Position of FriendlySpaces[(Integer A)])
          • Set OtherUnitGroup = (Units within 50.00 of OtherPoint matching (((Matching unit) is Able to attack ground units) Equal to True))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Unit-type of FriendlySpaces[(Integer A)]) Equal to Space (Big)(No Move)
                  • (Number of units in OtherUnitGroup) Less than 1
            • Then - Actions
              • Unit - Replace FriendlySpaces[(Integer A)] with a Space (Big)(Move) using The old unit's relative life and mana
              • Set FriendlySpaces[(Integer A)] = (Last replaced unit)
              • Animation - Change FriendlySpaces[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
              • Unit - Change ownership of FriendlySpaces[(Integer A)] to Player 1 (Red) and Retain color
            • Else - Actions
              • Unit - Replace FriendlySpaces[(Integer A)] with a Space (Big)(No Move) using The old unit's relative life and mana
              • Set FriendlySpaces[(Integer A)] = (Last replaced unit)
              • Custom script: call RemoveLocation(udg_Point)
              • Custom script: call DestroyGroup(udg_UnitGroup)
      • For each (Integer A) from 1 to NumberofSpaces, do (Actions)
        • Loop - Actions
          • Set OtherPoint = (Position of FriendlySpaces[(Integer A)])
          • Set OtherUnitGroup = (Units within 50.00 of OtherPoint matching (((Matching unit) is Able to attack ground units) Equal to True))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Unit-type of FriendlySpaces[(Integer A)]) Equal to Space (Small)(No Move)
                  • (Number of units in OtherUnitGroup) Less than 1
            • Then - Actions
              • Unit - Replace FriendlySpaces[(Integer A)] with a Space (Small)(Move) using The old unit's relative life and mana
              • Set FriendlySpaces[(Integer A)] = (Last replaced unit)
              • Animation - Change FriendlySpaces[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
              • Unit - Change ownership of FriendlySpaces[(Integer A)] to Player 1 (Red) and Retain color
            • Else - Actions
              • Unit - Replace FriendlySpaces[(Integer A)] with a Space (Small)(No Move) using The old unit's relative life and mana
              • Set FriendlySpaces[(Integer A)] = (Last replaced unit)
              • Unit - Change ownership of FriendlySpaces[(Integer A)] to Player 1 (Red) and Retain color
              • Custom script: call RemoveLocation(udg_Point)
              • Custom script: call DestroyGroup(udg_UnitGroup)
Thanks in advance :thumbs_up:
 
Status
Not open for further replies.
Top