mob/verb/Buy_Egg()
set name = "Buy Monster Egg"
if(!src.monster)
if(!src.new_player)
spawn() alert("Thank you for playing Monsuta! As a new player your first egg is free!","Buy Monster Egg")
src.new_player = 1
src.monster = 1
var/mob/Egg/M = new(locate(3,2,1))
src.client.mob = M
//------------------------------------------------------------
mob/Egg
name = ""
icon = 'Egg.dmi'
icon_state = "egg"
New()
sleep(50)
spawn() src << 'Hatch.wav'
src.icon_state = "hatch"
sleep(40)
var/mob/Monster/Tamajakushi/M = new(src.loc)
src.client.mob = M
del(src)
Problem description:
This should look fairly straight forward, but the player uses a verb they have to "buy a monster egg", the monster egg is sent to their proper location and then the player is supposed to be transfered over to the egg.
Once a new egg is made, it's supposed to have a timer, in which it "hatches", creates the new mob, changes the player over to that and then deletes the old egg mob.
The sound I have for the hatching monsters does not play and when the new monster mob is generated and sent to the proper location, I get this error:
runtime error: Cannot modify null.mob.
proc name: New (/mob/Egg/New)
usr: (src)
src: (/mob/Egg)
src.loc: the turf (3,2,1) (/turf)
call stack:
(/mob/Egg): New(the turf (3,2,1) (/turf))
HartWing (/mob): Buy Monster Egg()
I am assuming the music isn't playing because the sound isn't being sent to the proper mob, which leads me to believe I am not changing the mobs correctly even though it compiles fine.
I had originally done this as a independant mob from the player, but decided since the player is only allowed one monster at a time, it'd be easier to just MAKE the player the mob instead.
I am hoping someone here will be able to help me out, I feel like I am probably missing something simple. I've done a quick google search, but the responses I have seen and tried haven't helped me.