ID:268995
 
Why does it say DeathCheck() undefined proc O.o

obj
var
reloadtime
range
Turret
icon='Turrets.dmi'
icon_state="Turret"
density = 1
reloadtime=30
range=3
New()
spawn(10)
Turret()
proc
Turret()
while(1)
if(locate(/mob) in oview(src,range))
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,range))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
var/obj/Bullet/B=new(src.loc)
walk_towards(B, M)
sleep(reloadtime)
Bullet
icon='Turrets.dmi'
icon_state="Bullet"
density = 1
Bump(atom/A)
if(ismob(A))
var/damage=rand(1,5)
A << "A turret shot you for [damage] damage!"
DeathCheck()
del(src)
mob
var
health
proc
DeathCheck()
if(src.health<=0)
world << "[src] has been killed!"
del(src)
white
icon='White.dmi'
icon='Turrets.dmi'
Proc calls default to src, so in your Bullet's Bump() proc you're actually calling src.DeathCheck() (/obj/Bullet/proc/Deathcheck()). Your Bullet object doesn't have a DeathCheck() proc, nor should it, what you need to do is call it from the mob. For that you'll need some extra type casting after you have detemined that A is a mob.

if(ismob(A))
var/mob/M=A // Create a new variable of type mob so that
//blah // you can call local /mob procs from it.
//blah
M.DeathCheck()
In response to YMIHere
K, How do I get the below code to attack other objects like MortarGuys and Turrets, scept they dont attack themselves, only any mob or other weapon around them...
obj
var
reloadtime
range
speed
HomingBay
icon='Turrets.dmi'
icon_state="MissleBay"
density = 1
reloadtime=30
range=6
speed=9
New()
spawn(10)
HomingMissle()
proc
HomingMissle()
while(1)
if(locate(/mob) in oview(src,range))
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,range))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
var/obj/Missile/HM=new(src.loc)
walk_towards(HM, M, speed)
sleep(reloadtime)
Missile
icon='Turrets.dmi'
icon_state="Missile"
density = 1
Bump(atom/A)
if(ismob(A))
var/mob/M=A
var/damage=rand(1,5)
A << "A homing missle shot you for [damage] damage!"
M.health-=damage
M.DeathCheck()
del(src)
MortarGuy
icon='Turrets.dmi'
icon_state="MortarGuy"
density = 1
reloadtime=30
range=5
speed=4
New()
spawn(10)
Mortar()
proc
Mortar()
while(1)
if(locate(/mob) in oview(src,range))
var/list/mobs_in_oview=new
for(var/mob/M in oview(src,range))
mobs_in_oview.Add(M)
var/mob/M=pick(mobs_in_oview)
var/obj/Mortar/MO=new(src.loc)
walk_towards(MO, M, speed)
sleep(reloadtime)
Mortar
icon='Turrets.dmi'
icon_state="Mortar"
density = 1
Bump(atom/A)
if(ismob(A))
var/mob/M=A
var/damage=rand(5,10)
A << "A mortar bombed you for [damage] damage!"
M.health-=damage
M.DeathCheck()
del(src)
mob
icon='Turrets.dmi'
var
health=10
proc
DeathCheck()
if(src.health<=0)
src << "You have died!"
src.health=10
turf
white
icon='White.dmi'