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:
or
Code:
actor.AIMode = Actor.AIMODE_GOTO
tells the actor to start following waypoints.
Use
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