HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Needed some help in memory leak please

12-06-2004, 05:31 PM#1
divine_peon
I have a trigger that I suppose does the memory leak in my map.

Events:
Unit - A unit owned by Player 1 (Red) Is issued an order targeting a point
Unit - A unit owned by Player 2 (Blue) Is issued an order targeting a point
Unit - A unit owned by Player 3 (Teal) Is issued an order targeting a point
Unit - A unit owned by Player 4 (Purple) Is issued an order targeting a point
Unit - A unit owned by Player 5 (Yellow) Is issued an order targeting a point
Unit - A unit owned by Player 6 (Orange) Is issued an order targeting a point

Conditions:
(Distance between (Target point of issued order) and (Position of Villager (Female) 0005 <gen>)) Less than or equal to 200.00
TrainingBegun Equal to False

Actions:
Game - Display to (All players matching ((Owner of (Triggering unit)) Equal to (Matching player))) the text: To continue through...
Wait 10.00 seconds
If (TrainingBegun Equal to True) then do (Skip remaining actions) else do (Do nothing)
Unit - Move (Triggering unit) instantly to (Center of WarpEntrance <gen>)
Set TrainingBegun = True
Set Warp_Randomizer = (Random integer number between 1 and 3)
Wait 1.00 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Warp_Randomizer Equal to 1
Then - Actions
Unit - Create 1 Way Gate for Player 7 (Green) at (Center of WarpRand3 <gen>) facing Default building facing degrees
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Warp_Randomizer Equal to 2
Then - Actions
Unit - Create 1 Way Gate for Player 7 (Green) at (Center of WarpRand2 <gen>) facing Default building facing degrees
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Warp_Randomizer Equal to 3
Then - Actions
Unit - Create 1 Way Gate for Player 7 (Green) at (Center of WarpRand1 <gen>) facing Default building facing degrees
Else - Actions
The TrainingBegun variable checks if there is already someone training.
And Warp_Randomizer is the exit to the training ground.
Player 7 (Green) Is Neutral

pls. help...

And another question... if I create a warp gate in a region and it doesn't fit... I mean, if I create the region in a cliff and I placed
Unit - Create 1 Way Gate for Player 7 (Green) at (Center of WarpRand1 <gen>) facing Default building facing degrees
there will it cause a memory leak?
12-06-2004, 06:19 PM#2
Anitarf
The most noticeable memory leak is in your conditions: these are checked conditions whenever an order is issued (which is a frequent event). To fix this, you should move your distance condition to your actions:

Code:
Set TempPoint[1] = Target point of issued order
Set TempPoint[2] = Position of villager
If - then - else multiple functions
  if - conditions:
    Distance between TempPoint[1] and TempPoint[2] less than or equal to 200
  then - actions:
    **put all the trigger actions here**
  else - actions:
    do nothing
custom script:  call RemoveLocation( udg_TempPoint[1] )
custom script:  call RemoveLocation( udg_TempPoint[2] )

And there is a simpler way to do your actions. First you need these actions in a trigger that runs at map initialization:

Code:
Set WaygatePoint[1] = (Center of WarpRand3 <gen>)
Set WaygatePoint[2] = (Center of WarpRand2 <gen>)
Set WaygatePoint[3] = (Center of WarpRand1 <gen>)

And for your trigger actions, instead of all those if-then-elses, just do this:

Code:
Unit - Create 1 Way Gate for Player 7 (Green) at WaygatePoint[Warp_Randomizer] facing Default building facing degrees