ID:261981
 
//Put all enemies after this point
mob/clone/
proc/move()//Now, this proc handles NPC movement
for(var/mob/M in oview())//loops over all mobs in view
if(get_step_away(src,M,5))//checks distance
if(!M.client)//Not a player
continue//continues through the loop
else//Player
walk_to(src,M,1,3)//Move to the person
else//4-or-more spaces away
continue
spawn(20) move()//loops the proc after 2 seconds

proc/attackplayer()//Handles attacking
for(var/mob/M in oview(1))//Within one space this time
if(get_step_away(src,M,3))
if(!M.client)
continue
else
src.Attack(M)//Calls the attack proc
else
return..()
spawn(15) attackplayer()


How ever.. when the clone is created it does not move and attack can anyone help me( And please dont tell me to change my AI system.)
Vash_616 wrote:
> //Put all enemies after this point
> mob/clone/
> proc/move()//Now, this proc handles NPC movement
> for(var/mob/M in oview())//loops over all mobs in view
> if(get_step_away(src,M,5))//checks distance
> if(!M.client)//Not a player
> continue//continues through the loop
> else//Player
> walk_to(src,M,1,3)//Move to the person
> else//4-or-more spaces away
> continue
> spawn(20) move()//loops the proc after 2 seconds
>
> proc/attackplayer()//Handles attacking
> for(var/mob/M in oview(1))//Within one space this time
> if(get_step_away(src,M,3))
> if(!M.client)
> continue
> else
> src.Attack(M)//Calls the attack proc
> else
> return..()
> spawn(15) attackplayer()
>

How ever.. when the clone is created it does not move and attack can anyone help me( And please dont tell me to change my AI system.)

1. Do not put usr in procs. oview(), by default, has usr as one of its arguments.
2. Nice code, but where do you call it? If you don't tell BYOND to actually execute the code, it will just sit there wasting space in your .dmb.
In response to Jon88
Its used for an illusionary technique which creates a copy of yourself. i have the code for it but i rather not post the verb it will take up dantoms bandwith and we dont need that :)

anyways so i should just get rid of the usr(Replace it) and it should be fine?
In response to Vash_616
Yes.