ID:146324
 
I have this coding and when i play my game i get this error

source file: sagas.dm,223
runtime error: Cannot read null.client
proc name: New (/obj/saga1/New)


on line 223 i have

            usr.client.screen+=src


Here is the full coding

/////////////////////////////
///////**SAGA-TECH**
var
saga = "raditz"
nappadead
vegetadead
ginewleft = 5
kingkolddead
friezadead
jo
jo1
sixdead
sevendead
eightdead
buudead
babididead
daburadead

proc
sagarefresh()
if(saga == "disabled")
for(var/obj/saga1/S in world)
S.name = "Sagas disabled by host."
S.icon = 'raditzsagamobs.dmi'
S.icon_state = ""
if(saga == "raditz")
for(var/obj/saga1/S in world)
S.name = "Raditz Saga"
S.icon = 'raditzsagamobs.dmi'
S.icon_state = ""
if(saga == "vegeta")
for(var/obj/saga1/S in world)
S.name = "Vegeta-Nappa Saga"
S.icon = 'vegeta.dmi'
S.icon_state = ""
if(vegetadead == 1)
S.icon = "nappa.dmi"
for(var/obj/saga2/G in world)
G.name = "Vegeta-Nappa Saga"
G.icon = 'nappa.dmi'
G.icon_state = ""
if(vegetadead == 1)
G.icon = ""
if(nappadead == 1)
G.icon = ""
if(saga == "ginew")
for(var/obj/saga1/S in world)
S.name = "Ginew Force Saga"
S.icon = 'ginewlogo.dmi'
if(ginewleft == 5)
S.icon_state = ""
if(ginewleft == 4)
S.icon_state = "4"
if(ginewleft == 3)
S.icon_state = "3"
if(ginewleft == 2)
S.icon_state = "2"
if(ginewleft == 1)
S.icon_state = "1b"
for(var/obj/saga2/G in world)
G.name = "Ginew Force Saga"
G.icon = 'ginewlogo.dmi'
G.icon_state = "1"
if(saga == "frieza")
for(var/obj/saga1/S in world)
S.name = "Frieza Saga"
S.icon = 'lordfrieza.dmi'
S.icon_state = ""
for(var/obj/saga2/G in world)
G.name = "Saga"
G.icon = 'ginewlogo.dmi'
G.icon_state = ""
if(saga == "frieza1")
for(var/obj/saga1/S in world)
S.name = "Frieza Saga"
S.icon = 'changling.dmi'
S.icon_state = ""
for(var/obj/saga2/G in world)
G.name = "Saga"
G.icon = 'nothing.dmi'
G.icon_state = ""
if(saga == "frieza2")
for(var/obj/saga1/S in world)
S.name = "Frieza Saga"
S.icon = 'ChangeForm2.dmi'
S.icon_state = ""
for(var/obj/saga2/G in world)
G.name = "Saga"
G.icon = 'nothing.dmi'
G.icon_state = ""
if(saga == "frieza3")
for(var/obj/saga1/S in world)
S.name = "Frieza Saga"
S.icon = 'ChangeForm3.dmi'
S.icon_state = ""
for(var/obj/saga2/G in world)
G.name = "Saga"
G.icon = 'nothing.dmi'
G.icon_state = ""
if(saga == "frieza4")
for(var/obj/saga1/S in world)
S.name = "Frieza Saga"
S.icon = 'ChangeForm4.dmi'
S.icon_state = ""
for(var/obj/saga2/G in world)
G.name = "Saga"
G.icon = 'nothing.dmi'
G.icon_state = ""
if(saga == "frieza5")
for(var/obj/saga1/S in world)
S.name = "Frieza/Android Transitional Saga"
S.icon = 'friezabot.dmi'
S.icon_state = ""
if(friezadead == 1)
S.icon = 'nothing.dmi'
for(var/obj/saga2/G in world)
G.name = "Frieza/Android Transitional Saga"
G.icon = 'kingkold.dmi'
G.icon_state = ""
if(kingkolddead == 1)
G.icon = 'nothing.dmi'
if(saga == "android")
for(var/obj/saga1/S in world)
S.name = "Android Saga"
S.icon = 'gero.dmi'
S.icon_state = ""
for(var/obj/saga2/G in world)
G.name = "Android Saga"
G.icon = 'android19.dmi'
G.icon_state = ""
if(saga == "android2")
for(var/obj/saga1/S in world)
S.name = "Android Saga"
S.icon = '16.dmi'
S.icon_state = ""
if(sixdead == 1)
S.icon = 'nothing.dmi'
for(var/obj/saga2/G in world)
G.name = "Android Saga"
G.icon = '17.dmi'
G.icon_state = ""
if(sevendead == 1)
G.icon = 'nothing.dmi'
for(var/obj/saga3/J in world)
J.name = "Android Saga"
J.icon = '18.dmi'
J.icon_state = ""
if(eightdead == 1)
J.icon = 'nothing.dmi'
if(saga == "cell")
for(var/obj/saga1/S in world)
S.name = "Cell Saga"
S.icon = 'cell.dmi'
S.icon_state = ""
if(saga == "cell2")
for(var/obj/saga1/S in world)
S.name = "Cell Saga"
S.icon = 'icell.dmi'
S.icon_state = ""
if(saga == "cell3")
for(var/obj/saga1/S in world)
S.name = "Cell Saga"
S.icon = 'pcell.dmi'
S.icon_state = ""
if(saga == "buu")
for(var/obj/saga1/S in world)
S.name = "Buu Saga"
S.icon = 'majinbuu.dmi'
S.icon_state = ""
if(buudead == 1)
S.icon = 'nothing.dmi'
for(var/obj/saga2/G in world)
G.name = "Buu Saga"
G.icon = 'babidi.dmi'
G.icon_state = ""
if(babididead == 1)
G.icon = 'nothing.dmi'
for(var/obj/saga3/J in world)
J.name = "Buu Saga"
J.icon = 'dabura.dmi'
J.icon_state = ""
if(daburadead == 1)
J.icon = 'nothing.dmi'
if(saga == "buu2")
for(var/obj/saga1/S in world)
S.name = "Buu Saga"
S.icon = 'buu.dmi'
S.icon_state = ""
if(saga == "buu3")
for(var/obj/saga1/S in world)
S.name = "Buu Saga"
S.icon = 'buutenks.dmi'
S.icon_state = ""
if(saga == "buu4")
for(var/obj/saga1/S in world)
S.name = "Buu Saga"
S.icon = 'buucillo.dmi'
S.icon_state = ""
if(saga == "buu5")
for(var/obj/saga1/S in world)
S.name = "Buu Saga"
S.icon = 'buuhan.dmi'
S.icon_state = ""
if(saga == "buu6")
for(var/obj/saga1/S in world)
S.name = "Buu Saga"
S.icon = 'kidmajin.dmi'
S.icon_state = ""
if(saga == "end")
for(var/obj/saga1/S in world)
S.name = "All Sagas Completed"
S.icon = 'outcastlogo.dmi'
S.icon_state = ""
///////////**SAGAS' ICON**


obj
saga1
name = "Saga"
layer = 22
New()
src.screen_loc = "2,2"
usr.client.screen+=src

saga2
name = "Saga"
layer = 22
New()
src.screen_loc = "3,2"
usr.client.screen+=src
saga3
name = "Saga"
layer = 22
New()
src.screen_loc = "4,2"
usr.client.screen+=src

//////////**SAGA-END**

I just skimmed over this, noticing early on it was DBZ related and not intending to devote much time to it.

From a quick look, I would assume it is because the proc you were putting usr in was an obj/New() proc, if I am not mistaken. Since I believe that I am not, then the reference 'usr' is not available at that point, I.E. the game doesnt know who usr is.

I suppose an easy workaround for this would be one of the following:
Either A: When the object is added to the usr's contents, put the usr.client.screen+=src code below that.
Or B: Put
obj/wtfever/New(mob/M)
..()
M.client.screen+=src

And define M when you call new for the object.

If I give any information that is innaccurate or does not work, I apologize before hand and as I mentioned, I did not look this over much.