obj
wand
icon='items.dmi'
icon_state="wand"
verb
Examine()
set src in usr.contents
usr<<"This appears to be a wand; [src.core] core, with [src.power] power"
Wand_Stand
icon='items.dmi'
icon_state="wands"
verb
buy_wand()
set src in oview(1)
var/obj/wand/W
usr.Choice=input("Wand","Wand core",usr.Choice) in list("Unicorn Hair","Dragon Heart-String","Hippogriff Feather","Phoenix Tail-Feather")
usr.Galleons-=7
W.core=usr.Choice
W.power=rand(5,15)
usr.contents+=W
usr<<"You just bought a wand."
Problem description:
runtime error: Cannot modify null.core.
proc name: buy wand (/obj/Wand_Stand/verb/buy_wand)
usr: VolksBlade (/mob/male)
src: Wand Stand (/obj/Wand_Stand)
call stack:
Wand Stand (/obj/Wand_Stand): buy wand()
while you guys are helping me with that ill make the coding invisible to the dream maker, and continue with other things i need to add into my game.
For your main problem at hand - W is never actually initialized or set to any value, therefore its null. It isn't actually holding an object reference; typecasting only lets the compiler know what is going to be in the var, but typecasting doesn't set or affect the var in any way. You need to set that var to an object, in your case you'd want a new freshly made object.