Data Realms Fan Forums
http://868000.nnhp.asia/

Help with AI waypoints and their use.
http://868000.nnhp.asia/viewtopic.php?f=73&t=12275
Page 1 of 1

Author:  Electroclan [ Mon Sep 22, 2008 6:33 pm ]
Post subject:  Help with AI waypoints and their use.

So, I've spawned a dropship using an area as a test, and now I want the dropship to follow some waypoints before dropping the cargo.

I've thought about just using math to push the dropship from point to point, but that would look very strange in-game. So, I want to know how to use these waypoint functions instead of trying some hacky and time-consuming way.

DrawWaypoints(); -- Not useful to me yet, looks like an AI debugging tool like in some of Data's pre-B18 screenies.

AddAIWaypoint(); -- I'm assuming it takes something like an X and a Y as parameters (arguments, whatever, not good with names and terms). I need to get the dropship to follow them, then dump the cargo at the last waypoint. Maybe it takes a third parameter with the actor's name or something, testing isn't going anywhere.

ClearAIWaypoints();
GetLastAIWaypoint();

UpdateMovePath();
SetMovePathToUpdate(): -- Not sure what these are, or if they're even relevant.

Author:  Lord Tim [ Mon Sep 22, 2008 11:28 pm ]
Post subject:  Re: Help with AI waypoints and their use.

From testing it right now, as far as I can tell, GoToAIMode is broken. The actor will only walk back and forth on a point just out of reach of the waypoints. If it were to work correctly, this is how you would use it:

actor = (Get the actor somehow) -- I used ActivityMan:GetActivity():GetControlledActor(0)

Code:
actor:DrawWaypoints(boolean)
-- put either true or false here. This displays those yellow dots with the dotted lines that show the AI's path. Turn it off if you don't want to tell people where you're going.

Code:
actor:AddAIWaypoint(vector)
-- example: actor:AddAIWaypoint(Vector(actor.Pos.x-50,actor.Pos.Y)) should make the actor walk 50 pixels left.

Code:
actor:ClearAIWaypoints()
-- is supposed to give the actor zero waypoints. BUT: If the actor is still in AIMODE_GOTO (3), the actor gets a waypoint added to it's current position, and walks back and forth there.

Code:
actor:GetLastAIWaypoint()
-- returns the vector of the last waypoint added. Should print out as: {100,100} but you can use the object itself to get the X and Y values. Example: print(actor:GetLastAIWaypoint().X) prints just the X value.

I'm pretty sure MovePaths don't have anything to do directly with messing with the waypoints.

Also of use:
actor.AIMode

Example:
Code:
actor.AIMode = 3

or
Code:
actor.AIMode = Actor.AIMODE_GOTO

tells the actor to start following waypoints.

Use
Code:
actor.AIMode = 1

to make him go back to sentry mode.

Quote:
Actor.
AIMODE_NONE 0
AIMODE_SENTRY 1
AIMODE_PATROL 2
AIMODE_GOTO 3
AIMODE_BRAINHUNT 4
AIMODE_GOLDDIG 5

Author:  Electroclan [ Tue Sep 23, 2008 12:17 pm ]
Post subject:  Re: Help with AI waypoints and their use.

Big thanks LordTim, but there's just one problem..

You tested this on normal AHuman and ACrab actors right? Well, it appears that dropships might not even have AIMODE_GOTO. They have stuff like STAY, SCUTTLE, RETURN, etc etc. I'm testing this right now to make sure I didn't screw up, but explorer.exe is acting up and I can't even open folders right now.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/