Well, the guard or patrol function does work without the target_object. And somehow I like the simple approach of the move_x and move_y coordinates, as it opens some other possibilities (and you wonīt create a new target_object for each unit moving).
I use this code now:
var col;
col=collision_circle(move_x,move_y,8,obj_solid_parent,1,1);
if col
{
move_x+=random(16)-random(32)
move_y+=random(16)-random(32)
}It works in 80% of the time, only sometimes units tend to get stuck. It still does not work good for large areas of solid blocks. but on the other hand, why should you send your units there and expect them to not run around trying to reach the point? players arenīt that stupid i think.
A bit annoying is implementing "shooting while running", as I will have to create another state and fix the code for that :/
What would be really interesting to see, is if someone implemented Multiplayer already?
Iīm still adding new mechanics (next big thing is AI), but nothing too complicated and I would love to be able to play it in Multiplayer and consider what and where I will have to add mplay specific commants, before I create all my actual units, etc.
As I had only a quick look at Multiplayer functions, I am still a bit overwhelmed by the idea, that I have to add lots of data sending commants from and to clients :/
Maybe someone who already worked on this can take away my fear and convince me that it is pretty easy to do?! or show me an example file for a multiplayer rts?
Do you mean when you tell them to go to a solid rock, they just walk in circles around it instead of stopping next to it? I didn't think that was a bug, I kind of liked it.. Or are you talking about when they occasionally walk extra fast in random directions ignoring the locations of enemy targets? Regarding your code fix... I wonder if you could make a temporary non-solid target object when you click.. replace move_x/move_y with target_object.x/target_object.y, and just move the target object outside of the solid when it's created, or during the step event if you also want to make the target_object follow other units, so you can make 'following' or 'guard' buttons.
I was having another problem with collisions, where the unit would get stuck in one location in an animated walking state next to solid objects, for the most part losing control of that unit, but if I were to click on the insertion point pixel of the unit, it would break free .... It's because I used some different mp potential settings to avoid having the units spin around all the time.. So I just added some code saying that if the unit was in the walking state while in the same location for more than a certain amount of time, it should change it's direction + or - 45 degrees depending on what its current direction is.. That solved the collision problem..
Does anybody know how to make a better fog of war for this engine? the current one seems to jump around during scrolling and seems a bit blocky..
Hey guys,
has anyone found a good solution for the movement bug, when move_x and move_y is inside a solid object, the units will never reach move_x/y and thus walk around stupidly without end.
It is pretty annoying, and there has to be a simple solution for this.
I love the advanced movement, when you have selected more than 1 unit, it looks awesome. but it makes the bug even more pronounced, as it is possible that the row and column operation assigns a move_x and move_y inside a solid object (especially in my case, where I use lots of cover).
I tried the following in the step event:
if able_to_move = true || gathering = true
{
if position_meeting(move_x,move_y,obj_solid_parent)
{
able_to_move = true;
move_x = move_x + random(16) - random(16);
move_y = move_y + random(16) - random(16);
}
}
in my eyes this piece of code should generate new move_x and move_y coordinates until it found one which is not inside a solid object (child of obj_parent_solid).
am I missing something???