T
TyGamess
Guest
So! I have my villagers on wonder. Witch I am going to set as a job called "Wonder" or "Jobless" and when they are jobless they wonder around. But if you set them to a job, they will wonder around an area, and occationaly pick up items and bring them over to the targeted location for storage. But here is the hard part:
So i have a grid pathfind that bascily makes a new point every so offen to witch a villager will wonder and this is told by the "obj_target" but I would like to know what if i put them in a location like in a large square called "obj_farm" and then their "Wondering points" will only spawn in obj_farm. (or obj farm areas). But also say i have 2 farms. I dont want him moving from one farm to the other, just staying stationary at the one farm he was set at.
(This part is a side of it)
There will be a timer set for every 10 secedns where the villager will decide weither or not to contiue the work. So after 10 secends a coin will flip if 1 then they stay if 0 then they stop and start wondering again after making a grunting noise or shacking their head.
Basicly saying. How the heck do I set an roaming "area". my current grid code is this: (I have it set to a global because there is only 1 room)
this basicly says they cant collide with obj_noNoZone witch is basicly a wall. I wanna do the same thing with obj_farm. But they will stay inside it. It wont act as a wall when they dont have a job. Because if it did, then even if they decieded to stop working, they would be stuck inside the farm.
I have been working on this for hours and I keep getting errors or my game just decides to crash. I got it to work once but when i added another villager the game crashed. Please help
So i have a grid pathfind that bascily makes a new point every so offen to witch a villager will wonder and this is told by the "obj_target" but I would like to know what if i put them in a location like in a large square called "obj_farm" and then their "Wondering points" will only spawn in obj_farm. (or obj farm areas). But also say i have 2 farms. I dont want him moving from one farm to the other, just staying stationary at the one farm he was set at.
(This part is a side of it)
There will be a timer set for every 10 secedns where the villager will decide weither or not to contiue the work. So after 10 secends a coin will flip if 1 then they stay if 0 then they stop and start wondering again after making a grunting noise or shacking their head.
Basicly saying. How the heck do I set an roaming "area". my current grid code is this: (I have it set to a global because there is only 1 room)
GML:
// Pathfinding Grid Setup
cell_width = 16
cell_height = 16
var hcell = room_width div cell_width
var vcell = room_height div cell_height
global.grid = mp_grid_create(0,0,hcell, vcell, cell_width, cell_height)
//Add Walls
mp_grid_add_instances(global.grid,obj_noNoZone,false)
I have been working on this for hours and I keep getting errors or my game just decides to crash. I got it to work once but when i added another villager the game crashed. Please help