1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Solved] Memory Leak (random Hero)

Discussion in 'Triggers & Scripts' started by SunTzu7387, Jan 11, 2012.

  1. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    What Variable or Variables do I have to Destroy to stop this memory leak? +rep for any help.

    • Time - Elapsed game time is 20.00 seconds
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) controller) Equal to Computer
        • Then - Actions
          • Set Random_Hero = (Random integer number between 1 and 8)
          • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for Player 1 (Red) at (Player 1 (Red) start location) facing Default building facing degrees
          • Selection - Select (Last created unit) for (Owner of (Last created unit))
          • Hero - Create Scroll of Town Portal and give it to (Last created unit)
          • Hero - Create Potion of Greater Healing and give it to (Last created unit)
          • Hero - Create Ankh of Reincarnation and give it to (Last created unit)
          • Set Random_Data[Random_Hero] = Random_Count
          • Set Random_Count = (Random_Count - 1)
          • Trigger - Turn off (This trigger)
        • Else - Actions
     
  2. Freyleyes

    Freyleyes

    Joined:
    Jun 28, 2008
    Messages:
    766
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Well, if i am not mistaken you should best use a position var to create your hero at

    • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for Player 1 (Red) at tempPoint facing Default building facing degrees


    Where temp point is a position variable, and then it should be cleaned
     
  3. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    ok so i just make a point variable like u said (tempPoint) then I just do
    • Custom script: call RemoveLocation(udg_tempPoint)

    and that destroy's the leak?
     
  4. maddeem

    maddeem

    Joined:
    Jan 1, 2011
    Messages:
    1,325
    Resources:
    6
    Icons:
    1
    Maps:
    2
    Spells:
    3
    Resources:
    6
    • Set TempPoint = (Player 1 (Red) start location)
    • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for Player 1 (Red) at TempPoint facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_TempPoint)
     
  5. SunTzu7387

    SunTzu7387

    Joined:
    Mar 28, 2009
    Messages:
    66
    Resources:
    0
    Resources:
    0
    got it, thanx. Problem solved I think. plus rep for both of you. (maddeem I gave you rep earlier so I cant give you any now but I will give u rep as soon as i can).