mob
var
health = 20
verb
Attack(mob/M as mob in oview(1))
set category = "Commands"
if (usr.dir == NORTH)
if (M.loc = locate(usr.x,usr.y+1,usr.z))
var/damage = rand(1,10)
M.health -= damage
usr << "You hit [M] for [damage] damage!"
M:deathcheck()
proc
deathcheck()
if (src.health <= 0)
world << "[src] has been killed by [usr]!"
src.Move(locate(1,1,1))
above is the code, it has 1 error, it says
attack.dm:9:error: : missing expression,
and i dotn know what is wrong with it, please help.
![]() Jan 29 2012, 10:25 am
|
|
nevermind, found answer! :)
|
FYI Next time you should post things within DM tags.
Like so.. mob Also, please post the solution of what exactly was going wrong, for reference in the future if people search. |
Flame Sage wrote:
Also, please post the solution of what exactly was going wrong, for reference in the future if people search. if (M.loc = locate(usr.x,usr.y+1,usr.z)) was missing an = |
Why are you using the : operator? You're doing the things wrong. Also Flame Sage, you should put the tabs in the example, just saying.
mob Also you should use src instead of usr, it's the "same" but still. |
Why not? In most of the cases i only use usr in this:
obj/Test EDIT: I Don't know if this is where i used it as i'm not going to check, lazyness. |
Yuuki Kei wrote:
Not in verbs. You should only use usr in mouse procs (like Click), and verbs that have a src setting (set src in X) |
mob Here you go. It's a simple fix to your current code, and also works for all directions. It will also remove the error you'll get with using "oview" in a directional attack verb. Using oview like that will result in you getting a useless options list if you attack a certain square with more than one target in range. As such, it's better to ditch it entirely - In favour of a proc that locates the tile directly infront of you, before attacking any mobs in said tile. ~Xerif |