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: Where to learn pathfinding

Previous Thread :: Next Thread 
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 02:26 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 02:55 PM
Pathfinding consists of "points".

Here is a piece.

local service = game:GetService("PathfindingService")
local path = service:ComputeRawPathAsync(startPosition, endPosition, float maxDistance)

points = path:GetPointCoordinates()

for _, point in pairs(points) do
humanoid:MoveTo(point)
repeat
distance = (point -player.Character.Torso.Position).magnitude
wait()
until distance < 3
end
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 02:57 PM
Small revision:

ocal service = game:GetService("PathfindingService")
local path = service:ComputeRawPathAsync(startPosition, endPosition, float maxDistance)

points = path:GetPointCoordinates()

for _, point in pairs(points) do
humanoid:MoveTo(point)
repeat
distance = (point - torso.Position).magnitude
wait()
until distance < 3
end
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 03:10 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 03:13 PM
Ah, in that case. You might want to rename that npc's humanoid. And use an infinite loop to check the magnitude of each player's torso. And if it is in range, the npc will use any means to get to you.

That would be the logic.
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 04:48 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 04:50 PM
I am on a linux/ubuntu OS right now. I am not really in the shape to script.
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 04:52 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 04:57 PM
I gave you an overview of pathfinding, and a bundle of code that does just that. Do you need anything else?
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 05:02 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 05:04 PM
Well, NPC's are pretty time consuming to make, especially making it walk, since you have all the joints. I just take a basic one out of free models and do whatever the flipping heck I want with it.
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 05:05 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 05:11 PM
Try getting some information out of this.

http://wiki.roblox.com/index.php?title=Animations#Playing_Animation_in_Non-Player_Character

Tells you all the components you need, including the HumanoidRootPart
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 05:13 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 05:22 PM
Did I just give you the bit of code that computes a path from point A to point B? -.-
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 05:25 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 05:31 PM
"while wait() do" loop.

Utilize magnitude.
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 05:33 PM
magnitude = (partA.Position - partB.Position).magnitude

radius = 200 -- distance

while wait() do

if magnitude < radius then
end

end

This will fire when a part comes in range.
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 05:47 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 05:50 PM
What exactly do you mean by codes? Connect the pathfinding bit of code I gave you to the magnitude bit. I think you could figure it out.
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 05:54 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 05:57 PM
It does just that.


and simple, alter the meaning of the variable used to define the target point your NPC is supposed to walk to. :)
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 05:57 PM
[ Content Deleted ]
Report Abuse
HellsteinInnovation is not online. HellsteinInnovation
Joined: 22 Dec 2014
Total Posts: 127
26 Feb 2015 06:01 PM
THat sir, is the purpose of that while loop. xD
Report Abuse
WAATERMELON is not online. WAATERMELON
Joined: 03 Jul 2014
Total Posts: 921
26 Feb 2015 06:14 PM
[ Content Deleted ]
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