|
| 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 |
|
|
|
| 08 Nov 2016 10:06 PM |
hashtags are:
part.Position = marks[p] part.Anchored = true part.Parent = game.Workspace.Points |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|
| |
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
| |
|
|
| 09 Nov 2016 08:36 PM |
| Where would I add it in my script |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
| |
|
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
|
  |
| 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 |
|
|
| |
|