I can't find anything in this code that would make it not do what it's supposed to: move to a random spot, suck up the creeper, and throw a spore with that amount of creeper in it. Instead, it fires spores from some random place (same one everytime) does not always launch a spore and... well yeah, doesn't work. To see what I mean attach the script to a Core tower in a map with lots of creeper.
ShowTraceLog
CurrentX ->x
CurrentY ->y
once
300 Delay
5 0 do
CurrentCoords CurrentCoords 30 RandCoordsInRange 1 5 100 RandInt CreateSpore
10 Delay
loop
endonce
GetQueuedMoveCount eq0 if
30 Delay
CurrentCoords RandUnitCoords 3 8 RandInt @GetCreeperForSpore CreateSpore
@GetMoveCoords 6 QueueMove
200 Delay
endif
:GetCreeperForSpore
0 ->cAmt
<-x 1 add <-x 1 sub do
<-y 1 add <-y 1 sub do
<-cAmt I J GetCreeper add ->cAmt
I J 0 SetCreeper
loop
loop
<-cAmt Trace
:GetMoveCoords
CurrentCoords 60 RandCoordsInRange
map with script attached: |
\/
Might be better if you uploaded your test map with the script included. :)
RandUnitCoords only works if there are units, which means that it only fires spores if there are units to shoot at
also, at the end of the function "GetCreeperForSpore", you need a return command, so at the end of that, put
<-cAmt
also, I would try to minimize variable and function use, so those 2 variables x and y should be removed and changed in the script to CurrentX and CurrentY, which they represent, and just put the code for GetMoveCoords right into the original line
ShowTraceLog
once
300 Delay
5 0 do
CurrentCoords CurrentCoords 30 RandCoordsInRange 1 5 100 RandInt CreateSpore
10 Delay
loop
endonce
GetQueuedMoveCount eq0 if
30 Delay
CurrentCoords RandCoords 3 8 RandInt @GetCreeperForSpore CreateSpore
CurrentCoords RandCoords 6 QueueMove
200 Delay
endif
:GetCreeperForSpore
0 ->cAmt
CurrentX 1 add CurrentX 1 sub do
CurrentY 1 add CurrentY 1 sub do
<-cAmt I J GetCreeper add ->cAmt
I J 0 SetCreeper
loop
loop
<-cAmt Trace
<-cAmt
Ah - one pesky thing I missed. And the getMoveTarget function is just a placeholder, that will eventually find a place with the deepest creeper, or some other stuff like that.