Spam1985
Member
Hi all. I have my enemies navigating with
The variable "obs" being what they must avoid, of course. The problem is, I need "obs" to be many different things, depending on the situation.
First of all, any most annoyingly, they need to avoid other enemies, rather than just clip through each other. If I set them as a child of the wall object, say, then they collide with themselves and cannot move at all.
Secondly, what they perceive to be a wall must change based on their perceived "ground level" value. Walls higher than them are considered obstacles, and walls below them are not. What I've currently got works OK, but for only 2 different wall heights. (I tried more and then problems arose).
floor_z is the relative "ground level" of the enemy. wall32 is a wall with a height value of 32, and obj_wall is a child of wall32 with an infinite height value and thus, should be avoided in every case. Even though wall32 is slightly higher than the enemy's "floor_z" they are able to jump onto it and get a new floor_z.
So all in all what I really need is to be able to say something like:
obs = this and this and obj_enemy (but not yourself!)
Maybe I'm just ignorant and there is a simple way to do this. If not then the answer is probably some really smart use of parent objects, but right now I can't wrap my head around it.
Sorry for the long-winded post. Hopefully I explained the problem clearly enough and many thanks to anyone who reads and responds.
Code:
mp_potential_step_object(obj_player1.x, obj_player1.y, movespd, obs);
The variable "obs" being what they must avoid, of course. The problem is, I need "obs" to be many different things, depending on the situation.
First of all, any most annoyingly, they need to avoid other enemies, rather than just clip through each other. If I set them as a child of the wall object, say, then they collide with themselves and cannot move at all.
Secondly, what they perceive to be a wall must change based on their perceived "ground level" value. Walls higher than them are considered obstacles, and walls below them are not. What I've currently got works OK, but for only 2 different wall heights. (I tried more and then problems arose).
floor_z is the relative "ground level" of the enemy. wall32 is a wall with a height value of 32, and obj_wall is a child of wall32 with an infinite height value and thus, should be avoided in every case. Even though wall32 is slightly higher than the enemy's "floor_z" they are able to jump onto it and get a new floor_z.
Code:
if floor_z > 14 then { obs = obj_wall; } else { obs = obj_wall32; }
obs = this and this and obj_enemy (but not yourself!)
Maybe I'm just ignorant and there is a simple way to do this. If not then the answer is probably some really smart use of parent objects, but right now I can't wrap my head around it.
Sorry for the long-winded post. Hopefully I explained the problem clearly enough and many thanks to anyone who reads and responds.