funnygamemaker Posted March 26, 2015 Posted March 26, 2015 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 Quote ~Morgan
macklebee Posted March 26, 2015 Posted March 26, 2015 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. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
funnygamemaker Posted March 26, 2015 Author Posted March 26, 2015 Thanks, and sorry for my mistake, I must of overlooked the files and didnt see the MonsterAI.lua Quote ~Morgan
macklebee Posted March 26, 2015 Posted March 26, 2015 My suggestion would be to look at the tutorial map 'Events and AI' map that also comes with a video tutorial. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
Rick Posted March 27, 2015 Posted March 27, 2015 There is also a Follow() command that will have your AI follow another character (player if you will). 1 Quote
Recommended Posts
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.