Projectile
parent_type = /obj/
var/damage = 0
var/delay = 1
var/moving = 0
var/my_path = /Projectile/
New()
sleep(300)//If it doesn't get to its target in 30 seconds it will be deleted.
del(src)
Projectile/Bump(atom/O)
if(istype(O,/mob/))
if(O.density)
var/mob/M = O
M.health -= src.damage
if(istype(O,/turf/))
if(O.density)
del(src)
if(istype(O,/obj/))
var/obj/target = O
if(target.can_destory)
del(O)
del(src)
..()
mob
var/health = 100
obj
var
can_destory = null
atom
Click()
var/Projectile/PP
PP.Trace(src)
..() // do default action
/Projectile/proc/Trace(atom/P)
var/PJ = new src( usr.loc)
walk_to(PJ,P)
Projectile
Move()
if(src.moving) // If they are moving..
return // Stop
else
src.moving = 1 // Set there Moveing to 1.
..() // Calls the defualt of the Move() proc, which is to move of course :).
sleep(src.delay) // Sleeps the Move_Delay's set amount.
src.moving = 0
OK How would I fix this where so
runtime error: Cannot execute null.Trace(). proc name: Click (/atom/Click) usr: HXR_Wheaties (/mob) src: the turf (6,9,1) (/turf) call stack: the turf (6,9,1) (/turf): Click(the turf (6,9,1) (/turf), "mapwindow.map", "icon-x=24;icon-y=14;left=1")
Won't appear?
The my_path var is useless - look up the built-in type variable. And instead of sleep(), you should use spawn() so the proc returns instead of hanging for 30 seconds (which also hangs callers of new()). Same thing in Move().
Before using it, you need to set the PP var to an actual value (the = operator is for setting vars to values) instead of giving it no value therefore its value remains null. You can't just define a var and expect to do something with it without giving it a value - Dream Maker can't automagically guess what value you'd like it to have, irregardless of it being defined to reference something of the /Projectile type (which is used mostly for compile-time error checking anyway).
What object are you exactly trying to call the Trace() proc on? Currently you're calling it on none, hence your error. Maybe you want src (the object clicked on) and you've confused things?
new() takes a type path there, where you've used src, but src is an object, not a type path. If you want to create a new object of the same type of src, use src's type var, mentioned above.