mob
trainer
rattata1
New()
Equipping(new/mob/Rattata,0,0)
dir = EAST
LineOfSight(2)
proc/LineOfSight(tiles, continuecheck = 1)
for(var/mob/M in view(tiles))
var/check = 0
for(var/mob/N in playersbattled)
if(N == M)
check = 1
if(check == 0)
if(dir == EAST)
if(M.x > x && M.y == y)
M.frozen = 1
sleep(5)
walk_to(M,src,1,1)
M.Battle(src)
if(dir == WEST)
if(M.x < x && M.y == y)
M.frozen = 1
sleep(5)
walk_to(M,src,1,1)
M.Battle(src)
if(dir == NORTH)
if(M.y > y && M.x == x)
M.frozen = 1
sleep(5)
walk_to(M,src,1,1)
M.Battle(src)
if(dir == SOUTH)
if(M.y < y && M.x == x)
M.frozen = 1
sleep(5)
walk_to(M,src,1,1)
M.Battle(src)
if(continuecheck)
LineOfSight(tiles)
Problem description:
This is my code for an NPC trainer in my pokemon game. I am trying to make a working "Line Of Sight" proc, so that the NPC trainer continuously checks the tiles in front of the NPC for players, and begins a battle with any player they haven't battled with.
However, when i walk in front of the "rattata1" trainer, whether one or two tiles in front, the appropriate action isnt carried out. Where have i gone wrong?
EDIT: I understand it has something to do with the loops, from bug testing.