[Solved] Possible leak in this trigger?

Status
Not open for further replies.
Hey there. I've been making a trigger that creates another unit upon construction of a specific tower. The unit will never die (has reincarnation 0 cd) unless the tower itself is destroyed. Here's the trigger:
  • Tower Revenant
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Revenant Tower
    • Actions
      • Set Tower_Building = (Triggering unit)
      • Set Tower_TempPoint = (Position of Tower_Building)
      • Set Tower_Value = (Custom value of Tower_Building)
      • Unit - Create 1 Castle Revenant for (Owner of Tower_Building) at Tower_TempPoint facing Default building facing (270.0) degrees
      • Set Tower_Revenant[Tower_Value] = (Last created unit)
      • Custom script: call RemoveLocation(udg_Tower_TempPoint)
  • Tower Revenant Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to (==) Revenant Tower
    • Actions
      • Set Tower_Building = (Triggering unit)
      • Set Tower_TempPoint = (Position of Tower_Building)
      • Set Tower_Value = (Custom value of Tower_Building)
      • Unit - Remove Revenant Revival from Tower_Revenant[Tower_Value]
      • Unit - Add a 0.01 second Generic expiration timer to Tower_Revenant[Tower_Value]
      • Custom script: call RemoveLocation(udg_Tower_TempPoint)
Any help will be largely credited since I've been working on this for quite a while now and it still baffles me. I'm quite sure something in this is leaking the trigger.
 
  • Tower Revenant
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to (==) Revenant Tower
    • Actions
      • Set Tower_Building = (Triggering unit)
      • Set Tower_TempPoint = (Position of Tower_Building)
      • Unit - Set the custom value of Tower_Building to (Random integer number between 1 and 1000000000)
      • Set Tower_Value = (Custom value of Tower_Building)
      • Unit - Create 1 Castle Revenant for (Owner of Tower_Building) at Tower_TempPoint facing Default building facing (270.0) degrees
      • Set Tower_Revenant[Tower_Value] = (Last created unit)
      • Unit - Set the custom value of Tower_Revenant[Tower_Value] to Tower_Value
      • Custom script: call RemoveLocation(udg_Tower_TempPoint)
 
I have no idea then, and I don't use GUI so I don't know what could be going wrong.

Try printing Custom Values out when you create/destroy the building. I just realized it's not even necessary to set the Revenant's custom value, only the tower needs it, I was kind of confused at what exactly needs to happen.

Anyways, try to debug it yourself, print out values, see what's going wrong.
 
Status
Not open for further replies.
Back
Top