Hopefully the last thing i need help with.

Started by Nicant, November 14, 2015, 11:32:03 AM

Previous topic - Next topic

Nicant

This should be the last thing i need help on for now. But anyways, i need help on having the fake ore packet find where it needs to go. What i mean is so far the ore packet script just finds a collector or relay to go to and it just stays there, not moving to a different collector/ relay. So I want it to first Find a specific unit that is connected to the network. Then Move to that unit via traveling between collectors/relays. Here is what i have so (Thank you Hubs for showing me the code for the "packet" to find collectors or relays)

$Range:10
$Speed:2

once
Self CONST_CONNECTABLE 0 SetUnitAttribute
Self CONST_CREATEPZ 0 SetUnitAttribute
Self CONST_DESTROYMODE 0 SetUnitAttribute
endonce

160 138 CurrenCoords Distance ->TargetDestination
:FindUnit
# Gets a list of all collectors and relays within Range
CreateList ->List
CurrentCoords <-Range GetUnitsInRange 0 do # Gets all units in Range, then loops through them
->UnitID # stores the UnitID
if (<-UnitID GetUnitType "RELAY" eq <-UnitID GetUnitType "COLLECTOR" eq or ) # checks if unit type is a collector or relay
<-List <-UnitID AppendToList
endif
<-UnitID CONST_COORDX GetUnitAttribute ->UnitX
<-UnitID CONST_COORDY GetUnitAttribute ->UnitY
<-TargetDestination CurrentCoords gte if

<-UnitX <-UnitY <-Speed QueueMove
else
        #This else is here to have the packet see if it is getting closer to the target destination. So pretty much this is a loop only if it is getting closer to the target
@FindUnit

endif
endif
loop


EDIT: XD I did not realize it was put in a list.
Any help from anyone is greatly appreciated!
CW4 hype!!