sgccode9
|
  |
| Joined: 15 Dec 2007 |
| Total Posts: 1048 |
|
|
| 28 Oct 2012 12:20 AM |
I'm having a problem with a part of a script that I pulled that makes an NPC "roam" around the area its in. NOT a specific spot in the workspace but just the general area around itself.
So here's the PORTION of the script:
---------------------------------------- if time>nextrandom then nextrandom=time+3+(math.random()*5) local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40) Humanoid:MoveTo(randompos,game.Workspace.Terrain) end end -------------------------------------------
So the problem: The NPC walks in only TWO directions... basically back and forth in those two directions only. Like walking on a 180 degree line.
For some reason, it refuses to walk in all four directions around its space.
Its strange really, so that's what I need help with.. making it walk in all possible directions around itself rather than just two.
Any help would be appreciated, thanks! :D |
|
|
| Report Abuse |
|
|
|
| 28 Oct 2012 12:34 AM |
'cause that's what u told it to do.
Try local randompos=Torso.Position+(Vector3.new(math.random(20) - 10, math.random(20) - 10, math.random(20) - 10)
or Take NPC Wait Animation, u can set random Points as well.
|
|
|
| Report Abuse |
|
|
sgccode9
|
  |
| Joined: 15 Dec 2007 |
| Total Posts: 1048 |
|
|
| 28 Oct 2012 12:56 AM |
Tried it, they just stood still D:.
I tried removing the line I put up and inserted this instead:
Humanoid:MoveTo(Vector3.new(math.random(-500,500),0,math.random(-500,500)), game.Workspace.Base)
But they wall just wander slowly and surely to the center of the baseplate. Which I don't want to happen.. I just want them to wander in the area I PUT them. Could removing the game.workspace.Base part of the line work? |
|
|
| Report Abuse |
|
|
sgccode9
|
  |
| Joined: 15 Dec 2007 |
| Total Posts: 1048 |
|
|
| 28 Oct 2012 01:12 PM |
HA! Got it working! Just needed to add a parenthesis ._.
Thanks. |
|
|
| Report Abuse |
|
|