View unanswered posts | View active topics It is currently Thu Mar 28, 2024 3:39 pm



Reply to topic  [ 3 posts ] 
 Help with AI waypoints and their use. 
Author Message
User avatar

Joined: Sat Jun 30, 2007 4:39 am
Posts: 521
Reply with quote
Post 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.


Mon Sep 22, 2008 6:33 pm
Profile WWW
User avatar

Joined: Fri Apr 27, 2007 4:55 pm
Posts: 1178
Location: America!
Reply with quote
Post 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


Mon Sep 22, 2008 11:28 pm
Profile
User avatar

Joined: Sat Jun 30, 2007 4:39 am
Posts: 521
Reply with quote
Post 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.


Tue Sep 23, 2008 12:17 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.123s | 15 Queries | GZIP : Off ]