ID:1294662
 
(See the best response by Jittai.)
Code:
obj/HUD
BloodOut
layer=9001
icon='Bloodout.dmi'
screen_loc="SOUTHWEST to NORTHEAST"
New(mob/m)
m.client.screen += src
return


Problem description:
Thats the code and this is the runtime error i get: proc name: New (/obj/HUD/BloodOut/New)
source file: BloodOut.dm,7
runtime error: Cannot read null.client


Need major help, b/c its kinda like a continously loop, i added return to it, and it still does it, so with or without, it makes no difference.

if(m.client) m.client.screen += src


would stop the error from coming through, though that doesn't exactly solve why the error is appearing.

Can I see where BloodOut's new() function is being called?
mob
proc
Choas_Blast_Shoot()
var/obj/H = new/obj/Choas_Blast
var/ki_damage = round(usr.powerlevel * 1.98)
var/ki_cost = round(src.ki_max * 0.49)

if(src.ki >= ki_cost)
if(!src.doing)
src.ki_lock = 1
spawn(10) src.ki_lock = 0
src.doing = 1
src.ki -= ki_cost
src.overlays += ht_charge
view(6) << "<font color = white>[src]:</font> CHOAS"
sleep(12)
view(6) << "<font color = white>[src]:</font> BLAST!!!!!!!!"
src.overlays -= ht_charge
usr.icon_state = "attack"
sleep(3)
usr.icon_state = ""
spawn(5) src.doing = 0
spawn(5) src.frozen = 0
if(!H)return
H.dir = src.dir
H.loc = src.loc
if(!H||!src)
if(src)del(src)
return
else

while(H)
step(H,H.dir)
if(!H)break
var/turf/T = H.loc
if(T.density)
del(H)
break
for(var/mob/M as mob in T)
var/absorb_max = round(M.powerlevel_max)
var/ki_absorbed = round(M.ki_shield_strength - ki_damage)

if(M == src)
continue
if(!M.dead && !M.safe && M.pk)
if(M.ki_shield)
if(ki_absorbed >= 1)
src << "<font color = #00C3ED>[M]'s Ki Shield Absorbs the attacks damage!"
M << "<font color = #00C3ED>Your Ki Shield Absorbs [src]'s Attack!"
Explode(new /Effect/BasicBoom(M.loc,1,3))
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.BigKiDeathCheck(src)
src.doing = 0
src.frozen = 0
return
else
M << "\red [src]'s Choas Blast slams into you!"
src <<"\red Your Choas Blast slams into [M]!"
new/obj/HUD/BloodOut(M)
Explode(new /Effect/BasicBoom(M.loc,1,3))
M.powerlevel -= round(ki_absorbed)
M.ki_shield_strength -= round(ki_damage)
M.BigKiDeathCheck(src)
src.doing = 0
src.frozen = 0
return
else
if(M.absorbing)
if(absorb_max > ki_damage)
M << "\red [src]'s attacks hits you, but you Absorb the energy!"
src <<"\red Your Choas Blast is Absorbed by [M]!"
Explode(new /Effect/BasicBoom(M.loc,1,3))
M.ki += ki_damage
src.doing = 0
src.frozen = 0
return
else
Explode(new /Effect/BasicBoom(M.loc,1,3))
M.powerlevel -= round(ki_damage)
M << "\red You try to absorb [src]'s Choas Blast, but it is too strong!"
src <<"\red Your Choas Blast slams into [M]!"
new/obj/HUD/BloodOut(M)
M.BigKiDeathCheck(src)
src.doing = 0
src.frozen = 0
return

M << "\red [src.name]'s Choas Blast slams into you"
new/obj/HUD/BloodOut(M)
Explode(new /Effect/BasicBoom(M.loc,1,3))
M.powerlevel -= ki_damage
M.BigKiDeathCheck(src)
del(H)
sleep(1)

obj/Choas_Blast
icon = 'ChoasBlast.dmi'

New()
..()
Bump(atom/a)
if(isturf(a) && a.density)
del(src)
..()


obj/Choas_Blast
icon = 'ChoasBlast.dmi'
basically when player gets hit when a blast, im trying to make it so screen flashing red over whole screen.
In response to FKI
^^ Forgot to click reply.
I don't see any outright issues. It just seems like M is logging out (or something that would otherwise cause M to be null). The line I posted in my previous post will take care of that. Here it is again:

if(m.client) m.client.screen += src


Note: You don't need the return there.
In response to FKI
Thanks, ill try, ill be back if i still get it. Thanks again.
In response to FKI
Well, it didn't work, got the same runtime error.
To Confirm, you changed this code:

obj/HUD
BloodOut
layer=9001
icon='Bloodout.dmi'
screen_loc="SOUTHWEST to NORTHEAST"
New(mob/m)
if(m.client) m.client.screen += src


