| 06-23-2004, 04:32 AM | #1 |
Ok, this trigger works perfect, however im worried that it may create lag every time it runs (every 5 seconds) cause of all the loops and unit creating i used. Could some1 look at it and tell me if if would make a huge ass lag spike? Start The Fire Events Time - Every 5.00 seconds of game time Conditions Actions Set FireAmmount[1] = (FireAmmount[1] + 1) Unit Group - Pick every unit in (Units in Region 144 <gen> matching ((Unit-type of (Matching unit)) Equal to Rupture)) and do (Actions) Loop - Actions Unit Group - Pick every unit in (Units within 0.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Fire Circle)) and do (Unit - Remove (Picked unit) from the game) For each (Integer A) from 1 to FireAmmount[2], do (Actions) Loop - Actions Set FireOriginal = (Random unit from (Units in Region 144 <gen> matching ((Unit-type of (Matching unit)) Equal to Rupture))) Unit Group - Pick every unit in (Random 1 units from (Units within 450.00 of (Position of FireOriginal) matching ((Unit-type of (Matching unit)) Equal to Fire Circle))) and do (Actions) Loop - Actions Set FireOriginal2[(Integer A)] = (Position of FireOriginal) Unit - Create 1 Rupture for Player 11 (Dark Green) at (Position of (Picked unit)) facing Default building facing degrees Unit - Remove (Picked unit) from the game Unit - Remove FireOriginal from the game Set FireOriginal = (Last created unit) Set RupturePosition[(Integer A)] = (Position of FireOriginal) Unit - Remove FireOriginal from the game For each (Integer A) from 1 to FireAmmount[2], do (Actions) Loop - Actions Unit - Create 1 Rupture for Player 11 (Dark Green) at RupturePosition[(Integer A)] facing Default building facing degrees Unit - Create 1 Fire Circle for Player 11 (Dark Green) at FireOriginal2[(Integer A)] facing Default building facing degrees Unit - Create 1 Fire Circle for Player 11 (Dark Green) at (Position of FireOriginal) facing Default building facing degrees Unit Group - Pick every unit in (Units in Region 144 <gen> matching ((Unit-type of (Matching unit)) Equal to Rupture)) and do (Actions) Loop - Actions Unit - Create 1 Fire Circle for Player 11 (Dark Green) at (Position of (Picked unit)) facing Default building facing degrees Unit Group - Pick every unit in (Units in Region 144 <gen> matching ((Unit-type of (Matching unit)) Equal to Rupture)) and do (Actions) Loop - Actions Sound - Play BreathOfFire1 <gen> Unit - Order (Picked unit) to Attack Ground (Position of (Picked unit)) Wait 0.01 seconds Unit - Order (Picked unit) to Stop If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions FireAmmount[1] Equal to 2 Then - Actions Set FireAmmount[2] = (FireAmmount[2] + 1) Unit Group - Pick every unit in (Units in Region 144 <gen> matching ((Unit-type of (Matching unit)) Equal to Rupture)) and do (Actions) Loop - Actions Unit Group - Pick every unit in (Units within 0.00 of (Position of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Fire Circle)) and do (Unit - Remove (Picked unit) from the game) Set SingleFire = (Random unit from (Units in Region 144 <gen> matching ((Unit-type of (Matching unit)) Equal to Fire Circle))) Unit - Create 1 Rupture for Player 11 (Dark Green) at (Position of SingleFire) facing Default building facing degrees Set FireAmmount[1] = 0 Unit Group - Pick every unit in (Units in Region 144 <gen> matching ((Unit-type of (Matching unit)) Equal to Rupture)) and do (Actions) Loop - Actions Unit - Create 1 Fire Circle for Player 11 (Dark Green) at (Position of (Picked unit)) facing Default building facing degrees Else - Actions |
| 06-23-2004, 11:07 AM | #2 |
I don't know about laggyness, but that trigger leaks one hell-ufa-lot of memory in that state >_< You're leaking like dozen of unit groups and tons of locations in each run. Please read my article on the subject here: http://www.wc3campaigns.com/showthread.php?t=55022 ~Cubasis |
| 06-23-2004, 05:31 PM | #3 |
thnx, i didnt really know that u could create leaks just from using certin functions. I would like 2 clean it up, however i dont know where 2 put the custom script, and also i cant afford 2 have that many more variables cause i already got about 50 on the map. Is there a way 2 use the custom script 2 close the leaks without using more variables? and if so, could u tell me where i would need 2 place the custom script within my trigger? |
| 06-23-2004, 06:34 PM | #4 |
Don't you think I would have then mentioned it in the article... instead of making all the readers use globals. This is the best way to fight against leaks. You "can" use the following line before UnitGroup lines to clean some leaks, but it's pretty unreliable and you should rather use the other way. Custom Script: set bj_wantDestroyGroup = true Also, if you'd know JASS, you could make external functions handle the leak. but... in any case, you'd only need around 3 variables, one location and 2 Unit Group vars. And it's not like you're pressing some Variable limit or sumtin. I know people that have 200 globals in their maps. ~Cubasis |
| 06-23-2004, 10:59 PM | #5 |
When you have lots of loops like you do it creates tons of lag. |
