ID:173712
 
My enemies don't work. They attack anything and everything. Also the usally don't want to wander around the map. I need help!!!!
You could at least post your code LOL.
mob
Pc
Monster
name = "Floating Head"
icon = 'monsters.dmi'
icon_state = "monster"
hp = 15
max_hp = 15
str = 2
var/mob/P
New()
. = ..()
spawn()
Wander()
proc/Wander()
while(src)
step_rand(src)
sleep(5)
var/Actiontaken = FALSE
for(P in oview(5))
for(P in oview(5))
Actiontaken = TRUE
step_towards(usr,P)
sleep(5)
for(P in oview(1))
attack(usr)
Actiontaken = TRUE
for(P in oview(1))
if(Actiontaken == FALSE)
step_rand(src)
sleep(5)
break
sleep(5)
proc/attack(mob)
var/damage = rand(1,2)
usr.hp -= damage
usr << "The Floating Head attacks You!"
sleep(1)
usr << "You take [damage] damage!"
death_check()
if(src.hp == 0)
usr.exp += 3
usr << "You gain 3 exp for the defeat!"
usr.Level()
del(P)
else
..()
In response to Gamekid
proc/Wander()
while(src)
step_rand(src)
sleep(5)
var/Actiontaken = FALSE
for(P in oview(5))
for(P in oview(5))
Actiontaken = TRUE
step_towards(usr,P)
sleep(5)
for(P in oview(1))
attack(usr)
Actiontaken = TRUE
for(P in oview(1))
if(Actiontaken == FALSE)
step_rand(src)
sleep(5)
break
sleep(5)

There's your problem. Can you figure it out? The monster is aka P and you're telling it to attack P. Get on Dream Seaker and I'll try to help you out more.
In response to Gamekid
No put usr in proc. Ungh.

No conflate usr with player. Ungh.

Lummox JR
In response to DiZzyBonne
/*Thank you for your help but there seemes to be one more problem therer are 4 error messages

monsters.dm:22:error:actiontaken:undefined var
monsters.dm:27:error:actiontaken:undefined var
monsters.dm:29:error:actiontaken:undefined var
monsters.dm:17:actiontaken :warning: variable defined but not used

this is the script */
while(src)
var/actiontaken = FALSE
step_rand(src)
sleep(5)
for(P in oview(5))
for(P in oview(5))
actiontaken = TRUE
step_towards(usr,P)
sleep(5)
for(P in oview(1))
attack(usr)
/*error1*/ actiontaken = TRUE
for(P in oview(1))
/*e3*/ if(actiontaken == FALSE)
step_rand(src)
sleep(5)
break
sleep(5)

// as you can see from the error messages the "actiontaken"
// don't work
In response to Gamekid
if(P.client)

that should work. Put it in either in the for() loop or in the attack() proc.
In response to Gamekid
You need to read some of the other posts in this thread. Most of your problem stems from abuse of usr.

Lummox JR
First of all, never, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, EVER confuse "usr" with "player" or "client". They are VASTLY different. We're talking about something like the difference between a rock and a thermo-nuclear warhead with a poodle sitting on it kind of difference. Basically, there are TWO places where you want to use usr: in verbs, and in Click(), DblClick(), MouseEntered(), etc. (all the links that are provided when looking up Click() in the reference).

Second of all, procs such as oview(), view(), range(), hearers(), orange(), etc. all take TWO arguments: the range, and the center. If you only provide the range, then the center defaults to usr. Refer to the paragraph above for information about using usr.

(After typing "ever" so many times, I realize how silly of a word it is...)
In response to Garthor