mob/combat
verb
Attack(mob/m in get_step(usr,usr.dir))
set category = "Combat"
if(usr.attack == 0 && ko==0) //if 0 it attacks if 1 it doesnt
var/Dmg = src.Strength/5+usr.Speed/m.Defense
if(src.Speed>m.Speed)
var/Dodge = prob(50)
if(Dodge)
Dmg = 0
view() << "<font color=red><i>[m] has dodged [src]'s attack!"
if(usr.Clan=="Normal")
usr.exp+=m.level/5
src.Levelup(usr)
if(usr.Clan=="Fighter")
usr.exp+=m.level/3
src.Levelup(usr)
if(Dmg<=0)
Dmg = 0
m.Health -= Dmg
src.kocheck(m)
view() << sound('punch1.wav',0)
usr.attack = 1
if(usr.Clan=="Normal")
usr.exp+=m.level/3
src.Levelup(usr)
if(usr.Clan=="Fighter")
usr.exp+=m.level/2
src.Levelup(usr)
m << "[src] is attacking you for [num2text(round(Dmg,1),7)] damage!"
src << "You attack [m] for [num2text(round(Dmg,1),7)] damage!"
if(Gomu_Gatling_Gun==1)
usr.attack = 0
if(ragemeter==100)
sleep(3)
usr.attack = 0
else
sleep(7)
usr.attack = 0
mob/var
attack = 0
mob/proc/kocheck(mob/m)
if(m.Health <= 0 && m.ko == 0)
usr << "You have KOd [m]"
m << "You've been beaten and have fallen to the ground"
m.ko=1
sleep(200)
m.ko=0
mob
verb
Kill(var/mob/m in oview(1))
if(m.ko==1)
src.deathcheck(m)
Problem description:
Everything goes well for awhile and I don't know exactly what the problem is. But while I'm attacking later on I get an error stating this:
runtime error: Cannot modify null.ko.
proc name: kocheck (/mob/proc/kocheck)
source file: Combat.dm,67
usr: Roronoa Zoro (/mob/PC)
src: Roronoa Zoro (/mob/PC)
call stack:
Roronoa Zoro (/mob/PC): kocheck(null)
Roronoa Zoro (/mob/PC): Attack(null)
runtime error: Cannot read null.level
proc name: Attack (/mob/combat/verb/Attack)
source file: Combat.dm,42
usr: Roronoa Zoro (/mob/PC)
src: Roronoa Zoro (/mob/PC)
call stack:
Roronoa Zoro (/mob/PC): Attack(null)
runtime error: Cannot modify null.ko.
proc name: kocheck (/mob/proc/kocheck)
source file: Combat.dm,67
usr: Roronoa Zoro (/mob/PC)
src: Roronoa Zoro (/mob/PC)
call stack:
Roronoa Zoro (/mob/PC): kocheck(null)
Roronoa Zoro (/mob/PC): Attack(null)
runtime error: Cannot read null.level
proc name: Attack (/mob/combat/verb/Attack)
source file: Combat.dm,42
runtime error: Cannot modify null.ko.
proc name: kocheck (/mob/proc/kocheck)
source file: Combat.dm,67
runtime error: Cannot read null.level
proc name: Attack (/mob/combat/verb/Attack)
source file: Combat.dm,42
runtime error: Cannot modify null.ko.
proc name: kocheck (/mob/proc/kocheck)
source file: Combat.dm,67
runtime error: Cannot read null.level
proc name: Attack (/mob/combat/verb/Attack)
source file: Combat.dm,42
runtime error: Cannot modify null.ko.
proc name: kocheck (/mob/proc/kocheck)
source file: Combat.dm,67
runtime error: Cannot read null.level
proc name: Attack (/mob/combat/verb/Attack)
source file: Combat.dm,42
runtime error: Cannot modify null.ko.
proc name: kocheck (/mob/proc/kocheck)
source file: Combat.dm,67
runtime error: Cannot read null.level
proc name: Attack (/mob/combat/verb/Attack)
source file: Combat.dm,42
runtime error: Cannot modify null.ko.
proc name: kocheck (/mob/proc/kocheck)
source file: Combat.dm,67
runtime error: Cannot read null.level
proc name: Attack (/mob/combat/verb/Attack)
source file: Combat.dm,42
This wasn't happening until I added that small KO system so I am guessing it has something to do with that. Please help me if you can.
What that error is saying is that 'm' is null, meaning no mob
so add this before anything else (well, except after set...but you know what I mean)
- GhostAnime
PS: Learn about Boolean shortcuts
if, let's say you put KO=null somewhere,than KO==0 will NOT happen but !KO will [read it to see what I mean]