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 Question

Previous Thread :: Next Thread 
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
08 Nov 2016 10:00 PM
while true do
for i, v in pairs(game.Workspace:GetChildren()) do
if v.Name == "EvilMonster" then
EvilMonster = v
pathservice = game:GetService("PathfindingService"):ComputeRawPathAsync(EvilMonster.Torso.Position, game.Players.LocalPlayer.Character.Torso.Position, 50)
--above is a continued line just couldn't fit--
marks = pathservice:GetPointCoordinates()

EvilMonster.Humanoid.WalkSpeed = 17
game.Workspace.Points:ClearAllChildren()
for p = 1, #marks do
part = Instance.new("Part")
part.CanCollide = false
part.Size = Vector3.new(1, 1, 1)
part.Pos#############[#]###########################
# #####################Workspace.Points

end
EvilMonster.Humanoid:MoveTo(part.Position)
wait(0.1)
end
end
end



What I want the "monsters" to do is if a player is hiding behind a wall, not to just be moving toward the wall, but to go around the wall. So, in a way, following the points. The line I use to make the monsters move is:

EvilMonster.Humanoid:MoveTo(part.Position)


how would I make it so they don't just walk forward a wall and stay there, but go around the wall if a player is behind it?
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
08 Nov 2016 10:06 PM
hashtags are:


part.Position = marks[p]
part.Anchored = true
part.Parent = game.Workspace.Points
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
08 Nov 2016 10:10 PM
You need the MoveTo within the for loop.
The way you have it now, it adds all the parts, and only afterwards moves (meaning it will try to move directly to the endpoint).

Moving the MoveTo into the loop, you'll get it to move to the first, second, third, ... point so it moves around the wall.


If you're seeing this post, it means I'm either dead (leaving behind a very fabulous looking corpse) or my soul has been captured by pixies!
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
08 Nov 2016 10:15 PM
I had ### ## ###### the for loop, and it didn't work. If you wanna see the problem or whatever then join my game called "battle frog"
Report Abuse
L2000 is not online. L2000
Joined: 03 Apr 2008
Total Posts: 77448
08 Nov 2016 10:20 PM
Ooo you also have to wait until it reaches that point
EvilMonster.Humanoid.MoveToFinished:wait()

Add that right under the MoveTo, both within the loop


If you're seeing this post, it means I'm either dead (leaving behind a very fabulous looking corpse) or my soul has been captured by pixies!
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
08 Nov 2016 10:24 PM
I've added that, and now, he keeps on moving forward after he turns around the wall, not going toward the player.
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
08 Nov 2016 10:47 PM
Basically he goes on an infinite loop until the 200 max part count ends. He goes in a straight line

If I move anywhere, it doesn't affect his path.
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
08 Nov 2016 11:18 PM
b
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
08 Nov 2016 11:29 PM
local NUM = 4
if #marks > NUM then
for i=#points,NUM,-1 do
points[i]=nil
end
end

^ that just limits the number of parts
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
08 Nov 2016 11:31 PM
^ not what i needed

bump
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Nov 2016 02:49 PM
But did you try it?
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
09 Nov 2016 08:36 PM
Where would I add it in my script
Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Nov 2016 08:53 PM
Somewhere between where you defined 'marks' and before you use 'marks'
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
09 Nov 2016 09:00 PM
Okay, I did that, now this happens.

Every four "parts" it passes, they stop for a few seconds then move again.


script:

while true do
for i, v in pairs(game.Workspace:GetChildren()) do
if v.Name == "EvilMonster" then
EvilMonster = v
pathservice = game:GetService("PathfindingService"):ComputeRawPathAsync(EvilMonster.Torso.Position, game.Players.LocalPlayer.Character.Torso.Position, 299)

marks = pathservice:GetPointCoordinates()

EvilMonster.Humanoid.WalkSpeed = 17
game.Workspace.Points:ClearAllChildren()
local NUM = 4
if #marks > NUM then
for i=#marks,NUM,-1 do
marks[i]=nil
end
end
for p = 1, #marks do
part = Instance.new("Part")
part.CanCollide = false
part.Size = Vector3.new(1, 1, 1)
############# # ########################### # ##################### = ################################################################################ = ###################################################################################
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
09 Nov 2016 09:01 PM
hashes:


part.Position = marks[p]
part.Anchored = true
part.Parent = game.Workspace.Points
EvilMonster.Humanoid:MoveTo(part.Position)
thing = EvilMonster.Humanoid.MoveToFinished:wait()
end
wait(0.01)
end
end
end
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
09 Nov 2016 09:19 PM
b
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
09 Nov 2016 09:23 PM
b2
Report Abuse
Trestin4 is not online. Trestin4
Joined: 11 Oct 2012
Total Posts: 285
09 Nov 2016 09:23 PM
Puppy could you join one more time please?



Report Abuse
caca50 is not online. caca50
Joined: 10 Jul 2011
Total Posts: 2037
09 Nov 2016 09:26 PM
for p = 1, #marks do

Make that^ one this:

for p = 2, #marks do


Idk if that'll fix your problem
Report Abuse
thegoodpuppy is not online. thegoodpuppy
Joined: 07 Jul 2011
Total Posts: 2737
09 Nov 2016 09:43 PM
didn't fix it
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