ID:584815
 
Code:
mob/monsters
Basic_Monsters
icon='Monsters_1.dmi'
density = TRUE
Rabbit
icon_state = "Rabbit"
race = "Rabbit"
powerlevel = 25000000
maxpowerlevel = 250
strength = 10
defense = 2
kipower = 2
zenni = 10
level = 1
exp = 90
New()
.=..()
spawn(1)
NonAggresiveLook()
Move(var/turf/NewTurf,var/StepDir)
switch(StepDir)
if(NORTHWEST) pick(step(src,NORTH),step(src,WEST))
if(NORTHEAST) pick(step(src,NORTH),step(src,EAST))
if(SOUTHWEST) pick(step(src,SOUTH),step(src,WEST))
if(SOUTHEAST) pick(step(src,SOUTH),step(src,EAST))
else return ..(NewTurf,StepDir)
mob
proc
NonAggresiveLook()
var/mob/Player/M
while(src)
if(M in oview(5))
if(M.name in src.killlist)
walk_to(src,M,1,4)
if(M in oview(1))
step_towards(src,M)
else
sleep(15)
step_rand(src)
break
else
for(M in view(src))
break
sleep(5)
spawn(2)
NonAggresiveLook()


Problem description:
This is my basic AI system. I know i have to add Bump and Attack for monsters but ima go do that later.

I'm wondering how I would make a Monster shoot a projectile, when they are facing the person, but not right in front of them.

I tried with
walk_to(src,M,3,4)

But my goal is to prevent AI from facing them diagonally while standing 3 space away from them.
I also want that when monster is closer than 3 space away he will go to player
Thanks for help
I dont know about the other things but you can use
step(src,pick(NORTH,SOUTH,EAST,WEST))

insted of
step_rand(src)

You re using Move() so it can get a bit confusy
He only wants the mob to move (North,East,South,West) if you read what its doing.
Brincl_96 wrote:
I'm wondering how I would make a Monster shoot a projectile, when they are facing the person, but not right in front of them.

if(get_dist(src, target_mob) > 1)
do_projectile_stuff()


But my goal is to prevent AI from facing them diagonally while standing 3 space away from them.
I also want that when monster is closer than 3 space away he will go to player

for(var/mob/m in oview())
if(get_dist(src, m) < 3)
var/dir = pickNearest(get_step(src, m))
step(src, dir)
proc/pickNearest(dir)
. = dir
if(dir == NORTHWEST) . = pick(NORTH, WEST)
if(dir == NORTHEAST) . = pick(NORTH, EAST)
if(dir == SOUTHWEST) . = pick(SOUTH, WEST)
if(dir == SOUTHEAST) . = pick(SOUTH, EAST)


I can barely understand your english, but meh.

You want to know how to make a monster shoot a projectial, prevent them from facing diagonal directions, and follow the player within a small radius(3 spaces)?

Seeing the powerlevel and ki vars, I assume this is a dbz game, probaly a rip.

But meh.
mob/monsters
Basic_Monsters
icon='Monsters_1.dmi'
density = TRUE
Rabbit
icon_state = "Rabbit"
race = "Rabbit"
powerlevel = 25000000
maxpowerlevel = 250
strength = 10
defense = 2
kipower = 2
zenni = 10
level = 1
exp = 90
New()
.=..()
spawn(1)
NonAggresiveLook()
Move(var/turf/NewTurf,var/StepDir)
switch(StepDir)
if(NORTHWEST) pick(step(src,NORTH),step(src,WEST))
if(NORTHEAST) pick(step(src,NORTH),step(src,EAST))
if(SOUTHWEST) pick(step(src,SOUTH),step(src,WEST))
if(SOUTHEAST) pick(step(src,SOUTH),step(src,EAST))
else return ..(NewTurf,StepDir)
mob
proc
NonAggresiveLook()
var/mob/Player/M
while(src)
if(M in oview(5))
if(M.name in src.killlist)
walk_to(src,M,1,4)
if(M in oview(1))
src.Attack(M)
else
src.Ki_Blast()
else
sleep(15)
step_rand(src)
break
else
for(M in view(src))
break
sleep(5)
spawn(2)
NonAggresiveLook()


You'd have to make attack and ki_blast procs for the mob but meh.