Are you shooting non-players with this code? It would make sense as they would never have a client.
In response to Pirion
Well, since the tech can be shot at both, non-players and players. But as soon as I start the game, I get that same runtime error non-stop and eventually crashes game.
You should probably put down New(Location,mob/m) unless you intend for this obj to actually be inside of the mob. Also if(m&&m.client).
Where else are you creating that at Nourn? Sounds like you are creating it without an argument for mob/m, in which case, as Jittai noted, changing the check to m && m.client would stop the error.
In response to Pirion
It stopped the error, but the person's screen doesnt flash the red (the icon doesnt appear over screen). Also realzied even before it wasn't working. Why??
In response to Pirion
^^
In response to Pirion
mob/var/safe = 0
mob/var/attacking

mob/PC
verb
Attack(mob/M in get_step(usr,usr.dir))
set category = "Combat"
if(!M)return
var/attack_power = usr.strength + round( ((usr.unarmed / usr.unarmed_max) * usr.strength)/2 )
var/defence_power = M.defence + round( ((usr.unarmed / usr.unarmed_max) * M.defence)/2 )
var/damage = attack_power - defence_power
var/combat_exp_bonus = usr.level
var/armor_damage = (500 + usr.level/3)

if(combat_exp_bonus <= 0)
combat_exp_bonus = 0

if(damage <= 0)
damage = 0

if(src.dead)
src << "You are dead..."
return

if(M.safe)
return

if(M.dead)
src << "[M] is dead..."
return

if(usr.wrapped)
if(prob(40))
usr << "<font color=fuchsia>Your arm gets stuck in the goo!"
return

var/attack_text = rand(1,4)
var/text = ""

if(attack_text)
text = "\red [usr] Punches you in the Face"
if(attack_text == 2)
text = "\red [usr] Kicks you in the Chest"
if(attack_text == 3)
text = "\red [usr] Punches you in the Stomach"
if(attack_text == 4)
text = "\red [usr] Double Kicks you in the Face"

if(!M)
return

if(usr.doing || usr.KO)
return


if(M.KO)
usr << "They are already Knocked Out. Finish them!"
return

if(usr.cooldown)
return

if(usr.attack_lock)
return

if(M.type == /mob/PC)

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

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

if(usr.safe)
usr << "You are currently Safe and cannot Attack!"
return

if(src.dead)
src << "You are dead..."
return

if(M.dead)
src << "[M] is dead..."
return

if(!M.pk)
usr << "They are not a Combatant!"
return

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

if(M.dead && M.race != "Majin")
usr << "You cannot attack [M] because they are Dead!"
return
for(var/mob/Monster/Cell_Jr/C in world)
if(C.owner == usr)
C.attacking = M
walk_towards(C,M)

for(var/mob/Monster/Split_form/A in world)
if(A.maker == usr)
A.attacking = M
walk_towards(A,M)

if(prob(M.dodge/3))
flick("attack",usr)
flick("IT",M)
M.y = usr:y-3
M << "\green You manage to Dodge [usr]'s attack"
usr << "\green [M] manages to Dodge your attack"
usr.cooldown = 1
spawn(usr.speed * 2) usr.cooldown = 0
return
else
if(prob(M.block/2))
flick("attack",usr)
M << "\green You manage to Block some of [usr]'s attack"
usr << "\green [M] manages to Block some of your attack"
M.powerlevel -= damage / 4
M.KO()
usr.exp += combat_exp_bonus
spawn() usr.Level_Up()
usr.cooldown = 1
spawn(usr.speed * 2) usr.cooldown = 0
return
else
if(prob(M.counter/5))
flick("attack",M)
M << "\green You manage to Counter [usr]'s attack"
usr << "\green [M] manages to Counter your attack and attacks back"

usr.powerlevel -= round(M.strength + ((M.unarmed / M.unarmed_max) * M.strength) + M.powerlevel_max / 100)
usr << sound('punch_med.wav')
new/obj/HUD/BloodOut(usr)
M << sound('punch_med.wav')
spawn() usr.KO()
M.exp += combat_exp_bonus
M.unarmed_exp += rand(5,20)
spawn() M.UA_Level_Up()
spawn() M.Level_Up()
usr.cooldown = 1
spawn(usr.speed * 2) usr.cooldown = 0
return
Also when the user hits with melee. Doesnt even work there.
I think this would be the reason:

screen_loc="SOUTHWEST to NORTHEAST"


If you set to the following, does it work?
screen_loc="1,1"


In response to Pirion
Nope, it didn't work.
Best response
Firstly, this object does not need to be created multiple times as far as I can tell.

Shouldn't create one only and set it as a var to be used by all clients? Also do these objects ever leave the screen?
Fixed it, thanks for the help though guys!