ID:2310682
 
Problem description: So I have no code examples for this it's more of a what would be the best way? For example I have mobs 1, 2 and 3 who are all of the same type but I want 1 to walk to point A, 2 to point B and 3 to point C.

I don't want to have to create multiple NPC's of the same type to walk in different lanes. So I'm wondering what would be the best way to do that?

You could not fill other doll players. But the most ideal would be a base game linking another game (the game itself) another (another .dmb and .rsc), in the end the player sees as a single game. Link games / instances

The instance hoster can be the dedicated, or the room owner, or one of the players of that match

shell proc
I don't want to have to create multiple NPC's of the same type to walk in different lanes. So I'm wondering what would be the best way to do that?

The best way is probably one of the easier ways. I'm going to assume you are doing tile movement. For pixel movement, this is gonna be a lot harder.

mob
var
move_delay = 2
enemy
New(loc,dir=0)
..()
glide_size = TILE_WIDTH / move_delay * world.tick_lag //set the glide size for proper smooth tile movement
if(dir)
src.dir = dir //allow creating with a modified direction
if(src.loc)
walk(src,src.dir,move_delay) //if we're in the world, start moving in the starting direction

proc
changeDir(ndir)
set waitfor = 0 //prevent this from causing a wait
walk(src,0) //stop walking
sleep(move_delay) //wait for glide to finish
walk(src,ndir,move_delay) //start walking in the new direction

obj/lane_node
invisibility = 101 //keep this object from showing when not in the map editor

Crossed(atom/o) //called when something overlaps this object
..()
var/mob/enemy/e = o
if(istype(e))
e.changeDir(dir)


Basically, the gist of this idea is that you place obj/lane_node markers down on the map. Set the lane_node direction to the direction you want the enemy laners to move in starting at that point. When they step on the lane_node, they will change direction, wait for their current glide to end, then start moving in the new direction.

Just manually place down direction markers everywhere the enemies need to change directions.

#VVV#############
#   ###>       V#
#   ### >     V #
#   ###  >   V  #
#  >   ^  ###   #
# >     ^ ###   #
#>       ^###   #
#############   #
Thanks Ter, sorry I took so long to reply. This helps a lot, I had something similar to this but I was using loops instead and it was causing a few problems. Although the nodes you made we're similar to mine except for some reason, when I used Crossed() I couldn't get it work. Possibly because I was using Crossed(atom/movable/m)? I'm not sure.

I tried to check out pathing libraries before I came here but they all just seemed over complicated for my needs.

A quick question as well, the line set waitfor = 0. I'm assuming since we're not defining this as a variable this is inbuilt in DS? I couldn't find anything in the reference really.
It's not in the reference anymore since it's technically 'obsolete'. It's in the Redbook though.
It's technically 'obsolete', as it was replaced with spawn, but I prefer it over spawn even though it's negligibly slower due to invocation overhead.

It gives you a better overview of how much time your code takes in the CPU profiler, because it better segments your code.

It's basically a proc setting that tells the engine to return to the calling proc when encountering a sleep while allowing the proc to pick up on its own later.