Bump(atom/M)
var/damage = rand((owner:power/2.5)-(M:defense+M:speed))/10
if(isturf(M))
owner.firing = 0
owner.freeze = 0
for(var/obj/O in src.ki_beam)
del(O)
del(src)
else if(ismob(M))
owner.firing=0
owner.freeze=0
if(damage<=0)
M<<"[owner] missed!"
owner<<"You missed!"
for(var/obj/O in src.ki_beam)
del(O)
del(src)
return
owner<<"You hit [M] with [src] for [damage]!"
M<<"[owner] hit you with [src] for [damage]!"
M:health-=damage
M:health_check()
if(M:health<=0)
owner<<"You killed [M]"
M:death_check()
for(var/obj/O in src.ki_beam)
del(O)
del(src)
else
if(!ismob(M) && !isturf(M) && !isobj(M) && !isarea(M))
owner.firing = 0
owner.freeze = 0
for(var/obj/O in src.ki_beam)
del(O)
del(src)
Problem description:
The problem is that when beam which is an obj bumps another obj such as a wall or door it sends errors to me talking about how much it hated what I just did.
This is the problem I had when I shot the beam toward my training bag
runtime error: undefined variable /obj/training_objs/bag_2/var/defense
proc name: Bump (/obj/beams/ki_beam/Bump)
source file: Beam System.dm,27
usr: 0
src: the ki beam (/obj/beams/ki_beam)
call stack:
the ki beam (/obj/beams/ki_beam): Bump(Training bag level 2 (/obj/training_objs/bag_2))
the ki beam (/obj/beams/ki_beam): Move(the floor1 (10,18,1) (/turf/house_icons/floor1), 4)
runtime error: undefined variable /obj/training_objs/bag_2/var/defense
proc name: Bump (/obj/beams/ki_beam/Bump)
source file: Beam System.dm,27
usr: 0
src: the ki beam (/obj/beams/ki_beam)
call stack:
the ki beam (/obj/beams/ki_beam): Bump(Training bag level 2 (/obj/training_objs/bag_2))
the ki beam (/obj/beams/ki_beam): Move(the floor1 (10,18,1) (/turf/house_icons/floor1), 4)
runtime error: undefined variable /obj/training_objs/bag_2/var/defense
proc name: Bump (/obj/beams/ki_beam/Bump)
source file: Beam System.dm,27
usr: 0
src: the ki beam (/obj/beams/ki_beam)
call stack:
the ki beam (/obj/beams/ki_beam): Bump(Training bag level 2 (/obj/training_objs/bag_2))
the ki beam (/obj/beams/ki_beam): Move(the floor1 (10,18,1) (/turf/house_icons/floor1), 4)
Yes I am aware this is for a DBZ style game but its totally original and I can prove it.
if(ismob(M))
on the first line its trying to use defense no matter what type it bumps into
or just move that line down to the mob section <.<