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

Previous Thread :: Next Thread 
Keltrin is not online. Keltrin
Joined: 01 Jan 2014
Total Posts: 2085
17 Jul 2015 04:32 PM
local st = enemyTorso.Position
local path = pathFind:ComputeRawPathAsync(st, playerTorso.Position, 80)
if path.Status == Enum.PathStatus.FailStartNotEmpty or path.Status == Enum.PathStatus.FailFinishNotEmpty then
print("failure")
return
end
local points = path:GetPointCoordinates()
for _, point in pairs(points) do
hm:MoveTo(point)
end

Why does doing this make then enemy move in the same fashion that it would if I just told the enemy to move to the player's position without the pathfinding?
Report Abuse
Keltrin is not online. Keltrin
Joined: 01 Jan 2014
Total Posts: 2085
17 Jul 2015 04:33 PM
BTW this is just a chunk of the code that tells the script to pathfind its wau to the playerTorso, I didnt want to post the full script because it's 30+ lines and wouldn't look as inviting
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
17 Jul 2015 04:34 PM
for _, point in pairs(points) do
hm:MoveTo(point)
end


Wait until enemy reaches the point, then go to the next ect
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
17 Jul 2015 04:41 PM
for i, v in pairs(coords) do
hm:MoveTo(v)
hm.MoveToFinished:wait()
end
Report Abuse
Keltrin is not online. Keltrin
Joined: 01 Jan 2014
Total Posts: 2085
17 Jul 2015 05:18 PM
thank you @instawin
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