|
| 27 Jul 2012 11:05 AM |
I am trying to make a A* (A Star) pathfinder. I am currently trying to make it so that the pathfinder can detect if there are walls, and avoid them. Would this be the correct way to do it?
FindPartsInRegion3WithIgnoreList( Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) ), ClosedList, int maxParts = 100)
And just have a lot of those set up so that they cover the whole map? |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 11:47 AM |
| Any help? I cant figure this put, and there no explanation on the wiki. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 11:53 AM |
int maxParts = 100)
shoulld be:
maxParts = 100)
Maybe? |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 11:54 AM |
Well here is the wiki page that i got it off of. I did it like they did, but like I said there are no examples on the wiki page.
http://wiki.roblox.com/index.php/FindPartsInRegion3WithIgnoreList_(Method) |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 27 Jul 2012 11:55 AM |
| The "int" is just telling you the type of number that should be given to the function. It'll make more sense when you move onto another language like Java or C++. For now, just remove the int when you call the function. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 12:01 PM |
Well, I now have this code.
FindPartsInRegion3WithIgnoreList(Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) ), ClosedList, maxParts = 100 )
But i get this error.
Line 89: ')' expected near '='
The script above is all line 89. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 27 Jul 2012 12:04 PM |
| Oh yeah, remove the "maxParts = " too, just keep the 100. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 12:08 PM |
Ok, Thanks.
So this is now the code.
FindPartsInRegion3WithIgnoreList(Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) ), ClosedList, 100 )
But when I run it I get this error.
Workspace.A*:89: attempt to call global 'FindPartsInRegion3WithIgnoreList' (a nil value) |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 27 Jul 2012 12:09 PM |
| workspace:FindPartsIn... etc |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 12:11 PM |
OK. Changed it to this.
game.Workspace:FindPartsInRegion3WithIgnoreList(Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) ), ClosedList, 100 )
But got this error.
Unable to cast value to Object |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 27 Jul 2012 12:13 PM |
Lol wut? Does ClosedList exist? |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 12:19 PM |
| Yes, its a table, which has a few objects in it. These objects are added into it right before this is ran. |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
| |
|
|
| 27 Jul 2012 12:35 PM |
OK, i got it to work.
But how do i access what parts are in the area? |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 27 Jul 2012 12:37 PM |
| That method returns a table with all the parts it found. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 12:38 PM |
OK, so this is my script, so how do i use that tables info?
game.Workspace:FindPartsInRegion3WithIgnoreList(Region3.new( Vector3.new(1, 1, 1), Vector3.new(9, 9, 9) ), Walls, 100 ) |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 27 Jul 2012 12:40 PM |
| local foundPartsTable = workspace:FindPartsIn... |
|
|
| Report Abuse |
|
|