if(M.hp > 0) // If the monster isn't dead
M.npc_atk = 1
else
var/Mloc = M.loc
var/Mtype = M.type
M.npc_atk = 0
del(M)
spawn(40) new Mtype (Mloc)
src.exp += M.exp_given
src << "You gain experience!"
levelup(src)
Problem description:
My code compiles fine, yet when I kill a monster in the game, the experience isn't added, and it gives me a null var error. The var is properly defined in the monster, so I don't know what the problem is. Can anyone help me?