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 » Scripting Helpers
Home Search
 

Re: Pathfinding not working?

Previous Thread :: Next Thread 
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
29 Jul 2014 03:54 PM
The AI will find a path, but instead of following it through the dumb bot decides to hug a wall. Why is it doing this?
Report Abuse
BlackTheHacker is not online. BlackTheHacker
Joined: 20 Jul 2014
Total Posts: 125
29 Jul 2014 03:54 PM
Because you fail at lua

Idiot.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
29 Jul 2014 03:56 PM
....annnnnd I'm reporting. Pray that I don't find your real account.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Jul 2014 03:58 PM
...aaaaand learn to script
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
29 Jul 2014 04:06 PM
what is this? Are you two ganging up on me? Wow. That is rude and ignorant of you. Considering you shouldn't be posting on this section of the forum due to your lack of knowledge on LUA; please don't respond to my post. There is a reason I'm posting this and it has to do with a problem being faced by others. That response serves no solution and posting it was indeed an attempt to disrespect me.
Report Abuse
L0cky2013 is not online. L0cky2013
Joined: 30 Jul 2012
Total Posts: 1446
29 Jul 2014 04:08 PM
Before learning the language learn to spell it correctly. It is not an acronym
Report Abuse
Krypticon is not online. Krypticon
Joined: 12 Feb 2014
Total Posts: 680
29 Jul 2014 04:29 PM
Have you got the points for the path?
If not do it like so:

path=Game:GetService("PathfindingService")
local calculatePath=path:ComputeRawPathAsync(Game.Workspace.StartPoint.Position,Game.Workspace.EndPoint.Position,range)
local points=calculatePath:GetPointCoordinates() -- Use this to calculate a table of the points.

Then you would have the humanoid travel to each of the separate points through a generic for, like so:

for _,v in pairs(points) do
Game.Player.Humanoid:MoveTo(v)
wait(0)
end

Hope this helps :)
Report Abuse
BlackTheHacker is not online. BlackTheHacker
Joined: 20 Jul 2014
Total Posts: 125
29 Jul 2014 05:09 PM
Lol dude, you are the one posting for help. "Pray I don't find your real account".

This is my real account...? And see guys, he reports. Maybe I should report him for false reporting me. What are you going to report it as? Scam? Spam? Mean behavior xD
Report Abuse
TreeLineUser is not online. TreeLineUser
Joined: 17 Mar 2013
Total Posts: 1659
29 Jul 2014 05:11 PM
Why is everyone so hostile he was asking a question? But next time post the script and explain what the problem is and then people can better find the problem and fix it.
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
29 Jul 2014 05:18 PM
function setPATH()

for _,v in pairs(Workspace:GetChildren()) do
if v.Name=="FAKE" then v:remove() end
end
local target=findNearestTorso(script.Parent.Torso.Position)
if target~=nil then
local path=p:ComputeRawPathAsync(script.Parent.Torso.Position,target.Position,200)
if path.Status==Enum.PathStatus.Success then
local points=path:GetPointCoordinates()
for i=1,#points do
CheckOcclusionAsync(points[i])
cast=Instance.new("Part",Workspace)
cast.Size=Vector3.new(1,1,1)
cast.Shape="Ball"
cast.CanCollide=false
cast.Anchored=true
cast.Name="FAKE"
cast.Position=points[i]
script.Parent.Humanoid:MoveTo(points[i])
if points[i].Y>=script.Parent.Humanoid.Torso.Position.Y+1 then
script.Parent.Humanoid.Jump=true
end
distance=(points[i]*Vector3.new(1,0,1)-script.Parent.Torso.Position*Vector3.new(1,0,1)).magnitude
wait()
end
else
--script.Parent.Humanoid:MoveTo(script.Parent.Torso.CFrame*Vector3.new(0,0,5))
end
end
end


--I did do calculatepath and all that other stuff. However, the AI will still huge the wall. If you'd like to see this then PM me and I'll show it to you.
Report Abuse
Krypticon is not online. Krypticon
Joined: 12 Feb 2014
Total Posts: 680
30 Jul 2014 08:50 AM
Hang on a second... is FindNearestTorso() really a function? :D
Report Abuse
Krypticon is not online. Krypticon
Joined: 12 Feb 2014
Total Posts: 680
30 Jul 2014 08:53 AM
I've just realised, I've made something that is basically what you're trying to do :P
I'll give you the link:

http://www.roblox.com/Pathfinding-Example-item?id=169000652
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
30 Jul 2014 10:30 AM
I'll test your example and see if it hugs the walls or not; thanks. findnearesttorso is a function that I chose not to include it because it is irrelevant to the problem.
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
30 Jul 2014 10:38 AM
What is the purpose of this line?
CheckOcclusionAsync(points[i])
Also, you never seem to use that distance variable.

~Jode
Report Abuse
dragonkeeper467 is not online. dragonkeeper467
Joined: 24 Jan 2011
Total Posts: 472
30 Jul 2014 10:41 AM
dude just use the tutorial on the wiki
Report Abuse
ash877 is not online. ash877
Joined: 18 Feb 2008
Total Posts: 5142
30 Jul 2014 12:14 PM
I've revamped it using repeat loop and a break point after a certain amount of attempts to get to the point has passed. The break point will just recalculate the path. Also, if the path is obstructed the dummy will jump. If you guys want to look at it it's in my inventory. The hugging wall glitch has been fixed thank you for helping me :D.
Report Abuse
Krypticon is not online. Krypticon
Joined: 12 Feb 2014
Total Posts: 680
30 Jul 2014 05:25 PM
Np :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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