Hello everyone!
I'm not sure if this belongs in the beginner or advanced forums, but I can't figure out a way to implement it (if it's even possible). Basically, what I want to do is have one function that can set a path for a character to replace AGS's path finding system. Because I work with top down games mostly, the path finding looks a little janky and I want to avoid having to type [ character.Walk(x,y,ect) ] 10+ times. So I thought of this idea where I could have a function that I could add as many coordinates in it as I want!(Or maybe just a limit of 5-10).
So for example:
player.WalkPath(eBlock, eWalkableAreas, point x, point y, point x, point y, point x, point y);
//The player would walk to each point in a sequence until there are no more coordinates
//or even
player.WalkPath(eBlock, eWalkableAreas, pos1, pos2, pos3, pos4, pos5);
I'm not sure if this is achievable in this state, but even so, I thought throwing the idea out there may be interesting.
Thanks for any help or input in advance!
It looks totally achievable, use Point* for position, I think you can use WalkPath(this Character*, BlockingStyle block, WalkWhere walk_where, Point* pos1, Point* pos2 = 0) and then consume the pos checking if the passed value is null, and if not, trigger a walk.
Thanks for your reply @ eri0o! :-D
I'll give this a try. I also found in the manual a function called AddWaypoint (Formerly known as MoveCharacterPath). Which is exactly what I'm after but I would like to simplify it as you suggested into a one line function.
Currently it would look like this:
Example:
cSomeguy.Walk(160, 100);
cSomeguy.AddWaypoint(50, 150);
cSomeguy.AddWaypoint(50, 50);
So I think your solution may be better, unless I could find a way to store way points in a function?
Sorry, what do you mean store points in a function?
My example was the thing that would be in header and the idea was to have more pos parameters but I got lazy and wrote only 2.
I think you will need waypoint to be easier to have two or more points when using eNoBlock.
Sorry about that, I should have worded it better. By store points I meant storing a position (x and y) in the room in a single int not a function. I'm trying out your method first as I see it as a cleaner/ faster way to do this. :)
You can create a method that is static or a simple function that returns a point
Point* P(int x, int y){
Point* p = new Point;
p.X = x;
p.Y = y;
return p;
}
And then just use it on your calls like
cNPC.WalkPath(eBlock, eWalkableAreas, P(40,50), P(100,120));