digitalis spreader not working

piggood · 426

piggood

  • Jr. Member
  • **
    • Posts: 23
on: June 21, 2019, 08:40:14 am
I was making a unit that moves to Where Digitalis exist and make a 3x3 digitalis growth there. but it doesn't move.
(Sorry I'm bad at english)
Code: [Select]
ShowTraceLog
CurrentX CurrentY 5 RandCoordsInRange ->x ->y
<-x <-y GetDigitalisGrowth ->hi
<-hi 1 eq if
1 trace
GetQueuedMoveCount ->hi
<-hi 0 eq if
<-x <-y 15 QueueMove
endif
endif
CurrentY 2 add CurrentY 1 sub do
  CurrentX 2 add CurrentX 1 sub do
    I J true SetDigitalisGrowth
  Loop
Loop



Builder17

  • Community Guild
  • *****
    • Posts: 1065
  • My account picture is from Nitrome Mutiny.
Reply #1 on: June 21, 2019, 10:04:53 am
Code: [Select]
ShowTraceLog
CurrentX CurrentY 5 RandCoordsInRange ->y ->x
<-x <-y GetDigitalisGrowth ->hi
<-hi 1 eq if
1 trace
GetQueuedMoveCount ->hi
<-hi 0 eq if
<-x <-y 15 QueueMove
endif
endif
CurrentY 2 add CurrentY 1 sub do
  CurrentX 2 add CurrentX 1 sub do
    I J true SetDigitalisGrowth
  Loop
Loop

Changed coordinate order of RandCoordsInRange, try if this code would work any better. :)



piggood

  • Jr. Member
  • **
    • Posts: 23
Reply #2 on: June 21, 2019, 11:09:48 pm
Thanks! it worked!  :)