| 11-15-2004, 07:18 AM | #1 |
Does this leak?? and if so, how and why, how to fix? Set TempSpawnPoint = (Center of RightCastleSpawn <gen>) Unit - Create 1 Rifleman for Player 1 (Red) at TempSpawnPoint facing Default building facing degrees Unit - Create 2 Footman for Player 1 (Red) at TempSpawnPoint facing Default building facing degrees Custom script: call RemoveLocation (udg_TempSpawnPoint) Set TempSpawnPoint = (Center of Right Castle <gen>) Unit Group - Order (Units in RightCastleSpawn <gen> matching (((Matching unit) is in (Units owned by Player 1 (Red))) Equal to True)) to Attack-Move To TempSpawnPoint Custom script: call DestroyGroup (GetLastCreatedGroup()) Custom script: call RemoveLocation (udg_TempSpawnPoint) EDIT: Do I even have to do this. Can I just do this. Set TempSpawnPoint = (Center of RightCastleSpawn <gen>) Unit - Create 1 Rifleman for Player 1 (Red) at TempSpawnPoint facing Default building facing degrees Unit - Create 2 Footman for Player 1 (Red) at TempSpawnPoint facing Default building facing degrees Set TempSpawnPoint = (Center of Right Castle <gen>) Unit Group - Order (Units in RightCastleSpawn <gen> matching (((Matching unit) is in (Units owned by Player 1 (Red))) Equal to True)) to Attack-Move To TempSpawnPoint Custom script: call DestroyGroup (GetLastCreatedGroup()) Custom script: call RemoveLocation (udg_TempSpawnPoint) |
| 11-15-2004, 08:55 AM | #2 |
This won't leak |
| 11-15-2004, 05:46 PM | #3 |
would it still not leak if i just did this? Set TempSpawnPoint = (Center of RightCastleSpawn <gen>) Unit - Create 1 Rifleman for Player 1 (Red) at TempSpawnPoint facing Default building facing degrees Unit - Create 2 Footman for Player 1 (Red) at TempSpawnPoint facing Default building facing degrees Set TempSpawnPoint = (Center of Right Castle <gen>) Unit Group - Order (Units in RightCastleSpawn <gen> matching (((Matching unit) is in (Units owned by Player 1 (Red))) Equal to True)) to Attack-Move To TempSpawnPoint Custom script: call DestroyGroup (GetLastCreatedGroup()) Custom script: call RemoveLocation (udg_TempSpawnPoint) |
| 11-15-2004, 06:59 PM | #4 |
This will leak the first point because it isn't deleted before the other point is stored in the variable. |
| 11-15-2004, 07:03 PM | #5 | |
Quote:
Nah, this leaks. When you assign a new value to the variable, the old one isn't overwritten: the variable isn't the object, it just points to the object. By seting a new value to the variable you don't remove the previous value, and it then leaks. Besides, you leak a unit group. That's because you create two of them: one is the "(Units owned by Player 1 (Red))", and the other one is "(Units in RightCastleSpawn <gen> matching (((Matching unit) is in (Units owned by Player 1 (Red))) Equal to True))". To fix this, you have to change the condition: instead of "boolean comparison - unit is in unit group", do a "player comparison - owner of (matching unit) equal to Player 1" |
| 11-16-2004, 07:34 PM | #6 |
You could ofcourse use the function MoveLocation |
| 11-17-2004, 03:31 PM | #7 | |
Quote:
yes, I find moving a location around is alot better than creating and removing them constantly. |
