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 
alexdogg11 is not online. alexdogg11
Joined: 27 May 2010
Total Posts: 147
01 Aug 2014 01:30 PM
OK im trying to make a zombie follow a person and I've got the path down its the zombie following the player part that im stuck on. how do I make the zombie follow the path to the player(or in this case the part)???

while true do
path = game:GetService("PathfindingService"):ComputeRawPathAsync(script.Parent.Torso.Position, game.Workspace.End.Position, 500)
points = path:GetPointCoordinates()

game.Workspace.Points:ClearAllChildren()

for p = 1, #points do
script.Parent.Humanoid:MoveTo(points[p])
end

for p = 1, #points do
local part = Instance.new("Part")
part.Size = Vector3.new(1, 1, 1)
part.Position = points[p]
part.Anchored = true
part.Parent = game.Workspace.Points
end

wait(0.1)
end

I know the MoveTo function is screwing me up but I don't know how else to move the zombie
Report Abuse
alexdogg11 is not online. alexdogg11
Joined: 27 May 2010
Total Posts: 147
01 Aug 2014 02:30 PM
bump
Report Abuse
DarkMystrik is not online. DarkMystrik
Joined: 17 Jul 2011
Total Posts: 72
01 Aug 2014 02:58 PM
If you put this in a localscript it wont work. Roblox disabled it for some reason -.-
Report Abuse
alexdogg11 is not online. alexdogg11
Joined: 27 May 2010
Total Posts: 147
01 Aug 2014 08:48 PM
its in a regular script, I just need the zombie to follow the path
Report Abuse
dreaddraco2 is not online. dreaddraco2
Joined: 01 Dec 2007
Total Posts: 6275
01 Aug 2014 10:03 PM
I think you're looking for the scripting helpers forum.
Report Abuse
alexdogg11 is not online. alexdogg11
Joined: 27 May 2010
Total Posts: 147
03 Aug 2014 12:31 PM
oh yeah, I didn't realize I wasn't in scripting helpers
Report Abuse
Firewarrior321 is not online. Firewarrior321
Joined: 09 Dec 2011
Total Posts: 3443
03 Aug 2014 11:16 PM
Hum....
Here, copy and paste this into the command bar at the bottom in Studio:

repeat print("Fixing") until PathfindingFunctionAsync ~= nil

It may crash Studio, but if you keep trying it, it works.

>I will rip out your duodenum
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
04 Aug 2014 11:06 AM
FireWalker,

U r an idiot.

OP, u too.

for p = 1, #points do

wait(1)

script.Parent.Humanoid:MoveTo(points[p])
end

But u will still not get satisfactory results. Don't code if u can code. Go to the Catalog, find something that works, and mod it...

PathFind, finds a Path (even takes slopes, and catwalks; but raw it is not suitable for a Humanoid, plus, u would never be plotting a path to Player, as he would be gone, by the time u got there.

But as an exersize:

Here is a Mod of warspykings findpath in a Humanoid (*Note: it 'skips' points two different ways (Sorry, I did not figure-out that that was what PointM was for)):



Bot.FindPath = function(finish, PointM, MaxPoint, MaxDist)
local MaxPoint = MaxPoint or 1
local PointM = PointM or 1
local MaxDist = MaxDist or 500
local Am = 1
local path = pathfinding:ComputeRawPathAsync(Tor.Position, finish, MaxDist)
print (path)

local points = path:GetPointCoordinates()

local OldPoint = Tor.Position -- experimental: Aim betond next point & get-out of sticky wickets
local Impeded = nil
local LastDist = -1 -- Initialize old Distance
local skip = false
local ListEnd = #points

for i, point in pairs(points) do
print(i)
if Am == PointM then

Hum:MoveTo(point) -- + point - OldPoint)
if not skip or i == ListEnd then-- hack for diagonal - Reduces resolution/accuracy by half though...

OldPoint = point
skip = true

repeat
wait(.09) -- better place for wait; before measuring distance: Old way had old informatin for "Until" check.
TorP = Tor.Position
distance = (Vector3.new(point.x, TorP.y, point.z) - TorP).magnitude -- are-we-there-yet

Impeded = math.abs(distance - LastDist)
LastDist = distance

until distance < 3 or Impeded < .001 -- Impeded: a way-out of logic for Bot,who is at an impass.

else
skip = false
end -- Diagonal?

if Impeded < .001 then -- *note - change in 'Impeded' accuarcy.
Hum.Jump = true -- Jump to get-up high stairs (risers).

end -- Impeded?

end -- Am

if Am == MaxPoint then
Am = 1
else
Am = Am + 1
end

end -- for

end -- func



But just a demo. You will still need an AI script to interpret the raw data, and to have other AI-plans, haNDY, because FindPath, does not always return a path.

The above should also read the built-in error-returns which come with Path, so it can make other plans.....


Demo warspyking's at my Place for a few hours, only. I'm moving-on...


GL,
BJ
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
04 Aug 2014 11:18 AM
Or,

For an already written AI, take Speed AI, from the Catalog. It look for Humanoid size holes while path-finding, so doesn't put paths under shoulder height walls...

Report Abuse
Firewarrior321 is not online. Firewarrior321
Joined: 09 Dec 2011
Total Posts: 3443
04 Aug 2014 12:00 PM
By that logic, you should not talk because you cannot spell.

I was simply making a joke.

>I will rip out your duodenum
Report Abuse
alexdogg11 is not online. alexdogg11
Joined: 27 May 2010
Total Posts: 147
04 Aug 2014 01:51 PM
BJ that was horrible, do us all a favor and don't comment on forums idiot. p.s. I do know how to script
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