ID:264835
 
Code:
M.powerlevel -= round(ki_damage)
M << "\red [usr.name]'s Kienzan Disk slices into you"
M.SmallKiDeathCheck(src)
src.doing = 0
src.frozen = 0
if(M.race == "Saiyan")
if(prob(35))
if(M.tail_cut)
M << "\red [src.name]'s Kienzan Disk has cut your tail off!"
M.overlays -= M.tail
M.tail_cut = 0
if(M.monkey)
M.oozaru_break()
spawn(2000) M.apply_tail()
return

obj/CH_Distructo_Disk
icon = 'Distructo Disk2.dmi'


Problem description:every time on the game i goto use this tech it says runtime error: Cannot read null.race
proc name: Kienzan Disk (/mob/learn/Changling/verb/Changling_Distructo_Disk)
source file: Changling Distructo Disk.dm,109 and the Line that 109 is at is the if(M.race == "Saiyan")i tryed to fix it myself many time but when i do i get errors when i compile



Apparently SmallKiDeathCheck() caused the deletion of M. In your if(), it's trying to check the variable of an object that doesn't exist anymore.
Work around this by first checking if M exists, like so:
if(M && /*other_conditions here*/)
// etc.
In response to Kaiochao
this is what i did now i have expression error can some show exactly how i fix this?? o and the expression error is 109

if(M && /*race == "Saiyan"*/)
//etc.
if(prob(35))
if(M.tail_cut)
M << "\red [src.name]'s Kienzan Disk has cut your tail off!"
M.overlays -= M.tail
M.tail_cut = 0
if(M.monkey)
M.oozaru_break()
spawn(2000) M.apply_tail()
In response to John mayers
The /* */s are comments. Dream Maker will ignore any code between them. You'd know that if you read the DM guide.
In response to Kaiochao
yes i do know that but still you said to do this and idk where i am suppose to put this..

if(M && /*other_conditions here*/)
// etc.

heres my Coding n i have no idea where i put what you wrote me i have tryed it many ways each way just gave me even more errors plz Help/Tell me what to do where to put it etc

M.powerlevel -= round(ki_damage)
M << "\red [usr.name]'s Kienzan Disk slices into you"
M.SmallKiDeathCheck(src)
src.doing = 0
src.frozen = 0
if(M.race == "Saiyan")
if(prob(35))
if(M.tail_cut)
M << "\red [src.name]'s Kienzan Disk has cut your tail off!"
M.overlays -= M.tail
M.tail_cut = 0
if(M.monkey)
M.oozaru_break()
spawn(2000) M.apply_tail()
return
In response to John mayers
This is why its a better idea to learn from demos rather then ripping stuff from sources such as zeta.

Furthermore its hard to see where the error could be fully originating. Please post the entire proc (or verb) aswell as w.e may come before it. for example an attack skill would call a death proc but the death proc has a cannot read null error. its best to post both the attacking skill in question and the death proc.
In response to Midgetbuster
Code:
mob/var/ch_distructo_disk = 'Distructo Disk Charge2.dmi'
mob/var/disk_lock = 0

mob/learn/Changling
verb
Changling_Distructo_Disk(mob/M in oview(6))
set name = "Kienzan Disk"
set category = "Techniques"

if(src.doing)
src << "You are already doing something!"
return

if(src.buku)
return

if(M.safe)
src << "A force stops you from attacking [M]"
return

if(src.safe)
src << "You are currently safe and cannot attack."
return

if(src.wrapped)
src << "Your ki has been contained in the goo!"
return

if(src.dead)
return

if(src.ki_lock)
src << "Cannot use this Technique at his time"
return

if(src.disk_lock)
src << "You are recovering from your last blast..."
return

if(!M.pk)
usr << "[M] Must be a combatant to engage in combat with players!"
return


if(!src.pk)
usr << "You are not a Combatant!"
return

for(var/turf/Floors/Safe_Zone/S in view(6))
if(S in view(8))
usr << "They are in a Safe Zone!"
return
for(var/turf/Planet_Gravitys/Supreme_Kai/A in view(6))
if(A in view(8))
usr << "They are in a Safe Zone!"
return

for(var/turf/Planet_Gravitys/King_Kai/D in view(6))
if(D in view(8))
usr << "They are in a Safe Zone!"
return


src.afk_time = 0

var/ki_damage = round(((usr.ki_skill / usr.ki_skill_max) * usr.level) + usr.powerlevel_max * 0.15)
var/ki_cost = round(src.ki_max * 0.72)

if(src.ki >= ki_cost)
if(!src.doing)
src.ki_lock = 1
spawn(70) src.ki_lock = 0
src.doing = 1
src.ki -= ki_cost
src.overlays += ch_distructo_disk
view(6) << "<font color = white>[src]:</font> Kienzan..."
sleep(10)
view(6) << "<font color = white>[src]:</font> DISK..."
sleep(15)
view(6) << "<font color = white>[src]:</font> HA!!!"
src.overlays -= ch_distructo_disk
spawn(5) src.doing = 0
spawn(5) src.frozen = 0
missile(new/obj/CH_Distructo_Disk, usr, M)
spawn(150) src.disk_lock = 0

if(prob(4))
M.powerlevel = 0
M << "\red [usr.name]'s Kienzan Disk slices through your Chest!"
M.SmallKiDeathCheck(src)
src.doing = 0
src.frozen = 0
if(M.race == "Saiyan")
if(prob(35))
if(M.tail_cut)
M << "\red [src.name]'s Kienzan Disk has cut your tail off!"
M.overlays -= M.tail
M.tail_cut = 0
if(M.monkey)
M.oozaru_break()
spawn(2000) M.apply_tail()
return
else


obj/CH_Distructo_Disk
icon = 'Distructo Disk2.dmi'


Problem description:Here's the whole code for the tech it works still except for that run time error that comes up when you use that tech the error is runtime error: Cannot read null.race
proc name: Kienzan Disk (/mob/learn/Changling/verb/Changling_Distructo_Disk)
source file: Changling Distructo Disk.dm,109

u should have everything now


In response to John mayers
I suggest you read the DM guide before trying to fix codes from a rip. As for your problem replace the if(M.race == "Saiyan") with if(M && M.race == "Saiyan"). This checks if M exists before it checks the race.
In response to John mayers
M was deleted by SmallKiDeatchCheck(), so when the code went to if(M.race == "Saiyan"), M did not exist. You need to check if M still exists before checking M's race.