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

Memory leak help

Status
Not open for further replies.
Level 3
Joined
Mar 30, 2007
Messages
26
I'm not good with solving memory leaks. Here's my prob.
memoryleakprobsk7.jpg

I have these two triggers to spawn a group of units every 2 seconds, and order them to attack a random unit in a unit group. Of course, the game slows down considerably after a while (particularly, the game freezes for a split second every time more new units are spawned). How should I fix this?

Also on a side note: All the units spawned will have been destroyed after the above trigger is finished.

EDIT: Nevermind. It turns out I just had some invisible corpses. Problem fixed now
 
Last edited:
Level 5
Joined
Nov 14, 2007
Messages
161
eh, didnt see your edit until after i finished doing your 2nd trigger: but anyway

your temp point never actually gets used for where they spawn, so that leaks a location until you change it how you probably thought about it. also one of your unit groups leaks. simply put a custom script above it and problem solved. as you found out when it does unit groups it will gather every living/corpse/invisible/enemy so if there are alot of units in the region might wanna add them to a group when they get spawned, and remove them when they die, may lead to less lag later on.

heres my trigger:

  • wave 1 spawn
    • Events
    • Conditions
    • Actions
      • Set Temp_Point = (Center of Super Lame Region <gen>)
      • Unit - Create (7 + (1 + (Number of players))) Footman for Player 9 (Gray) at Temp_Point facing Default building facing degrees
      • Set Temp_Unit_Group = (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 9 (Gray)) Equal to True) and (((Triggering unit) is A Hero) Equal to True)))
      • -------- the following custom script deletes the unit group after its done using it --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units owned by Player 9 (Gray)) and do (Actions)
        • Loop - Actions
          • Set Temp_Unit = (Random unit from Temp_Unit_Group)
          • Unit - Order (Picked unit) to Attack Temp_Unit
          • Set Temp_Unit = No unit
      • Custom script: call DestoryGroup(udg_Temp_Unit_Group)
      • Custom script: call RemoveLocation(udg_Temp_Point)
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
PS, Prince Panda: Use the [ TRIGGER ] tags to create triggers. Simply right-click the trigger in the Trigger Editor and choose Copy As Text. Then paste it between the TRIGGER tags and you'll get a perfect trigger layout like YO_MA_MA posted. :wink:
 
Level 4
Joined
Nov 24, 2007
Messages
55
I'm curious, how did you fix the corpse issue? I am having a similar issue in my map with so many things being summoned and Raise Dead'ed that after about 30 minutes or so, things don't actually do their death animation, they just dissappear...
 
Level 3
Joined
Mar 30, 2007
Messages
26
Thank you very much YO_MA_MA :) I'm starting to get it now finally heh

PS, Prince Panda: Use the [ TRIGGER ] tags to create triggers. Simply right-click the trigger in the Trigger Editor and choose Copy As Text. Then paste it between the TRIGGER tags and you'll get a perfect trigger layout like YO_MA_MA posted. :wink:

I'll make sure to use that next time, I never knew about that tag lol

As for the invisible corpse issue...I don't know if I've really solved that problem yet, but I just went to the object editor and change my units to "Can't raise, does not decay."
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Set Temp_Unit_Group = (Units in (Playable map area) matching ((((Matching unit) belongs to an enemy of Player 9 (Gray)) Equal to True) and (((Triggering unit) is A Hero) Equal to True)))
  • Custom script: call DestoryGroup(udg_Temp_Unit_Group)

You tell him he doesn't use the location and then you do exactly the same thing with the group.
Irony?
 
Status
Not open for further replies.
Top