Hi, I am doing a tug-of-war type map, and have a mothership (planning on switching to arbiter soon) with recall. I have units orderered upon building to go to their appropriate lanes toward enemy base already. But when units are recalled to a location, they lose their orders. I want them to retain their orders after recall, and not have to be ordered to a new point depending on where the unit currently is at. I don't know if this is possible. If not, can someone at least tell me how I can make recalled units only be ordered to auto-attack a new point? Is it some sort of effect?
You could just periodically order them their orders with a loop. So every 5-10 seconds they get the same order. They might stall for a few seconds after being recalled, but then will go back to their business.
The teleport effect does the actual moving. You can trigger enhance it to obtain what you want.
A trigger responding to an effect event can fetch various units and points similar to how the data editor does. Using these it can resolve certain units such as the origin or target (if TriggeringUnit is not sufficient). Once you have the unit that was teleported you can order it to do whatever you want.
You could order it back to the nearest lane waypoint using a minimum search. You could order it back to it's last waypoint by keeping track of its progress unit custom values (assign each lane node a unique identifier so you can always tell where it has to go next). The choice is really yours to make how you want it to resume orders.
Of note would be that the unit may have paused after the effect is run for a few seconds so orders are lost. In that case make the trigger thread wait a number of frames (such as a second or two) until it is unpaused and then issue the order. If you assign all values needed to locals at the time of effect fire then there is no chance they will be lost by the wait (although I think SC2 preserves those values much better than WC3). Never be afraid to Wait in trigger threads as SC2 waits are precise to 1 deterministic frame (there are 16 frames per second) which is the smallest resolvable deterministic time used by everything.
This approach is a lot more efficient than the above suggested polling approach. However if you want to use that rather I would suggest you stagger it just in case a large number of units some how manage to exist so that it does not consume enough resources to drop frames or cause a thread crash due to hitting the operation limit. Staggering would be done using some kind of swap group approach.
I seem to be having a hard time finding everything for that trigger Imperial. I am new to the editor. Can you give me an example of trigger the one you said would fetch nearest waypoint?
Nearest WP
Options: Function
Return Type: Point
Parameters
from = No Point <Point>
Grammar Text: Nearest WP(from)
Hint Text: (None)
Custom Script Code
Local Variables
i = 0 <Integer>
nearest = WayPoints[0] <Point>
amount = (Distance between from and WayPoints[0]) <Real>
temp = 0.0 <Real>
Actions
General - For each integer i from 1 to 9 with increment 1, do (Actions)
Actions
Variable - Set temp = (Distance between from and WayPoints[i])
General - If (Conditions) then do (Actions) else do (Actions)
If
temp < amount
Then
Variable - Set amount = temp
Variable - Set nearest = WayPoints[i]
Else
General - Return nearest
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi, I am doing a tug-of-war type map, and have a mothership (planning on switching to arbiter soon) with recall. I have units orderered upon building to go to their appropriate lanes toward enemy base already. But when units are recalled to a location, they lose their orders. I want them to retain their orders after recall, and not have to be ordered to a new point depending on where the unit currently is at. I don't know if this is possible. If not, can someone at least tell me how I can make recalled units only be ordered to auto-attack a new point? Is it some sort of effect?
You could just periodically order them their orders with a loop. So every 5-10 seconds they get the same order. They might stall for a few seconds after being recalled, but then will go back to their business.
The teleport effect does the actual moving. You can trigger enhance it to obtain what you want.
A trigger responding to an effect event can fetch various units and points similar to how the data editor does. Using these it can resolve certain units such as the origin or target (if TriggeringUnit is not sufficient). Once you have the unit that was teleported you can order it to do whatever you want.
You could order it back to the nearest lane waypoint using a minimum search. You could order it back to it's last waypoint by keeping track of its progress unit custom values (assign each lane node a unique identifier so you can always tell where it has to go next). The choice is really yours to make how you want it to resume orders.
Of note would be that the unit may have paused after the effect is run for a few seconds so orders are lost. In that case make the trigger thread wait a number of frames (such as a second or two) until it is unpaused and then issue the order. If you assign all values needed to locals at the time of effect fire then there is no chance they will be lost by the wait (although I think SC2 preserves those values much better than WC3). Never be afraid to Wait in trigger threads as SC2 waits are precise to 1 deterministic frame (there are 16 frames per second) which is the smallest resolvable deterministic time used by everything.
This approach is a lot more efficient than the above suggested polling approach. However if you want to use that rather I would suggest you stagger it just in case a large number of units some how manage to exist so that it does not consume enough resources to drop frames or cause a thread crash due to hitting the operation limit. Staggering would be done using some kind of swap group approach.
I seem to be having a hard time finding everything for that trigger Imperial. I am new to the editor. Can you give me an example of trigger the one you said would fetch nearest waypoint?
Simple minimum search.