mob/guard
icon='stuff.dmi'
icon_state="guard1"
density=1
hp = 1000
evil = 0
NPC = 1
New()
LookAround()
proc/LookAround()
if(istype(/mob/Player/M in view(10))
for(var/mob/Player/M in view(10))
if(M.evil = 1)
ai_walk_to()
Attack(M)
else
..()
There is an error somewhere in there. It says missing comma or right parent. BUT when I take what it tells me has the error out the coding on the line gets the error.for(var/mob/Player/M in view(10)) is the line that supposably has an error.
ID:261942
Feb 13 2004, 2:10 am
|
|
Dragon warrior2662 wrote:
proc/LookAround() There is an error somewhere in there. It says missing comma or right parent. Right parenthesis. The terminology makes a difference. BUT when I take what it tells me has the error out the coding on the line gets the error.for(var/mob/Player/M in view(10)) is the line that supposably has an error. This kind of error, a missing parenthesis, usually occurs on the previous line, not on the line where it's reported. If you think about why, this makes perfect sense. The compiler is going along minding its business, looking for that last parenthesis or whatever to finish what it's working on, and it runs into something completely unexpected. "Hey wait a minute! Where's that last parenthesis?!" It doesn't help that you have an indentation error in there too, but here's the real problem line: if(istype(/mob/Player/M in view(10)) if(locate(/mob/Player) in view(10, src)) But the above line you don't even need. I'd leave it out completely anyway. The for() loop will do the same thing; if there isn't a mob to be found it will just skip past the loop. Within that for() loop, your if() check on the evil var is also wrong, on two levels. You're using the = operator instead of ==, which will generate a compiler error. You're also testing against 1 instead of just using it as a true/false var as you no doubt intended. Just do if(M.evil) instead. And unless ai_walk_to() is just supposed to guess at a target, you probably need to tell it where to walk. Then, you need to actually change your LookAround() to a loop, and make it spawn() out of New() or else you'll get some weird results. If you don't make it a loop, the guard will take one look around and then do nothing ever again. If you don't spawn() it out of New(), New() will never complete normally. And "supposably" isn't a word. The word is "supposedly". Lummox JR |
I haven't done stuff with New() in a little while, so you may need a spawn. Hopefully someone will correct me if Im wrong, and sorry if I am.