ID:148660
 
I'm trying to make a damage system, but i need some help.
I get this error: "usr.strength:undefined var"
Here's the part of the code that's not working:

mob
student
icon = 'student.dmi'

var
M
health = 100
strength = 3
intel = 2
damage

verb/Chat(msg as text)
world << "[usr] says: [msg]"

verb/Bash()
set src in oview(1)
damage = (usr.strength * 2) - src.intel
view() << "[usr] bashes [src] for [damage] points!"

Stat()
stat("health",health)
stat("Strength",strength)
stat("Intelligence",intel)
statpanel("Inventory",contents)
Ok, here is your problem. Not all mob's have a strength var, only mob/student's have it. Try setting it too usr:strength.
Basically, using : instead of . tells the compiler that not all of its types have that variable.
-DogMan
In response to Dog Man
But will produce a runtime error if any type of mob that does not have that var uses that verb. It's safer to move the variable declaration to mob/ instead of mob/student.