ID:149085
 
ok you see I have this "AI" system and the yare supposed to move acording to my coding. I'm trying to make the enemy move from left t oright with a think delay. The thing is, all they do is stand still like a freakin idiot. Here see for your self-->

mob/enemy/goomba
icon = 'Goomba.dmi'
var
think_delay = 4
New()
..()
spawn(rand(1,think_delay)) AI()
proc/AI()
var/move = rand(3,4)
if(move == 1)
step(src,WEST)
if(move == 2)
step(src,EAST)
spawn(think_delay) AI()
Branks wrote:
ok you see I have this "AI" system and the yare supposed to move acording to my coding. I'm trying to make the enemy move from left t oright with a think delay. The thing is, all they do is stand still like a freakin idiot. Here see for your self-->

mob/enemy/goomba
icon = 'Goomba.dmi'
var
think_delay = 4
New()
..()
spawn(rand(1,think_delay)) AI()
proc/AI()
var/move = rand(3,4)
if(move == 1)
step(src,WEST)
if(move == 2)
step(src,EAST)
spawn(think_delay) AI()

step() will never be executed. You are picking a random number from 3-4, and testing to see if it equals 1 or 2.
Branks wrote:
proc/AI()
var/move = rand(3,4)
if(move == 1)
step(src,WEST)
if(move == 2)
step(src,EAST)
spawn(think_delay) AI()

Because the move var is only ever 3 or 4, not 1 or 2, your mob never does anything except call AI() over and over again.

Lummox JR
It would be easier for you to just do this:
proc/AI()
step(src,pick(EAST,WEST))
spawn(think_delay)AI()

Short and sweet.