- Joined
- Aug 27, 2009
- Messages
- 473
Ok, so the idea was to make a working Anti-Block system which actually don't lag.. And which works instantly.. I came up with this idea:
This does work for anti-blocking.. This works instantly.. But when the "Chain" is long enough, it lags everytime you build a new tower into the chain.
So the question is: Any ideas how to "remove" the lag?
Define "chain": Towers which touches each other.
Examples:
EDIT:
Trigger updated with leak (pointed out by Maker) fixed..
-
Anti Block
-
Events
- Unit - A unit Begins construction
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (ABChain is empty) Equal to True
-
Then - Actions
- Set TempLoc = (Position of (Triggering unit))
- Set ABChain = (Units in (Entire map) matching ((Matching unit) Equal to (Triggering unit)))
- Set ABMin = (X of TempLoc)
- Set ABMax = (X of TempLoc)
- Else - Actions
-
If - Conditions
- Set ABCheck = False
-
Unit Group - Pick every unit in ABChain and do (Actions)
-
Loop - Actions
- Set TempLoc2 = (Position of (Picked unit))
- Set TempGroup = (Units owned by (Owner of (Triggering unit)))
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Set TempLoc3 = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Picked unit)) Not equal to Human Builder
- ((Picked unit) is in ABChain) Equal to False
- (Distance between TempLoc2 and TempLoc3) Less than 182.00
-
Then - Actions
- Unit Group - Add (Picked unit) to ABChain
- If ((X of TempLoc3) Less than ABMin) then do (Set ABMin = (X of TempLoc3)) else do (Do nothing)
- If ((X of TempLoc3) Greater than ABMax) then do (Set ABMax = (X of TempLoc3)) else do (Do nothing)
- Set ABCheck = True
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
Loop - Actions
- Custom script: call DestroyGroup(udg_TempGroup)
- Custom script: call RemoveLocation(udg_TempLoc3)
- Custom script: call RemoveLocation(udg_TempLoc2)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ABCheck Equal to False
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (ABMax - ABMin) Greater than or equal to 1792.00
-
Then - Actions
- Special Effect - Create a special effect at TempLoc using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
- Special Effect - Destroy (Last created special effect)
- Unit - Remove (Triggering unit) from the game
- Else - Actions
-
If - Conditions
- Custom script: call DestroyGroup(udg_ABChain)
- Custom script: call RemoveLocation(udg_TempLoc)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
- Trigger - Run Anti Block <gen> (checking conditions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
So the question is: Any ideas how to "remove" the lag?
Define "chain": Towers which touches each other.
Examples:
This wont lagCode:| | |XXXXXX | | | | XXXXXX| | | |XXXXXX | | | | XXXXXX| | | |XXXXXX | | |
This will lagCode:| | |XXXXXX | | X | | XXX X | | X X | | X XXX | | X | | XXXXXX| | | |XXXXXX | | |
Trigger updated with leak (pointed out by Maker) fixed..
Last edited: