YouGroove Posted January 18, 2015 Share Posted January 18, 2015 I made a custom AI script for soldier and i called Follow() in start , even put it in physic loop. Soldier has character physics with mass , it is enabled, it has player as target in script and navmesh is build for the level self.entity:Follow(self.target.entity,self.speed,self.maxaccel) Any idea ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
YouGroove Posted January 18, 2015 Author Share Posted January 18, 2015 Ok i should read the Command reference some times Returns true if a path can be plotted to the target entity, otherwise false is returned. But "follow" name command is misleading for me, a name like canReach() ro reachable() would make more sense. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
beo6 Posted January 19, 2015 Share Posted January 19, 2015 No. Follow does indeed lets a character follow another entity. So the name is correct. That it returns if a route could be calculated or not is just an addition so you can check if following is even possible. So that it does not work must have another reason. My first guess is that self.target.entity is not really your entity. When you have Script.target=nil--entity "Target" in your script self.target is already your entity. So the correct call would be self.entity:Follow(self.target,self.speed,self.maxaccel) If that does not help you can post your code and maybe we can find your problem? Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 19, 2015 Author Share Posted January 19, 2015 I made it work with GotoPoint and it worked, then chaging code with Follow worked after that. if(dist < self.maxDist and dist > self.minDist and self.mode ~="chase") then self.mode="chase" self:updateState("chase") self.entity:Follow(self.target,self.speed,self.maxaccel) end I just find Follow command very unstable even playing with acceleration values, the character some times turns suddenly very fast, or it is some moment like some freezz, also sometimes it continues on trajectory too much and follow the player too late.But it's perhaps better optimized ? Quote Stop toying and make games Link to comment Share on other sites More sharing options...
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.