ID:268802
 
mob/verb/Configure_House(obj/O as obj in oview(1))
switch(alert("Would you like to destroy this house or upgrade it?",,"Upgrade","Destroy"))
if("Upgrade")
src << "You upgrade the house."
upg += 1
UPG_CHECK()
O.icon_state = "TEC2"
if("Destroy")
del(O)
mob
var
upg

mob/proc/UPG_CHECK(obj/O as obj in oview(1))
if(upg == 2)
O.icon_state = "TEC3"
if(upg == 3)
O.icon_state = "TEC4"
if(upg == 4)
O.icon_state = "TEC5"
else
..()


I'm trying to make it so when it upgrades, it gets a different icon state, but I get this when I try upgrading twice and on.

runtime error: Cannot modify null.icon_state.
proc name: UPG CHECK (/mob/proc/UPG_CHECK)
usr: Merciless Warrior (/mob)
src: Merciless Warrior (/mob)
call stack:
Merciless Warrior (/mob): UPG CHECK(null)
Merciless Warrior (/mob): Configure House(House (/obj/House))


Please help if you can.
You are calling UPG_CHECK() without a required argument (obj/O).

I suggest you turn debugging on an review your error messages a bit more carefully; this one told you exactly what was wrong.
In response to Jmurph
I see your point. Thanks.
In response to Merciless Warrior
No problem. Good luck!