M.hp -= src.attack - M.defense
M.DeathCheck()
ok if I use periods to connect M to anything, it says....
monsters.dm:40:error:M.hp:bad var
monsters.dm:40:error:M.defense:bad var
ID:180122
Aug 21 2001, 5:36 pm
|
|
In response to FIREking
|
|
FIREking wrote:
JonSnow13 wrote:ya I did that awhile ago, it's still saying it... |
In response to JonSnow13
|
|
JonSnow13 wrote:
FIREking wrote: |
In response to JonSnow13
|
|
alright, you have to remember something about dm, the indentation of your stuff determines where in the tree of objects you define something. It is possible that the variables you are referring to were not placed high enough in the heirarchy. In other words, you need to be sure you declare such variables under the basic mob, not as a more specific form of mob, such as pc or any other mob object you define. The vars you want to use must be indented only once from the basic mob type, unless you make your proc refer to the more specific mob type
I hope this helps |
monsters.dm:40:error:M.defense:bad var There's a pretty decent discussion of "bad var" in the FAQ. |
In response to JonSnow13
|
|
mob
var hp attack defense verb attack(mob/M as mob in oview(1)) M.hp -= src.attack - M.defense M.DeathCheck() proc DeathCheck() if(src.hp <= 0) del(src) that is the only way to use the "." operator for variables, you have to declare that M is a mob, and also you have to say that mob has all of the defualt mob's variables, such as i have shown you above if you still have troubles, your overlooking something else that doesnt relate to the above code |
JonSnow13 wrote:
M.hp -= src.attack - M.defense try instead of M.DeathCheck(), replace the . with a : so its M:DeathCheck() may or may not help, i dunno.. ~Rcet |
In response to Cybergen
|
|
Cybergen wrote:
alright, you have to remember something about dm, the indentation of your stuff determines where in the tree of objects you define something. It is possible that the variables you are referring to were not placed high enough in the heirarchy. In other words, you need to be sure you declare such variables under the basic mob, not as a more specific form of mob, such as pc or any other mob object you define. The vars you want to use must be indented only once from the basic mob type, unless you make your proc refer to the more specific mob type ya you're right after looking over it a few times I realized you nailed it, thanks man :P |
in the proc, please indicate that M is a mob by doing this
attack(mob/M as mob in whatever)
that says that M is a child of the parent mob, and it will obtain all of its variables, meaning it will have defense, and attack.