I shouldnt be having a problem here but i have the variable
mob
var
hp=500
But when i put
for(var/mob/M in oview())
M.hp -= 100
i get that M.hp is undefined.. Can you explain why?
this is part of a code to a bomb omb by the way. so i need it to hurt every mob in oview but anyhow i got to go for today bye. also is there a guide that will teach me about flick? cuz if there is i need to know about it because i dont know how to use it... unless you'd rather explain it gone
ID:161641
![]() Apr 14 2008, 4:45 pm
|
|
Uhhhh so in the () beside oview.... err do what?? If I do as you say i just get errors. But if i do it my way then i don't lose hp. Confused.
obj |
First, fix the layers!
Second, this is a simple indentation error. If you don't know how to use loops properly, look them up in the reference. Here's the example... usr << "Mobs:" What's difference between that example, YMI's example, and your own code? Third, the following isn't a good way to do it. src.loc = locate(x,y-1,z) Look up walk_to() and walk_towards() |
For the last part, I'm guessing he would be subtracting 1 from y each time, making him move. Or something.
|
Yeah, realized that afterwards. But it's a really terrible way of doing it when A) he doesn't use move(), so they could go right through a wall or something, and B) DM already has procs to do that.
|
You get an undefined error because M is only defined inside that loop. Also, if this is for a bobomb you'll want to use a reference to him as the center in oview, the default is usr (which I don't have a clue what it would be at this point).