obj/jobs/stove
icon = 'obj.dmi'
icon_state = "trash2"
density = 1
verb
Cook()
set src in view(1)
if(usr.job != "Cook")
usr << "I can't cook."
return
var/foodinusr = list()
for(var/obj/Items/Food/O in usr)
foodinusr += O
var/f = input("What do you want to cook?","Cooking") in foodinusr + list("Cancel")
if(f == "Cancel")
return
if(f:name == "Fish")
switch(input(usr,"Make What?") in list ("Sushi (lvl 1)","Cancel"))//Change
if("Cancel")
return
if("Sushi (lvl 1)")//change
var/reqjoblvl = 1//Change Required job Lvl
var/result = "Sushi"//Change Result Name
if(usr.joblvl < reqjoblvl)
usr << "Need Higher Job Lvl"
return
usr << "Making [result]..."
if(usr.InventoryUp == 1)
usr:Inventory()
usr.lockinventory = 1
usr.move = 0
sleep(100 - usr.joblvl)
del(f)
var/resultnew = "/obj/Items/Foodresults/[result]"
new resultnew(usr)
var/jobup = rand(1,10)
if(jobup == 5)
usr.joblvl ++
usr << "Job Level Increased! It is now [usr.joblvl]."
usr << "Made [result]"
usr.lockinventory = 0
usr.move = 1
if(f:name == "Egg")
switch(input(usr,"Make What?") in list ("Fried Eggs (lvl 2)","Cancel"))//Change
if("Cancel")
return
if("Fried Eggs (lvl 2)")//change
var/reqjoblvl = 2//Change Required job Lvl
var/result = "Fried_Eggs"//Change Result Name
if(usr.joblvl < reqjoblvl)
usr << "Need Higher Job Lvl"
return
usr << "Making [result]..."
if(usr.InventoryUp == 1)
usr:Inventory()
usr.lockinventory = 1
usr.move = 0
sleep(100 - usr.joblvl)
del(f)
var/resultnew = "/obj/Items/Foodresults/[result]"
new resultnew(usr)
var/jobup = rand(1,10)
if(jobup == 5)
usr.joblvl ++
usr << "Job Level Increased! It is now [usr.joblvl]."
usr << "Made [result]"
usr.lockinventory = 0
usr.move = 1
Problem description:
Only Making Sushi gives a runtime error but it works. Fried Eggs is fine and I made it by copy pasting the same code.
runtime error: Cannot read null.name
proc name: Cook (/obj/jobs/stove/verb/Cook)
usr: Justin (/mob)
src: the stove (/obj/jobs/stove)
call stack:
the stove (/obj/jobs/stove): Cook()
If anyone understands the problem please let me know.
but try this to fix it maybe
thatll 1 - make it so you dont have to use :, which are a bad idea, always use .
and 2. possibly its not selecting from the list right, duno
and also! a sugestion, both of those codes do pretty much the exact same thing, make a proc that runs all the lines that are the same so you dont have to have them twice
never code anything twice that can simply be done once through a proc <.<
also if you turn on debug mode itll report the file and line number of the error