Jump to content

Recommended Posts

Posted

Okay I don't really like asking for help, because I like to solve things on my own to understand it more, to my self I think this is a simple question but I cant seem to wrap my head around it. The question that I need help with is how do I make the AI chase after the player, I've been trying to figure this out by my self but I cant seem to under stand it, and how would I get the position x, y, and z, value of the player.

 

I tried using the entity as player.x ...etc.

I also tried self.Player:GetPositon()

 

Script.aipos = ""
Script.airot = ""
Script.player = "" --entity "Player"
Script.playerpos = "" -- vec3 "player cords"
function Script:Start()

end

function Script:UpdateWorld(x, y, z)
local playerpos = self.player:GetPosition(x, y, z)

ply = self.player:GetPosition()
plyv3 = ply:ToString()

self.entity:Point(self.player, 2, Time:GetSpeed() * 0.1)
self.entity:Move(ply.x, ply.y, ply.z)
end

function Script:UpdatePhysics()
end

~Morgan

Posted

If you are using the navmesh, then you will want to use Entity:GoToPoint() and Entity:SetInput() for navigation. Look at the inherent MonsterAI.lua script for a working solution.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...