• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code NPC's with jobs


I'll explain this the best I can.

I have "humans" to spawn around a main hall and walk around.

If a "lumberjack" building is in existence, they will turn into a new object called the lumberjack. Then walk to the building and stay around it.

My issue is that when I place multiple buildings, they all walk toward the same one. I have tested and found that the buildings are separately becoming occupied, but they still walk toward the first one.

How can I make them walk to the one that they occupied?

(The code that turns them into the lumberjack)
if obj_human_guild.active_lumberjacks < instance_number(obj_build_lumberjack) {
obj_build_lumberjack.vacant = false;
instance_change(obj_lumberjack, true);
(The code that tells whether the build is occupied)
vacant = true;
lumberid = instance_number(obj_build_lumberjack);

let me know if you need something extra