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

[Trigger] A possible leak?

Status
Not open for further replies.
Level 8
Joined
Sep 24, 2007
Messages
300
With this trigger turned on, game freezes after 10 seconds, if it's off, it doesn't.

So, it must be something wrong with it, a possible leak or something.

  • move turtles
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set tempgroup = (Units of type Turtle)
      • Unit Group - Pick every unit in tempgroup and do (Actions)
        • Loop - Actions
          • Set temploc = (Position of (Picked unit))
          • Set temploc2 = (Random point in (Region centered at temploc with size (500.00, 500.00)))
          • Unit - Order (Picked unit) to Move To temploc2
          • Custom script: call RemoveLocation(udg_temploc)
          • Custom script: call RemoveLocation(udg_temploc2)
      • Custom script: call DestroyGroup(udg_tempgroup)
Please help me out. I don't see where I failed. :/
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Ouch, yeah, if he's got those regions running for a lot of units, that's going to be a huge mess of leaks.

Not sure what the JASS output of this GUI filth is, but I can assure you that there is an easier way to do it. Random point in a generated-rect is overkill, what you should be doing is random-point within a certain radius of the unit.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
I can't find any problems :/
Just store the Region in a variable and remove it afterwards (currently, it leaks).

You can't remove regions by any means.
The problem is there that the trigger creates a random region for each unit in the group, which is a overkill, as Bribe said before.

Tell us more about the spell/trigger you want to make, that could help us give you a working one.
 
Level 8
Joined
Sep 24, 2007
Messages
300
Ouch, yeah, if he's got those regions running for a lot of units, that's going to be a huge mess of leaks.

Not sure what the JASS output of this GUI filth is, but I can assure you that there is an easier way to do it. Random point in a generated-rect is overkill, what you should be doing is random-point within a certain radius of the unit.
I'd gladly do that, if there was such action, but there is none.

Basically what I want to do is that ~50 turtles walk around to random points. Like wandering.
 
Level 8
Joined
Sep 24, 2007
Messages
300
New trigger, same bug
  • move turtles
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set tempgroup = (Units of type Turtle)
      • Unit Group - Pick every unit in tempgroup and do (Actions)
        • Loop - Actions
          • Set temploc = (Position of (Picked unit))
          • Set temploc2 = (temploc offset by (Random real number between 128.00 and 256.00) towards (Random angle) degrees)
          • Unit - Order (Picked unit) to Move To temploc2
          • Custom script: call RemoveLocation(udg_temploc)
          • Custom script: call RemoveLocation(udg_temploc2)
      • Custom script: call DestroyGroup(udg_tempgroup)
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

I only know 2 things in this case:

First maybe it mess up with temploc 2 - so you should create another variable where you set: "Random real number between 128.00 and 256.00" and then use in temploc2 the variable

Second: It always! ( test it 10 times ) freeze after 10 minutes. Else I would say many points can create ( I don't know how many turtles you got ) out of the map or in an unpathable location - maybe this the reason ( but no I don't think so actually ^^ )

Greetings
~ The Bomb King > Dr. Boom
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Yeah, don't bother setting a tempReal variable here, it won't make the slightest change.

I can't see how this trigger is crashing. Maybe you should filter only living turtles so that you're not ordering dead units to move.

Honestly, disable all of your other trigger and then test it. I think the problem lies elsewhere, not here.
 
Like this

  • Set point2 = (point1 offset by (Random real number between 128.00 and 256.00) towards (Random angle) degrees)

This is your answer (just set the real numbers to be between 0 and 500.00, to fill in the area of effect standards).

And yes, regions leak and can be removed with
call RemoveRect (udg_Region).

Generally, don't underestimate them and prevent yourself from storing them in a variable. They leak, they need to be stored in a variable and get cleaned afterwards with the method baassee suggested.
 
Status
Not open for further replies.
Top