ID:162899
 
How would I go about that?
Im unaware of a better way, so here's how I do it...

mob/var/respawn
mob/AI/Enemy
name="Monster"
Health=100
MaxHealth=50
Attack=50
Defence=50
Speed=50
New()
spawn()
src.respawn=src.loc //sets respawn point (needed for use in the Death Check proc to spawn monster in same place)
src.AI() //starts AI


mob/proc
AI()
if(src.Hunting) return
for(var/mob/player/M in range(12,src))
if(/* M meets criteria for being chased */)
//bunch of 'attack' code
else
if(get_dist(src,src.respawn)>5)
step_to(src,src.respawn)//keeps Monster near spawn point
else
src.steprand()//otherwise, randomly step somewhere
sleep(15)
spawn(7)
if(src)src.AI()//loop the proc every 7 ticks

AIAttack(mob/M)
view(4,M) << "[src] attacks [M] causing [round(dmg)] damage!"
M.Health-=round(dmg); M.DeathCheck(src)


//i created my own step_rand proc because the built-in one sends mob in direction its facing 95% of the time

mob/AI
Bump(A)
if(ismob(A))
var/mob/M = A
if(!istype(M,/mob/AI))//if the mob being bumped into isnt a computer player
AIAttack(M)
//not sure the next bit is even needed...
if(istype(A,/turf/))
var/turf/T = A
if(T.density) return
if(istype(A,/obj/)) return


This covers BASIC punching through bumpin AI... Get creative, add long range attacks, tricky sidesteps, a sense of fear etc.

Im sure you can code your own mob/AI/DeathCheck()...

Some procs you should lookup on DM reference (if youre not already familiar with them) are:
step
step_to
step_towards
step_away
step_rand (in my opinion, this is a crap proc)
get_dist
get_step
Bump


~I'm so friggin nice.
In response to Saucepan Man
Thank you, I am familiar with bump, but whats a good tutorial to learn this (that isn't the DM guide >.>)
In response to PheonixReborn