Preplaced region destroyed

meehael

New Member
Reaction score
6
Hi all,

What happens here:
Code:
Set Temp_Region = MyRegion <gen>
Custom script:   call RemoveRect(udg_Temp_Region)
Where MyRegion is preplaced region. It looks like MyRegion is after that destroyed along with Temp_Region!

Thanks,
Regards!
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you are creating a region in here, called Temp_Region. Temp_Region is an exact copy of MyRegion. (Your preplaced region)

and then you are destroying your variable Temp_Region to avoid memory leaks. (Each time you use a region in a trigger it will take some of your computers memory, if you dont remove it afterwards your game will lagg sooner or later.

MyRegion wont get destroyed, you could still use it any time.
 

Darthfett

Aerospace/Cybersecurity Software Engineer
Reaction score
615
MyRegion wont get destroyed, you could still use it any time.

Yes it does.

you are creating a region in here, called Temp_Region. Temp_Region is an exact copy of MyRegion. (Your preplaced region)
No, Temp_Region is being set to point towards MyRegion, the preplaced region. If you destroy Temp_Region, you are destroying the region it points to.

If you want to reuse the region, don't destroy it, it's not creating a second region.

This concept applies to any time you set a pre-set variable (gg_rect_MyRegion is a preset variable). However, it is different if you are creating something new for the variable.

Think of this as a unit. You're setting a variable to a unit, not creating an exact copy of another unit and setting a variable to it.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top