mob
proc
NPCAI2()
var/mob/M = usr
while(src)
if(M in oview(1))
if(istype(src,/mob/enemies/Oktorok))
sleep(20)
NPCAI2()
if(istype(src,/mob/enemy/Link3))
sleep(20)
NPCAI2()
if(istype(src,/mob/enemy/Ganon))
sleep(20)
NPCAI2()
if(istype(src,/mob/enemy/Zelda))
sleep(20)
NPCAI2()
else
sleep(20)
src.MONATTACK(M)
NPCAI2()
else
sleep(10)
if(prob(25))
step(src,NORTH)
if(prob(25))
step(src,SOUTH)
if(prob(25))
step(src,WEST)
if(prob(25))
step(src,EAST)
if(prob(25))
step(src,NORTHWEST)
if(prob(25))
step(src,NORTHEAST)
if(prob(25))
step(src,SOUTHWEST)
if(prob(25))
step(src,SOUTHEAST)
break
sleep(5)
spawn(2)
NPCAI2()
mob
proc
MONATTACK(mob/M in get_step(src,src.dir))
var/damage = src.Level*10
view() << "[src] attacks [M] for [damage]!"
M.HP -= damage
if(M.HP <= 0)
M.Death(src)
mob
enemy
Zelda
name= "Zelda"
icon = 'Zelda.dmi'
MaxHP = 2000
HP = 2000
NPC=1
Level = 2e+006
New()
NPCAI2()
mob
enemy
Ganon
name= "Ganon"
icon = 'Ganon.dmi'
MaxHP = 6000
HP = 6000
NPC=1
Level = 6e+006
New()
NPCAI2()
mob
enemy
Link3
name= "Link"
icon = '!!!gba link2.dmi'
MaxHP = 1000
HP = 1000
NPC=1
Level = 1e+006
New()
NPCAI2()
I get no errors in this code string, but when I compile and run, the NPC's don't attack me.
I tried deleting:
if(istype(src,/mob/enemies/Oktorok))
sleep(20)
NPCAI2()
if(istype(src,/mob/enemy/Link3))
sleep(20)
NPCAI2()
if(istype(src,/mob/enemy/Ganon))
sleep(20)
NPCAI2()
if(istype(src,/mob/enemy/Zelda))
sleep(20)
NPCAI2()
But then they attacked the other NPC's and themselves but wouldn't attack me. Help.
Also, make sure you always put a ..() in the New() proc.
I also recommend looking up some AI tutorials, such as Forum_account's Enemy AI Demo.