|
| 10 Sep 2017 02:43 AM |
Hi! I'm using the pathfinding service for my NPC, however it generates paths too often, and too quickly when the target is moving. How would I tell the script to yield the code until the next point is reached? I've tried repeat wait() until npc.HumanoidRootPart.Position = v (v, being the vector3 position of the current target to walk too)
|
|
|
| Report Abuse |
|
|
| |
|
cabbler
|
  |
| Joined: 19 Jun 2015 |
| Total Posts: 735 |
|
|
| 10 Sep 2017 02:58 AM |
| Well you should be iterating through the path points array so it's done when that's done |
|
|
| Report Abuse |
|
|
22618709
|
  |
| Joined: 25 Dec 2011 |
| Total Posts: 19221 |
|
|
| 10 Sep 2017 03:26 AM |
http://wiki.roblox.com/index.php?title=API:Class/Humanoid/MoveToFinished
READ THIS IF YOU'RE LOOKING FOR A SCRIPTER: https://forum.roblox.com/Forum/ShowPost.aspx?PostID=222340785 |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2017 03:45 AM |
| repeat wait() until (script.Parent.Torso.Position - Target.Position).magnitude <= 4 |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2017 03:49 AM |
| lua basics answer is basic, 2281729 or whatever has best answer. |
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 10 Sep 2017 03:50 AM |
| Humanoid.MoveToFinished:Wait() |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2017 03:57 AM |
| @Coder I've known about that but it doesn't 100% work because it has to perfectly reach the location so I recommend that you just use a magnitude loop because its more reliable all though more demanding. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2017 04:03 AM |
Well I've used both, tbh, and in my case it doent always register on 4 magnitude. Sometimes you have to put to 7, and thta leads to inaccuracy.
My advice, use MoveToFinished,
But for the sake of if it gets derailed a bit, or something, put MoveTo in a loop to desired position. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2017 04:05 AM |
| ;o next time don't call me 'basic' just because im well basic hehe |
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
| |
|