ID:266514
 
ok is there a tut/dem/lib that tells a mob how to walk aaway from a usr?
There are two different built in procs:

step_away()
walk_away()
In response to English
how would i use these correctly?
In response to English
how would i use these correctly?
In response to Strange Kidd
Format:
walk_away(Ref,Trg,Max=5,Lag=0)
Args:
Ref: A mob or obj.
Trg: An object on the map.
Max: The maximum distance between Ref and Targ before movement halts.
Lag: Delay in world 1/10 seconds between movement.

These are straight from the F1 help (Same as Reference on the website). This will make the mob (Ref) move away from the Trg until it is Max distance away:
walk_away(src,M,5,1)
That will make the src walk away from M until it is 5 steps away and it will take one step every 1/10 of a second.

Format:
step_away(Ref,Trg,Max=5)
Returns:
1 on success; 0 otherwise.
Args:
Ref: A mob or obj.
Trg: An object on the map.
Max: The maximum distance between Ref and Targ before movement halts.

This works in much the same way except it only takes one step instead of many.
In response to English
is there a way i can make it not go to a target just run away?
In response to Strange Kidd
Strange Kidd wrote:
is there a way i can make it not go to a target just run away?

Wasn't that just explained to you?
In response to Super16
n he said to make it go from a ref to a target i want it not to go to a trg
In response to Strange Kidd
Noooo, when he said target he meant what its going to walk away from.
In response to Super16
then whats the Ref?
In response to Super16
then whats the Ref?
In response to Strange Kidd
The ref is you.
In response to Super16
so........

mob/Hi
for(var/mob/M in oview(1))
walk_away(usr,M,10,1)
In response to Strange Kidd
Strange Kidd wrote:
so........

mob/Hi
for(var/mob/M in oview(1)) <font color = yellow><--- might want to indent under this</font>
walk_away(usr,M,10,1) <font color = yellow> <--- Someone using your mob?</font>
In response to Strange Kidd
More like this.

mob/Hi/proc/walking()
for(var/mob/M in view())
walk_away(src,M,5,1)
mob/Hi/Move()
walking()
..()
In response to Super16
he wasntr moving :(
In response to Strange Kidd
Try this.

mob/Hi/proc/wlaking()
walk_away(src,usr,5,1)
mob/Hi/Move()
wlaking()
..()
In response to Super16
nope no works :(
In response to Strange Kidd
walk_away(src,M,5,1)
That will make the src walk away from M until it is 5 steps away and it will take one step every 1/10 of a second.

That is from my original post. It makes the first mob sent to it move away from the second mob sent to it. If you want the mobs to run away from the player then you need it like this:

for(var/mob/M in oview(1))
walk_away(M,src,10,1)

This will cause each mob (M) that is within one space of the src to walk away from the src.

This is what you had:
mob/Hi
for(var/mob/M in oview(1))
walk_away(usr,M,10,1)

That would cause the usr to walk away from M.
In response to Super16
That would cause the player to move away from himself (which isn't possible).