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'
ID:268995
Jan 14 2005, 12:07 pm
|
|
Why does it say DeathCheck() undefined proc O.o
|
Jan 14 2005, 12:35 pm
|
|
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.
|
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 |