| 01-06-2005, 12:42 PM | #1 |
I made an anti-stuck trigger for my TD. I know it is very noob...I would need to have a secondary custom value and I don't like the advanced triggers...so I simply made unit groups for every custom value and had to use mass if/then/else too because of that. For first I think it could be a nicer solution to this since I almost feel ashamed how noobish it is :P. Anyway this trigger lags like hell since I use it every 0.50 seconds AND run it from other triggers sometimes to unstick single units which stops when they use abilities. I have always removed points in these triggers but I have problems understanding how I should destroy unit groups and getting them back again. (global group udg_tempgroup?). Well...my major problem is that this lags. For me it only lags at the ability levels where the trigger is run extra many times...but for some people it lags all the game. Is there any way to make this trigger in a better way without using custom values? (I know how to make locals if that helps) Code:
AntiStuck
Events
Time - Every 0.50 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in (Units owned by Player 12 (Brown)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(Current order of (Picked unit)) Equal to (Order(idle))
(Current order of (Picked unit)) Equal to (Order(stop))
((Picked unit) is alive) Equal to True
((Picked unit) is in WalkingAttackers) Equal to True
Then - Actions
Set Int = (Custom value of (Picked unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[1]) Equal to True
Then - Actions
Set TempPoint = (Center of WP1[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[2]) Equal to True
Then - Actions
Set TempPoint = (Center of WP2[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[3]) Equal to True
Then - Actions
Set TempPoint = (Center of WP3[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[4]) Equal to True
Then - Actions
Set TempPoint = (Center of WP4[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[5]) Equal to True
Then - Actions
Set TempPoint = (Center of WP5[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[6]) Equal to True
Then - Actions
Set TempPoint = (Center of WP6[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[7]) Equal to True
Then - Actions
Set TempPoint = (Center of WP7[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[8]) Equal to True
Then - Actions
Set TempPoint = (Center of WP8[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[9]) Equal to True
Then - Actions
Set TempPoint = (Center of WP9[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[10]) Equal to True
Then - Actions
Set TempPoint = (Center of WP10[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[11]) Equal to True
Then - Actions
Set TempPoint = (Center of WP11[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[12]) Equal to True
Then - Actions
Set TempPoint = (Center of WP12[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[13]) Equal to True
Then - Actions
Set TempPoint = (Center of WP13[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[14]) Equal to True
Then - Actions
Set TempPoint = (Center of WP14[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[15]) Equal to True
Then - Actions
Set TempPoint = (Center of WP15[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[16]) Equal to True
Then - Actions
Set TempPoint = (Center of WP16[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[17]) Equal to True
Then - Actions
Set TempPoint = (Center of WP17[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[18]) Equal to True
Then - Actions
Set TempPoint = (Center of WP18[Int])
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is in NextWPToPassGroup[19]) Equal to True
Then - Actions
Set TempPoint = (Center of WP19[Int])
Else - Actions
Unit - Order (Picked unit) to Move To TempPoint
Custom script: call RemoveLocation( udg_TempPoint )
Else - Actions |
| 01-06-2005, 10:27 PM | #2 |
0.5 seconds is the key to this...i mean all them actions are to occur twice a second, Plus other running triggers, and thats a fairly long script for a trigger that runs that often. c hange it to 1....2 if u can |
| 01-07-2005, 12:00 AM | #3 | |
Quote:
I know it is! That's why Im asking about it! There must be a way to short it down without changing periodic. I know I can run the anti-stuck from other triggers only for a single unit (didn't think about that first). But still it lags of the periodic. I think it should need to be cut down! |
| 01-07-2005, 12:16 AM | #4 |
Well maybe you could make it like all other tds where there is a anti-stuck tower that attacks with a mapwide range and deals 2 damage? though it aint the prettiest thing it works... |
| 01-07-2005, 12:15 PM | #5 |
1: I hate anti-stuck towers...even if I give them locust ability. 2: It wouldn't work for spell units. 3: Anti-stuck towers are to attack units being stuck in each other. My units have collusion turned off so they don't. They get stuck when they go to random point in region and never enter the region and when they use spells then. Ok it seems like I have no good solution so I will do this: I split it up into 2 triggers. I keep this but eventually destroy the unit group after, then I add a new trigger which runs anti-stuck for only one unit. This will stop the giant loop every time a unit uses a spell.. |
