L
Linkdeous
Guest
Hello guys, i'm making a game wherethe player would choose a certian zone with the mouse , then the villager would go cut the wood, mine the stone ,...
or making them check for every single instance out there or stuff would be pretty ressource intensive/having a huge mess of a code, so i thinked about adding the instance the "order" object touches to a parent instance, that would tell the npc to go to the nearest one, and cut it, mine it, etc etc
So for exemple i would need to use this like this :
after adding a tree / a rock to the order parent named obj_selected, does using this kind of code work ? :
npc step event :
work = instance_nearest(x,y,obj_selected)
move_toward_points(work.x,work.y,speed)
does this would make the npc go to the "controller" location, or would go to a tree, a rock, ... ?
And else, does there is some kind of way to do it with a dslist or some magical complexw stuff ? thanks for reading
or making them check for every single instance out there or stuff would be pretty ressource intensive/having a huge mess of a code, so i thinked about adding the instance the "order" object touches to a parent instance, that would tell the npc to go to the nearest one, and cut it, mine it, etc etc
So for exemple i would need to use this like this :
after adding a tree / a rock to the order parent named obj_selected, does using this kind of code work ? :
npc step event :
work = instance_nearest(x,y,obj_selected)
move_toward_points(work.x,work.y,speed)
does this would make the npc go to the "controller" location, or would go to a tree, a rock, ... ?
And else, does there is some kind of way to do it with a dslist or some magical complexw stuff ? thanks for reading