• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Heavy leaks

Status
Not open for further replies.
Level 2
Joined
Mar 11, 2009
Messages
26
Im currently recieveing some really heavy memory leaks, and its probably related to timely events such as game - for every 0.01 etc.

The triggers that i suspect is behind it is probably one of the following which ive tried to fix memory leaks in, but it doesnt seem to work really.

Does a point stored in a variable leak if it doesn't get removed if it is assigned a new value? Looked into the sticky on memory leaks but found nothing useful on that and its 40 pages long. And the first trigger create a region where it checks for units of a certain unit type, does this region leak? cause i ran these trigger through the leak checker software and it didnt find anything, just some variables that werent destroyed.


  • Moving Iceblocks
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • -------- 1 - south, 2 - east, 3 - north 4, - west , 0 - stop --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (-50.00, -50.00)), ((Position of Ice_Block_Unit) offset by (50.00, -140.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit Greater than or equal to 1
          • Ice_Block_Acelleration Greater than or equal to 1
          • Ice_Block_Facing Equal to 1
        • Then - Actions
          • Set Ice_Block_Acelleration = 0
          • Set Ice_Block_Facing = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (50.00, -50.00)), ((Position of Ice_Block_Unit) offset by (140.00, 50.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit)) Greater than or equal to 1
              • Ice_Block_Acelleration Greater than or equal to 1
              • Ice_Block_Facing Equal to 2
            • Then - Actions
              • Set Ice_Block_Acelleration = 0
              • Set Ice_Block_Facing = 0
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (-50.00, 50.00)), ((Position of Ice_Block_Unit) offset by (50.00, 140.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit)) Greater than or equal to 1
                  • Ice_Block_Acelleration Greater than or equal to 1
                  • Ice_Block_Facing Equal to 3
                • Then - Actions
                  • Set Ice_Block_Acelleration = 0
                  • Set Ice_Block_Facing = 0
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (-50.00, -50.00)), ((Position of Ice_Block_Unit) offset by (-140.00, 50.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit Greater than or equal to 1
                      • Ice_Block_Acelleration Greater than or equal to 1
                      • Ice_Block_Facing Equal to 4
                    • Then - Actions
                      • Set Ice_Block_Acelleration = 0
                      • Set Ice_Block_Facing = 0
                    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Ice_Block_Acelleration Equal to 1
          • Ice_Block_Facing Equal to 1
        • Then - Actions
          • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
          • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (0.00, -3.00))
          • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Ice_Block_Acelleration Equal to 1
              • Ice_Block_Facing Equal to 2
            • Then - Actions
              • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
              • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (3.00, 0.00))
              • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Ice_Block_Acelleration Equal to 1
                  • Ice_Block_Facing Equal to 3
                • Then - Actions
                  • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
                  • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (0.00, 3.00))
                  • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Ice_Block_Acelleration Equal to 1
                      • Ice_Block_Facing Equal to 4
                    • Then - Actions
                      • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
                      • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (-3.00, 0.00))
                      • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
                    • Else - Actions
      • Custom script: call RemoveLocation (udg_LeakFixPosition[2])
      • Custom script: call RemoveLocation (udg_LeakFixPosition[3])

  • Cains Tower F3 random encounters
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in Cains Tower F3 <gen> owned by Player 12 (Brown))) Equal to 0
          • (Number of units in (Units in Cains Tower F3 <gen> matching (((Matching unit) is A Hero) Equal to True))) Greater than or equal to 1
          • (Random integer number between 1 and 30) Equal to 1
        • Then - Actions
          • Set LeakFixUnitGroup[1] = (Units in Cains Tower F3 <gen> matching (((Matching unit) is A Hero) Equal to True))
          • Unit Group - Pick every unit in LeakFixUnitGroup[1] and do (Actions)
            • Loop - Actions
              • Set LeakFixPosition[1] = (Position of (Picked unit))
              • Unit - Create 1 Spirit of the Dead (Cain's Tower) for Player 12 (Brown) at LeakFixPosition[1] facing Default building facing degrees
              • Unit - Add a 4.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Attack (Picked unit)
              • Special Effect - Create a special effect at LeakFixPosition[1] using Abilities\Spells\Demon\DarkConversion\ZombifyTarget.mdl
              • Set Cains_Tower_Special_Effects[2] = (Last created special effect)
              • Special Effect - Destroy Cains_Tower_Special_Effects[2]
        • Else - Actions
      • Custom script: call RemoveLocation (udg_LeakFixPosition[1])
      • Custom script: call DestroyGroup (udg_LeakFixUnitGroup[1])


I also have four more periodic triggers that dont create anything, they just checks for some conditions and resurrects or kill a destructible that is dead/living if a unit is in a region:


  • Cains Tower F2 Switch 1
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
      • Cains_Tower_Switches[5] Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Foot Switch 0394 <gen> is dead) Equal to False
          • (Number of units in (Units in Cains Tower F2 Switch 1 <gen> matching ((Unit-type of (Matching unit)) Equal to Ice Block))) Greater than or equal to 1
        • Then - Actions
          • Destructible - Kill Foot Switch 0394 <gen>
          • Set Cains_Tower_Switches[5] = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Cains_Tower_Switches[6] Equal to True
          • (Tower Forcewall 0392 <gen> is dead) Equal to False
        • Then - Actions
          • Destructible - Kill Tower Forcewall 0392 <gen>
        • Else - Actions

  • Cains Tower F2 Switch 1 off
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
      • Cains_Tower_Switches[5] Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Foot Switch 0394 <gen> is dead) Equal to True
          • (Number of units in (Units in Cains Tower F2 Switch 1 <gen> matching ((Unit-type of (Matching unit)) Equal to Ice Block))) Equal to 0
        • Then - Actions
          • Destructible - Resurrect Foot Switch 0394 <gen> with 99999.00 life and Show birth animation
          • Set Cains_Tower_Switches[5] = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Cains_Tower_Switches[6] Equal to False
          • (Tower Forcewall 0392 <gen> is dead) Equal to True
        • Then - Actions
          • Destructible - Resurrect Tower Forcewall 0392 <gen> with 99.00 life and Show birth animation
        • Else - Actions


  • Cains Tower F2 Switch 2
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
      • Cains_Tower_Switches[6] Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Foot Switch 0389 <gen> is dead) Equal to False
          • (Number of units in (Units in Cains Tower F2 Switch 2 <gen> matching ((Unit-type of (Matching unit)) Equal to Ice Block))) Greater than or equal to 1
        • Then - Actions
          • Destructible - Kill Foot Switch 0389 <gen>
          • Set Cains_Tower_Switches[6] = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Cains_Tower_Switches[5] Equal to True
          • (Tower Forcewall 0392 <gen> is dead) Equal to False
        • Then - Actions
          • Destructible - Kill Tower Forcewall 0392 <gen>
        • Else - Actions
  • Cains Tower F2 Switch 2 off
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
      • Cains_Tower_Switches[6] Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Foot Switch 0389 <gen> is dead) Equal to True
          • (Number of units in (Units in Cains Tower F2 Switch 2 <gen> matching ((Unit-type of (Matching unit)) Equal to Ice Block))) Equal to 0
        • Then - Actions
          • Destructible - Resurrect Foot Switch 0389 <gen> with 99999.00 life and Show birth animation
          • Set Cains_Tower_Switches[6] = False
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Cains_Tower_Switches[5] Equal to False
          • (Tower Forcewall 0392 <gen> is dead) Equal to True
        • Then - Actions
          • Destructible - Resurrect Tower Forcewall 0392 <gen> with 99.00 life and Show birth animation
        • Else - Actions
 
