• 🏆 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!

Spell Trigger issue

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, why does this trigger nog function properly because of the "RemoveLocations". It triggers only once when i want it to trigger 3 times. It works perfectly if i remove the custom scripts but of course i want to clean the leaks...

  • Avalanche
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Avalanche
    • Actions
      • Set VariableSet Avalanche_Caster = (Triggering unit)
      • Set VariableSet Avalanche_Point = (Position of (Target unit of ability being cast))
      • Trigger - Turn on Avalanche Loop <gen>
  • Avalanche Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet Avalanche_Count = (Avalanche_Count + 1)
      • -------- --------
      • Set VariableSet Avalanche_DummyPoint = Avalanche_Point
      • Unit - Create 1 Avalanche Dummy for (Owner of Avalanche_Caster) at Avalanche_DummyPoint facing Default building facing degrees
      • Set VariableSet Avalanche_Dummy = (Last created unit)
      • Unit - Add Avalanche (Dummy) to Avalanche_Dummy
      • Unit - Set level of Avalanche (Dummy) for Avalanche_Dummy to (Level of Avalanche for Avalanche_Caster)
      • Unit - Add a 0.50 second Generic expiration timer to Avalanche_Dummy
      • -------- --------
      • Set VariableSet Avalanche_Level = (Level of Avalanche (Dummy) for Avalanche_Dummy)
      • Set VariableSet Avalanche_Amount = (Avalanche_Damage[Avalanche_Level] + (3.00 x (Real((Intelligence of Avalanche_Caster (Include bonuses))))))
      • Ability - Set Ability: (Unit: Avalanche_Dummy's Ability with Ability Code: Avalanche (Dummy))'s Real Level Field: Damage ('Htb1') of Level: (Avalanche_Level - 1) to Avalanche_Amount
      • -------- --------
      • Set VariableSet AvalancheLoop_Point = Avalanche_DummyPoint
      • Set VariableSet Avalanche_Group = (Units within 1000.00 of AvalancheLoop_Point.)
      • Unit Group - Pick every unit in Avalanche_Group and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of Avalanche_Caster).) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • Unit - Order Avalanche_Dummy to Human Mountain King - Storm Bolt (Picked unit)
            • Else - Actions
      • Custom script: call DestroyGroup (udg_Avalanche_Group)
      • Custom script: call RemoveLocation (udg_AvalancheLoop_Point)
      • Custom script: call RemoveLocation (udg_Avalanche_DummyPoint)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Avalanche_Count Greater than or equal to 3
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Set VariableSet Avalanche_Count = 0
          • Custom script: call RemoveLocation (udg_Avalanche_Point)
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,509
Your problem lies here:
  • Set VariableSet Avalanche_DummyPoint = Avalanche_Point
You're not setting Avalanche_DummyPoint to the same position as Avalanche_Point, you're instead setting it TO Avalanche_Point.

So when you do:
  • Custom script: call RemoveLocation (udg_Avalanche_DummyPoint)
You're actually removing Avalanche_Point.

Solution: Offset Avalanche_DummyPoint to create a new Point:
  • Set VariableSet Avalanche_DummyPoint = Avalanche_Point with Offset 0, 0
If that doesn't work then you can try some Custom script:
  • Custom script: set udg_Avalanche_DummyPoint = Location( GetLocationX(udg_Avalanche_Point), GetLocationY(udg_Avalanche_Point) )
 
Level 7
Joined
Feb 23, 2020
Messages
253
Your problem lies here:
  • Set VariableSet Avalanche_DummyPoint = Avalanche_Point
You're not setting Avalanche_DummyPoint to the same position as Avalanche_Point, you're instead setting it TO Avalanche_Point.

So when you do:
  • Custom script: call RemoveLocation (udg_Avalanche_DummyPoint)
You're actually removing Avalanche_Point.

Solution: Offset Avalanche_DummyPoint to create a new Point:
  • Set VariableSet Avalanche_DummyPoint = Avalanche_Point with Offset 0, 0
If that doesn't work then you can try some Custom script:
  • Custom script: set udg_Avalanche_DummyPoint = Location( GetLocationX(udg_Avalanche_Point), GetLocationY(udg_Avalanche_Point) )

Yes sir it works now, thank you very much!
 
Status
Not open for further replies.
Top