ID:171243
 
Okay here is the coding i Have for a current game i am working on.
turf/trigger
icon = 'trigger.dmi'
Entered(mob/M)
var/obj/D = new/obj/dart(locate(15,15,2))
walk(D,WEST)
return

obj/dart
icon = 'dart.dmi'
density = 1
Bump(mob/M)
if(ismob(M))
M << "You are hit by a flying dart!"
M.Hp -= 50
M.Death()
else
del(src)

It is supposed to mkae it so that when a trigger is stepped on, a dart flys out from one end of the hallway to another,and damages any mobs it hits. But for some reason, when it hits a mob, it gives me runtime errors, and it keeps shooting darts over and over again...i only want it to shoot one though! someone please help!
Take out "if(ismob(M))", I think that's what's causing the problem.
In response to Hell Ramen
Don't forget to delete the dart when it hits the mob as well.

--Goz
What run-time errors are you receiving?
In response to Hell Ramen
Hell Ramen wrote:
Take out "if(ismob(M))", I think that's what's causing the problem.

Sorry, wrong answer! The ismob(M) is needed, otherwise he'll get some nasty runtime errors whenever he hits something that isn't a mob.

Rein, you need to post the runtime errors you're getting. Can't fix the problem if we don't know what it is. =P
In response to Goz
Ok first heres the runtime error:
runtime error: Cannot read 0.Hp
proc name: Death (/mob/proc/Death)
source file: test1.dm,7
usr: 0
src: Reinhartstar (/mob/archer)
call stack:
Reinhartstar (/mob/archer): Death()
the dart (/obj/dart): Bump(Reinhartstar (/mob/archer))


second heres my death code. i dont know if this has anything to do with it. but hey, with my idiocy level, ya never know:
mob/proc/Death()
if(usr.Hp <= 0)
view() << "[usr] was killed!"
usr.icon_state = "ghost"
usr << sound('death.mid',1)

Oh and i also still need someone to tell me how to fix it so dat it only shoots 1 dart, not keeps shooting them.
In response to Reinhartstar
Use "src"...?