Author Topic: Coding Help (random enemy units)  (Read 512 times)


  • Newbie
  • *
  • Posts: 1
Coding Help (random enemy units)
« on: March 25, 2018, 07:32:39 pm »
Hey, is there a way to get the coordinates for a random enemy unit? I have looked and cannot find anything for that.


  • Community Guild
  • *****
  • Posts: 3329
  • (Pusillanimous)
Re: Coding Help (random enemy units)
« Reply #1 on: March 25, 2018, 08:36:34 pm »
There isn't a single command. This will probably do something similar...

Code: [Select]
:RandEnemy #[ - UID]
    0 0 9999 GetEnemyUnitsInRange ->Count #All enemies
    0 <-Count RandInt ->Selection #Pick the "selection"-th enemy

    <-Count 0 do #Clear the rest of the stack
        <-Selection I eq if
            ->Pick #Save the chosen unit UID
            pop #Discard everything else
    <-Pick #Return
A narrative is a lightly-marked path to another reality.