generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: pathfinding problems (2nd time im asking this)

Previous Thread :: Next Thread 
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
21 Jan 2017 05:40 PM
local enemy = getnearestenemy()
if enemy then
local compute = pathfinding:ComputeSmoothPathAsync(script.Parent.Parent.Torso.Position,enemy.Torso.Position,512)
local point = compute:GetPointCoordinates()
print(#point)
if #point > 2 then
script.Parent:MoveTo(point[3])
elseif #point > 1 then
script.Parent:MoveTo(point[2])
end
end


I was wondering why my npc isnt moving to me even though im at a fair distance, so i added prints to see why; turns out the length of the table returned from getpointcoordinates is 1. The variable "enemy" is just the closest enemy, and pathfinding is well.. pathfinding.


This siggy is copyrighted ©
Report Abuse
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
21 Jan 2017 06:33 PM
does seriously no one know to to fix this wtf

ive been asking this since yesterday


This siggy is copyrighted ©
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
21 Jan 2017 06:44 PM
"if #point > 2 then script.Parent:MoveTo(point[3]) elseif #point > 1 then script.Parent:MoveTo(point[2]) end" Whats with this? Use a for loop to move. Also make sure the ############# ## the humanoid for _, each in ipairs(point) do script.Parent:MoveTo(point) end Also make sure that you check the humanoid has reached the next point before calling MoveTo again.
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
21 Jan 2017 06:46 PM
"if #point > 2 then
script.Parent:MoveTo(point[3])
elseif #point > 1 then
script.Parent:MoveTo(point[2])
end"

Whats with this?

Use a for loop to move. Also make sure the Parent is the humanoid


for _, each in ipairs(point) do
script.Parent:MoveTo(point)
end

Also make sure that you check the humanoid has reached the next point before calling MoveTo again.
Report Abuse
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
21 Jan 2017 09:38 PM
the problem is that the status is closest no path and i have no idea how to solve that

i'll worry about the moving part later when the status is actually successful


This siggy is copyrighted ©
Report Abuse
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
21 Jan 2017 09:56 PM
just noticed the problem. seems like the floor has to be at LEAST 8 studs thick even if you set the emptycutoff to 0. So stupid.


This siggy is copyrighted ©
Report Abuse
killerbot29003 is not online. killerbot29003
Joined: 04 Oct 2014
Total Posts: 3054
21 Jan 2017 10:05 PM
i set the emptycutoff to 0 and the thickness of the floor to 20, but still closestnopath....
did roblox break pathfinding or something


This siggy is copyrighted ©
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image