verb //an action
attack(mob/M as mob in oview(1))
if (M.HP <= 0) //if M's HP are at or below 0...
usr << "[M] is already dead!"
else //otherwise...
usr << "You attack [M]!"
oview() << "[usr] attacks [M]!"
var/damage = rand(1,10)
world << "[damage] damage!"
M.HP -= damage
M.DeathCheck()
proc
DeathCheck() //checks to see if an attack is deadly
if (HP <= 0) //if the defender's HP is low enough...
world << "[src] was killed by [usr]!" //do the death messaging
M.EXP += rand (1,25)
var //This starts a variable list
HP = 100 //MAkes a verb called HP and sets it to 100
EXP = 0
MaxEXP = 1000
equip = 0
damage = 8
MP = 10
Level = 1 //scince this is somthing to get u started this will end the var list
wealth
Stat() //starts a stat panel
statpanel("Stats") //names the pannel stats
stat("HP:",HP) //stat makes the new stat then ("HP:",makes the "name" of it HP , sppersates and then you put the var HP
stat("MP:",MP)
stat("EXP:",EXP)
stat("Exp to next:",MaxEXP)
stat("Level:",Level)
statpanel("Inventory") //MAkes a new stat panel called inventory
stat(contents)
Problem description:
When i compile the line that reads:
M.EXP += rand (1,25)
is said to have an undefiened var, please can you tell me what im doing wrong? Thanks
You didn't define M, usr isn't safe there, and in no way did you pass the killer. And the killer should always be passed as an argument, mind you.