Level 13
Joined
May 11, 2008
Messages
1,198
i don't understand your triggers fully. like for example the conditions i don't know what those are about. this for example: "Cains_Tower_Switches[5] Equal to True" perhaps you should post your map so your triggers will be easier to read.

as for what you're trying to accomplish...it seems like there are easier ways to do what you're doing...but i'm not sure what you're trying to do. it looks like you're killing footswitches and i don't know why. anyway can't you do destructible dies event instead of checking in conditions if a destructible is dead?

anyway, sorting through the mess, here's something i found that definitely needs to be changed.

(Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (-50.00, -50.00)), ((Position of Ice_Block_Unit) offset by (50.00, -140.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit Greater than or equal to 1

well, i'm not sure exactly what you're trying to do here but you're using a point. for one thing, you can't use Position of Ice_Block_Unit for the action, what you need to do is set a variable for Position of Ice_Block_Unit, and then use that variable, then remove the variable after you're done with that point. uhm it might be more complicated than i just said actually because i think maybe you need a variable for the position of the unit and the offset point...well anyway here's an example of what you need to do, mind you i've never done offset system stuff so that's why i'm not sure about it...

pandaren flames
Events
Conditions
(Ability being cast) Equal to (==) |cff20b2aaPandaren Flames|r (frenzy)
Actions
Set points = (Position of (Casting unit))
Unit - Create 1 Archer for (Owner of (Casting unit)) at points facing Default building facing (270.0) degrees
Unit - Order (Last created unit) to Human Blood Mage - Flame Strike points
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Point - Remove points

so you see in the actions you have to set the variable, and then you can use it for whatever, then after that you remove it.

as far as leaks go, point is a major leaker so you have to fix this, no doubt.

it looks like you are removing some points, but you're removing the wrong ones. i think the ones you're removing shouldn't be removed. the game is creating points and leaving them in the memory, the thing is that if you make a variable, then the variable changes to whatever points, so instead of having 1000 or more point memory slots taken by 1000 or more point creations...it's only 1 per variable. because the variable can variate. that's why it's called a variable. so you have to create the variable for the location. basically everytime it checks that condition it's going to be making a new point. or possibly two since you have offsets, not sure how those work, ask someone else about that...now that's a lot of space used up for it, everytime it's checking, it needs to create new point/region whatever to be checking. it's really a problem.
 
Last edited:
Level 2
Joined
Mar 11, 2009
Messages
26
Sorry for the lack of information. The first trigger moves an iceblock in a direction depending which value an integer has, the second trigger randomly spawns a unit on you (got a special combat system which takes you to another region if you get attacked by certain units) at a timed interval each second if random integer from 1 to 30 is 1 ( so about once every 30 sec but not at regular intervals), the third and fifth trigger checks if the iceblock from trigger one is in a certain region and destroys a footswitch (cant use a enters region as the iceblock never enter the region as it gets moved instantly), the fourth and sixth trigger resurrect this footswitch if the unit is not in the region (same here with leaves region, cant be used that is).

Also thats for the quick reply, i was suspecting that was where the problem was, as it checks a region infront of the iceblock for a certain unit based on its current facing and creates a region based on two points. I wasnt quite sure if it created points based on a condition check as i didnt get a leak error reply in the leak check software. And yea, then it creates like 6*4*50 points per second and that adds up to a lot in a few minutes.
 
Level 13
Joined
May 11, 2008
Messages
1,198
anyway if you don't have jngp, i guess you have to put it like Custom script: call RemoveLocation(udg_points) or something like that...but i don't use custom script i just go jass if i don't gui. jgnp gui is superior. Point - Remove points is a gui function in the newest editor, it's great. "points" is the name of my variable in case you're confused.
 
Level 2
Joined
Mar 11, 2009
Messages
26
Ah i did not know that, going deeper into that function, is it required to put one after each point that is being created or do i only need one towards the end of the trigger? And also, if so, will that remove any point created by non variables up to this point?

*edit - just realized it fully, thanks, ignore the above, by "points" is the "LeakFixPosition"*
 
Level 13
Joined
May 11, 2008
Messages
1,198
on second thought, you are cheking the point in the condition right? then the example i gave you is not very good at all...let me try to give you a different one.

ok so basically, it sounds like you're still not getting it...let me rewrite your trigger...but it's easier if you post the map so i can edit the trigger instead of typing it all...
 
Level 2
Joined
Mar 11, 2009
Messages
26
Yes, but in order to check that region, don't it physically have to create that region based on the point of the unit, then offset of that point? that would create lots of leaks, but I'm not quite sure of this. I'm going to create that region that it checks with points and see if it gets fixed
 
Level 13
Joined
May 11, 2008
Messages
1,198
it doesn't need to create the region if it's a varible though, right? maybe that's what those variables are that you are destroying, and i doubt you need to destroy them. but the way you are using them might be ok, i'm not sure, but anyway you are ignoring the points that need variables and the values removed.... ok take a look at your trigger.


  • Moving Iceblocks
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
  • //before the if actions you need to set your point according
  • //to how it looks in your condition, if that means you need
  • //to set other points ahead of time or regions, then fine, do that too...
    • -------- 1 - south, 2 - east, 3 - north 4, - west , 0 - stop --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (-50.00, -50.00)), ((Position of Ice_Block_Unit) offset by (50.00, -140.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit Greater than or equal to 1
          • Ice_Block_Acelleration Greater than or equal to 1
          • Ice_Block_Facing Equal to 1
        • Then - Actions
          • Set Ice_Block_Acelleration = 0
          • Set Ice_Block_Facing = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (50.00, -50.00)), ((Position of Ice_Block_Unit) offset by (140.00, 50.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit)) Greater than or equal to 1
              • Ice_Block_Acelleration Greater than or equal to 1
              • Ice_Block_Facing Equal to 2
            • Then - Actions
              • Set Ice_Block_Acelleration = 0
              • Set Ice_Block_Facing = 0
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (-50.00, 50.00)), ((Position of Ice_Block_Unit) offset by (50.00, 140.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit)) Greater than or equal to 1
                  • Ice_Block_Acelleration Greater than or equal to 1
                  • Ice_Block_Facing Equal to 3
                • Then - Actions
                  • Set Ice_Block_Acelleration = 0
                  • Set Ice_Block_Facing = 0
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in (Units in (Region(((Position of Ice_Block_Unit) offset by (-50.00, -50.00)), ((Position of Ice_Block_Unit) offset by (-140.00, 50.00)))) matching (((Unit-type of (Matching unit)) Equal to Ice Block Stopper) or ((Unit-type of (Matching unit Greater than or equal to 1
                      • Ice_Block_Acelleration Greater than or equal to 1
                      • Ice_Block_Facing Equal to 4
                    • Then - Actions
                      • Set Ice_Block_Acelleration = 0
                      • Set Ice_Block_Facing = 0
                    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Ice_Block_Acelleration Equal to 1
          • Ice_Block_Facing Equal to 1
        • Then - Actions
          • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
          • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (0.00, -3.00))
          • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Ice_Block_Acelleration Equal to 1
              • Ice_Block_Facing Equal to 2
            • Then - Actions
              • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
              • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (3.00, 0.00))
              • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Ice_Block_Acelleration Equal to 1
                  • Ice_Block_Facing Equal to 3
                • Then - Actions
                  • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
                  • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (0.00, 3.00))
                  • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Ice_Block_Acelleration Equal to 1
                      • Ice_Block_Facing Equal to 4
                    • Then - Actions
                      • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
                      • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (-3.00, 0.00))
                      • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
                    • Else - Actions
      • Custom script: call RemoveLocation (udg_LeakFixPosition[2])
      • Custom script: call RemoveLocation (udg_LeakFixPosition[3])
  • //when you're done with those ifs then you have to remove the
  • //variables that you set at the beginning of the trigger that you
  • //set before the if actions. i'm not sure what you're doing with
  • //the regions exactly...but when you fix the points you hopefully can
  • //figure out how to fix the regions...
edit: are you making regions using the main window of world editor and then moving them in the trigger editor? i would recommend that if you're not already. there might be a way to simplify the trigger better than that, but until i can understand what you're trying to do exactly, i can't show you.
 
Level 14
Joined
Nov 18, 2007
Messages
816
Every time you do "Number of Units in ... " you leak a group. And you leak MANY groups.
fix: define a global group variable, group your units in there, and then do Number of Units in on the global, after youre done with that group, use Custom Script: call DestroyGroup(udg_yourgroup) to almost completely clean it.
 
Level 13
Joined
May 11, 2008
Messages
1,198
yeah now that i think about it, the custom script you are using is for destroying points, but i think the name of the variables they are targetting are regions...am i wrong about this? oh yeah they are points, are they? nevermind...hmm... well i typed the following but man i guess i should just read all of those triggers through but it's so many triggers: maybe this information is useful or not:
location is point and rect is region.

to help you understand what a point and what a region is... look at the numbers that change around on the map. at the middle of that map it should be a bunch of zeroes, the further away from the center of the map you get, the higher the numbers climb...either into the negatives or positives. those numbers are called reals, and at any rate the combination of two of those numbers is a point. a region, is like a colored box and you can use it for a variety of things...you can make a point based on a region. or you can make a point based on a unit. you can do a lot with points you can move a unit exactly where you want it. regions are useful mostly for selecting units in an area, and you can of course relocate units according to regions but sometimes you might want to skip using regions for that and go straight to points.

for my map i used to have like about 10 regions or so, like one for each start location and one or two more i guess. anyway, now i only have 1. at least we're talking about global generated regions. anyway i was creating units at a point which was center of those regions. but later on i realized i can just create them at the point where the reals are on the map. so now i don't use those regions anymore. the only region i use now is for the waygate for my map. the only other thing i can thing of that might qualify as a region that i use now is where i put a unit in point using some random real a number between another number. but that's just real and point. no region, even though it imitates a region like random point within region right? well i just take my mouse and look at what the numbers x and y are in reals on the map and use those. you might be able to select units within those coordinates also but i don't know about that. you might need to actually make a region for that.

so anyway i think you can simulate a region with 4 x reals and 4 y reals. or something like that...

i guess regions you are using are like cains tower F3 huh. anyway i think anytime you're setting a variable like a point and you need to destroy it, i think you want to do it in the same section. so if you have some if condition actions that are checked and then some actions are run afterwards...those actions after that are being run....

which means all those destroying/removing actions are destroying/removing nothing if the if actions don't run because they check and get a false...
you should either set the variables outside of the if actions, or more likely, you should put the remove/destroy actions inside the if actions

as for the if actions that are checking for regions or points, you're going to need to use variables for those regions or points. which i guess i already told you, but anyway obviously in that case the condition is checked, so everything in that condition that is a variable will of course need to be removed/destroyed immediately after the if action. don't let it be in then or else action because then it will be broken.
 
Last edited:
Level 2
Joined
Mar 11, 2009
Messages
26
Ok, it now illks like this:
  • Moving Iceblocks
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • -------- 1 - south, 2 - east, 3 - north 4, - west , 0 - stop --------
      • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
      • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (-50.00, -50.00))
      • Set LeakFixPosition[4] = (LeakFixPosition[2] offset by (50.00, -140.00))
      • Set LeakFixRegion[1] = (Region(LeakFixPosition[3], LeakFixPosition[4]))
      • Set LeakFixUnitGroup[10] = (Units in LeakFixRegion[1] matching ((Unit-type of (Matching unit)) Equal to Ice Block Stopper))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in LeakFixUnitGroup[10]) Greater than or equal to 1
          • Ice_Block_Acelleration Greater than or equal to 1
          • Ice_Block_Facing Equal to 1
        • Then - Actions
          • Set Ice_Block_Acelleration = 0
          • Set Ice_Block_Facing = 0
        • Else - Actions
          • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (50.00, -50.00))
          • Set LeakFixPosition[4] = (LeakFixPosition[2] offset by (140.00, 50.00))
          • Set LeakFixRegion[1] = (Region(LeakFixPosition[3], LeakFixPosition[4]))
          • Set LeakFixUnitGroup[10] = (Units in LeakFixRegion[1] matching ((Unit-type of (Matching unit)) Equal to Ice Block Stopper))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in LeakFixUnitGroup[10]) Greater than or equal to 1
              • Ice_Block_Acelleration Greater than or equal to 1
              • Ice_Block_Facing Equal to 2
            • Then - Actions
              • Set Ice_Block_Acelleration = 0
              • Set Ice_Block_Facing = 0
            • Else - Actions
              • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (-50.00, -50.00))
              • Set LeakFixPosition[4] = (LeakFixPosition[2] offset by (50.00, 140.00))
              • Set LeakFixRegion[1] = (Region(LeakFixPosition[3], LeakFixPosition[4]))
              • Set LeakFixUnitGroup[10] = (Units in LeakFixRegion[1] matching ((Unit-type of (Matching unit)) Equal to Ice Block Stopper))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in LeakFixUnitGroup[10]) Greater than or equal to 1
                  • Ice_Block_Acelleration Greater than or equal to 1
                  • Ice_Block_Facing Equal to 3
                • Then - Actions
                  • Set Ice_Block_Acelleration = 0
                  • Set Ice_Block_Facing = 0
                • Else - Actions
                  • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (-50.00, -50.00))
                  • Set LeakFixPosition[4] = (LeakFixPosition[2] offset by (-140.00, 50.00))
                  • Set LeakFixRegion[1] = (Region(LeakFixPosition[3], LeakFixPosition[4]))
                  • Set LeakFixUnitGroup[10] = (Units in LeakFixRegion[1] matching ((Unit-type of (Matching unit)) Equal to Ice Block Stopper))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in LeakFixUnitGroup[10]) Greater than or equal to 1
                      • Ice_Block_Acelleration Greater than or equal to 1
                      • Ice_Block_Facing Equal to 4
                    • Then - Actions
                      • Set Ice_Block_Acelleration = 0
                      • Set Ice_Block_Facing = 0
                    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Ice_Block_Acelleration Equal to 1
          • Ice_Block_Facing Equal to 1
        • Then - Actions
          • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
          • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (0.00, -3.00))
          • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Ice_Block_Acelleration Equal to 1
              • Ice_Block_Facing Equal to 2
            • Then - Actions
              • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
              • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (3.00, 0.00))
              • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Ice_Block_Acelleration Equal to 1
                  • Ice_Block_Facing Equal to 3
                • Then - Actions
                  • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
                  • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (0.00, 3.00))
                  • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Ice_Block_Acelleration Equal to 1
                      • Ice_Block_Facing Equal to 4
                    • Then - Actions
                      • Set LeakFixPosition[2] = (Position of Ice_Block_Unit)
                      • Set LeakFixPosition[3] = (LeakFixPosition[2] offset by (-3.00, 0.00))
                      • Unit - Move Ice_Block_Unit instantly to LeakFixPosition[3]
                    • Else - Actions
I first create a region using variables, then a unit-group variable to save the units in that region matching condition, then compare if the units in this unit group are more than one, should be no more leaks, just gonna put it to the test.
 
Status
Not open for further replies.
Top