Jump to content

Ai help with position


funnygamemaker
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...