• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Is this wait leaking?

Status
Not open for further replies.
Level 4
Joined
Dec 21, 2019
Messages
51
Hey there, i was ondering if this wait is leaking or causing problems?
Hence this is a TD map, i was wondering if this will overwrite if it happens on multiple towers simulatenously ? so 1 BladestormUnit is not removed when another unit procs in that 1 second wait? Or does wc3 start this trigger twice and is able to just handle this task multiple times simulatenously without loosing track of the individual units with the same name/variable?
I just want to make sure all dummys disappear, if someone has a solution/explanation it'd be great!
Cheers!

  • DrBest
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to |cffd45e19Dr. Best|r
    • Actions
      • Set VariableSet DrBestProc = (Random integer number between 1 and 20)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DrBestProc Equal to 9
        • Then - Actions
          • Set VariableSet DrBestPoint = (Position of (Attacking unit))
          • Unit - Create 1 BladestormDummy for (Owner of (Attacking unit)) at DrBestPoint facing Default building facing degrees
          • Set VariableSet BladestormUnit = (Last created unit)
          • Custom script: call RemoveLocation (udg_DrBestPoint)
          • Unit - Order BladestormUnit to Orc Blademaster - Bladestorm.
          • Wait 1.00 seconds
          • Unit - Remove BladestormUnit from the game
        • Else - Actions
 
Level 4
Joined
Dec 21, 2019
Messages
51
I maybe got it, does this solve the problem? or is a decay not deleting the unit?

  • DrBest
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to |cffd45e19Dr. Best|r
    • Actions
      • Set VariableSet DrBestProc = (Random integer number between 1 and 20)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DrBestProc Equal to 9
        • Then - Actions
          • Set VariableSet DrBestPoint = (Position of (Attacking unit))
          • Unit - Create 1 BladestormDummy for (Owner of (Attacking unit)) at DrBestPoint facing Default building facing degrees
          • Set VariableSet BladestormUnit = (Last created unit)
          • Unit - Order BladestormUnit to Orc Blademaster - Bladestorm.
          • Unit - Add a 1.01 second Generic expiration timer to BladestormUnit
          • Custom script: call RemoveLocation (udg_DrBestPoint)
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
The first trigger has problems because BladestormUnit can only be Set to one unit at a time. If during that 1.00 second Waiting period the trigger were to run again and DrBestProc was successful then it would Set BladestormUnit AGAIN to the newly created dummy unit. Your previous dummy unit will no longer be getting tracked by the BladestormUnit variable so when it comes time to "Unit - Remove BladestormUnit from the game", it'll be referencing the new dummy rather than the old one.

This will result in your new dummy getting removed prematurely while your old dummy never gets removed at all.

That being said, your solution is correct and is the standard method for removing Dummy units. Expiration timers are what summoned units like Water Elementals use. After X seconds the unit is killed, no Waits involved.

If you want to save yourself a Variable, I would restructure it to this:
  • Then - Actions
  • Set VariableSet DrBestPoint = (Position of (Attacking unit))
  • Unit - Create 1 BladestormDummy for (Owner of (Attacking unit)) at DrBestPoint facing Default building facing degrees
  • Unit - Add a 1.01 second Generic expiration timer to (Last created unit)
  • Unit - Order (Last created unit) to Orc Blademaster - Bladestorm.
  • Custom script: call RemoveLocation (udg_DrBestPoint)
When ordering Dummy units to cast spells I recommend doing it after all of the other dummy preparations are complete. This is just to be safe, since orders/casting spells can sometimes cause other triggers to run. But the way your trigger is now is 100% fine.
 
Last edited:
Level 4
Joined
Dec 21, 2019
Messages
51
The first trigger has problems because BladestormUnit can only be Set to one unit at a time. If during that 1.00 second Wait the trigger were to run again and DrBestProc was successful then it would Set BladestormUnit AGAIN to the newly created dummy unit. Your previous dummy unit will no longer be getting tracked by the BladestormUnit variable so when it comes time to "Unit - Remove BladestormUnit from the game", it'll be referencing the new dummy rather than the old one.

This would result in your new dummy getting removed prematurely while your old dummy never gets removed at all.

That being said, your solution is correct and is the standard method for removing Dummy units. Expiration timers are what summoned units like Water Elementals use. After X seconds the unit is killed, no Waits involved.
Thank you for the explanation @Uncle ! Incredibly fast and precise.
appreciate it, its always a pleasure.
 
Status
Not open for further replies.
Top