Pawn attack movement navigation

Topics regarding Scripting with Reality Factory
Post Reply
Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Pawn attack movement navigation

Post by Veleran » Wed Sep 10, 2008 9:21 am

Can someone tell with a few words,which commands should i use in genericmonster script,and in which orders,
to make the pawn use the nearest scriptpoints when it is running towards the player.

If the player is standing one store above the pawn,
the pawn runs to attack the player but cant reach him,so it is stuck running at the base of the wall.

I want it to check that point3 is the nearest to the player.
then go to point1,check again in which scriptpoint is nearest to the player,
move to point2,(since this is still the nearest) ,check again next nearest scriptpoints to the player,
and then from point2 it will be able to direct move towards the player.


So during start of run-or something, i want the script to check which is the nearest point to the player,
which is point3,and then find which are the two previous points from point3,
which are point2 and point1,so it can go first to point1.

This idea has a problem:if the player is downstairs,and is near and below point3,the pawn might go to point3 and stick to the upper floor.


If there is a better and easy way to navigate the pawns,tell me.
Attachments
PawnScriptpoints-1.jpg
PawnScriptpoints-1.jpg (9.85 KiB) Viewed 450 times
Last edited by Veleran on Wed Sep 10, 2008 11:46 am, edited 4 times in total.

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Pawn attack movement navigation

Post by Allanon » Wed Sep 10, 2008 10:06 am

Maybe just check if the coordinates of the player is above the enemy, if it is then have it go to point 1.

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn attack movement navigation

Post by Veleran » Wed Sep 10, 2008 12:12 pm

I dont know scripting,yet i saw that there are some low level commands
float GetEntityX(string EntityName);
float GetEntityY(string EntityName);
float GetEntityZ(string EntityName);


If it could check
1.The player coordinates.
2.that point3 is the nearest to the player ncoordinates.
3.Check if point3 is at +30/-30 units of the Y coordinates of the player.
3.That point1 and point2 are the previous point from point3.
4.Go to the nearest point of the path (point1).
5.move to the next points nearest to the player.



If it wont check the Y coordinate,the pawn would propably do what it does unitll now:
it might go straight under the door in the pic,which is under point3.

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Pawn attack movement navigation

Post by Juutis » Wed Sep 10, 2008 12:27 pm

RF doesn't have proper pathfinding. Jay was working on it at one point but it was never released, dunno what happened to it. However, it could be possible with scripting, I already have an idea. Or a possible idea. But it would probably be too complicated and heavy to be used in complex levels.
Pain is only psychological.

Veleran
Posts: 891
Joined: Mon Aug 22, 2005 10:22 am
Location: Greece

Re: Pawn attack movement navigation

Post by Veleran » Wed Sep 10, 2008 3:54 pm

I want something simple and nice,i d say -just two -three scriptpoints for each stairs or ramp,so the pawns can move up and down stairs.
Maybe there are nt any commands that can be used to find which point is nearest to the player,which point is nearest to the pawn in Y distance,how to compare the distance of player to points and then how to check the distance from pawn to points..etc.

I changed the field of fiew so the pawn wont see very high up orvery low down,so it will loose the target if it is one store above and go patroling.
When a pawn is chasing the player it may loose a previous scriptpoint,so i tried to add a low level order for finding a new path after lost target order,but it does nt work.

Newpath[ ()
(
bool NearestPoint(20, 600);
return 0;
HighLevel(Patrol);

User avatar
Juutis
Posts: 1511
Joined: Thu Jan 12, 2006 12:46 pm
Location: Finland

Re: Pawn attack movement navigation

Post by Juutis » Wed Sep 10, 2008 4:25 pm

Veleran wrote:bool NearestPoint(20, 600);
Remove the 'bool' from the beginning. In the manual it's there because the command returns a boolean value (true or false). If it finds a scriptpoint it returns true and if not false. So the command is simply:
NearestPoint(20,600);
Pain is only psychological.

Post Reply