ID:1648862
 
(See the best response by GhostAnime.)
Hey guys, trying to code a game and trying to figure out how to get a mob to start walking towards a player when he gets close. And activating a Verb when he gets 1 square away. Could you awesome guys show me a place where this is taught or show me the code? That would be great guys! I'm still new, but can't make a lot of sense from the DM guide and downloadable byond code :(

Look in the reference guide for the walk_to() proc and utilize the orange() proc to detect where the mob is.
Cool, how far down is it?
Big book ;)
In response to Flying1ace
Best response
CTRL + F
or F1 in Dream Maker and look it up
... but here's the link for now: http://www.byond.com/docs/ref/info.html#/proc/walk_to
Ahh I see thanks guys ;)
Hmm, Can't quite get it when experimenting with the walk towards proc, could you guys give me a coded example please?
Can you please show us what you did so far and what your intentions were (if the later was not obvious)
Code:
mob
Zombie
icon = 'Zombie1.dmi'
density = 1
proc
Walk_Towards()
walk_towards(obj/Zombie, mob, lag = 4, speed = 2)
It gave me several errors ;)
I was going to run the Proc in a New()
the speeds were testers to see how fast it went I was going to change them when it became apparent how fast it moves.
You need to actually refer to an existing object, not a path

In this case, obj/Zombie should be src (the source of who the proc was called on) and you would have to define the /mob you want to go after.

For example
Zombie
var/mob/Target // Current target
proc/AI()
while(1)
sleep(10) // Wait 1 sec
var/mob/M = ((src.Target || locate(/mob/Player)) in oview(6, src)) // I don't think this syntax will work but you get the idea. M = current target or locate one
if(!M) continue // reloop
walk_to(src, M, lag = 4, speed = 2)

I'm sure you can search for AI systems that have targeting & movement defined
ok...
helpful, thanks!
Do you know if there are any youtube videos on Target? Think I'm missing out on an easier way here...
What does the "DO" mean? Does it start it automatically?
I do not think anyone made any youtube videos with programming in BYOND (I can be wrong).

Oops, I accidentally left it incomplete. I was trying to do a do..while() statement but I revised it to be an infinite while loop.

You might want to check out http://www.byond.com/forum/?post=1447399#comment7868507 or search for "AI target" in the forum search
Thanks for all your help!
Albro did like four videos, he was planning to go to the whole DM guide but it seems that he never finished. Anyway, if you want to check out the four videos, look here: https://www.youtube.com/user/dbzfan12895/videos
k thanks
I havent figured out how to get it working yet :(
In your code example what is the Proc/ AI? How does this work?
Page: 1 2