mob
Hollow
name = "{NPC} Hollow"
icon = 'normalhollow.dmi'
icon_state = ""
race = "Hollow"
density = 1
var/mob/target
New()
spawn() wander()
proc
wander()
for()
hasnotarget
sleep(3)
if(!target)
for(var/mob/m in oview(7, src))
if(m.race != "Hollow"&&m.NPC1 == 0)
target = m
if(!target)
walk_rand(src, 5)
sleep(3)
goto hasnotarget
sleep(2)
goto hastarget
else
hastarget
sleep(3)
if(target in oview(3, src))
var/decision = rand(1,5)
if(decision == 5)
view()<<"<b>Decision"
var/obj/K = new/obj/attacks/cero(src.loc)
K:dir = src.dir
walk(K,src.dir)
sleep(5)
walk(src, 0)
sleep(5)
goto hastarget
else
step_towards(src, target)
goto hastarget
else if(target in oview(7, src))
step_towards(src,target)
goto hastarget
else
target = null
walk(src, 0)
goto hasnotarget
Bump(mob/M)
if(M.race == src.race)
return
else
var/damage = round(src.str - M.def)
if(damage<=0)
damage = 1
flick("Attack",src)
M.health -= damage
M<<"\red <b>[src] hit you for [damage] damage! Health Remaining: [M.health]/[M.mhealth]"
M.Death(src)
sleep(7)
Bump(turf/T)
..()
Bump(area/A)
..()
obj
var
owner = null
trail = 0
obj
attacks
cero
icon = 'normalhollow.dmi'
icon_state = "tipcero"
density = 1
New()
spawn(100)
view()<<"<b>Spawned"
del(src)
view()<<"<b>Deleted"
Bump(mob/M)
view()<<"<b>Cero Bump"
if(M.NPC1 == 1)
del(src)
else
var/damage = round(usr.mrei - M.def)
if(damage <= 0)
damage = 1
M.health-=damage
M<<"[src.owner]'s [src] hit you for [damage]!"
M.Death()
del(src)
Move()
var/obj/K = new/obj/attacks/cerotrail(src.loc)
K.dir = src.dir
..()
Bump(obj/O)
view()<<"<b>Obj"
if(O.trail)
..()
else
del(src&&O)
Bump(turf/T)
view()<<"<b>Turf"
del(src)
cerotrail
icon = 'normalhollow.dmi'
icon_state = "bodycero"
density = 0
trail = 1
New()
spawn(30)
del(src)
Problem description:
Okay, I know I'm not the best or great at coding but please help me on this problem:
Whenever I'm in the game and the decision variable becomes 5, which is when its supposed to shoot a cero, it gives me a runtime error saying that it cannot modify a null direction; which I suppose means that K is null. That's where I get stuck, I'm not quite sure how K could be null or how it can't modify a null direction. Any ideas?
First a few things to keep in mind:
1) This is a non-rip game
2) I know goto is bad
3) Schnitzelnaggler helped me on the target system
4) Everything else, I coded
5) When it DID work, and the cero hit me nothing happened besides the cero was deleted as if I weren't a mob but then I tested turfs and objects as well and it seemed as if it didn't bump into anything, it just deleted itself.
6) I'm not sure if this belongs here because a few months or so ago animes were banned from the forums and I haven't been on much since then.