Coding Help (random enemy units)

Started by SnowGoem, March 25, 2018, 07:32:39 PM

Previous topic - Next topic

SnowGoem

Hey, is there a way to get the coordinates for a random enemy unit? I have looked and cannot find anything for that.

GoodMorning

There isn't a single command. This will probably do something similar...


: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
        else
            pop #Discard everything else
        endif
    loop
    <-Pick #Return


http://knucklecracker.com/wiki/doku.php?id=crpl:docs:getenemyunitsinrange
A narrative is a lightly-marked path to another reality.