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)
ID:148660
Nov 22 2002, 3:40 pm
|
|
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.
|
Basically, using : instead of . tells the compiler that not all of its types have that variable.
-DogMan