• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Multiple specific objects with 'mp_potential_step_object' function

S

sully9088

Guest
I am using the function mp_potential_step_object to have my AI avoid running into walls and other objects in the room. I have an obj_npc_wall object, and obj_furniture_parent as the two main parents that govern the physical objects in the room. I need to use these two objects because my AI is constantly watching the player and may do different things if only furniture is blocking the "view" vs a wall blocking the view. My problem is that this function only allows you to use: a single object, an instance id, or 'all' for it to work. I only need this function to detect two objects. I do not want to make one object the parent of the other because that will mess up my need for two separate objects.
(note: I cannot use 'all' because the AI that is chasing my player is actually a "ghost" object. I have a dummy npc following the "ghost". The reason for this is because my game uses physics, and if an object is using physics in gamemaker; then you cannot use motion planning. if I use 'all' then my "ghost" will circle around the dummy npc)

So... is it possible to only tie two objects to this function? Or should I somehow come up with a third object that acts as the physical barrier, and use obj_npc_wall/obj_furniture_parent as the "eyes"??
 
D

Dennis Ross Tudor Jr

Guest
Having a dummy parent in this situation that all blocking objects can parent to or their parents can parent to would be best.
obj_npc
obj_ghost
obj_chair
obj_table
obj_tree
obj_rock
obj_furniture -> parent to obj_chair and obj_table
obj_nature -> parent to obj_rock and obj_tree
obj_blocker -> parent to obj_furniture, and obj_nature
then just check for obj_blocker, it will check for trees and rocks and tables and chairs

If you don't want to run a dummy object then my advice would be to use an mp_grid() and then use all the blocking objects you want and have the runners use the mp_grid functions to find a path, and then put them on a path.
 
Top