|
| 21 Mar 2014 11:14 PM |
function distance(cframe, target) xdist, ydist = math.abs(cframe.X-target.X), math.abs(cframe.Z-target.Z) if xdist > ydist then h = 14*ydist+10*(xdist-ydist) else h = 14*xdist+10*(ydist-xdist) end return h end
function shortest(cframe, model) current = model:GetModelCFrame() open, closed = {current}, {} options = {} found = false while wait() do if not found then for i, v in next, open do if v ~= cframe then cf = v + Vector3.new(1, 0, 0) cf2 = v - Vector3.new(1, 0, 0) cf3 = v + Vector3.new(0, 0, 1) cf4 = v - Vector3.new(0, 0, 1) shortest, check = 900, 0 lisp = { ["cf"] = distance(cf, cframe), ["cf2"] = distance(cf2, cframe), ["cf3"] = distance(cf3, cframe), ["cf4"] = distance(cf4, cframe)} for x,b in next, lisp do if shortest > b then shortest, check = b, x print(shortest) end end if check == "cf" then open[v] = cf elseif check == "cf2" then open[v] = cf2 elseif check == "cf3" then open[v] = cf3 elseif check == "cf4" then open[v] = cf4 end closed[i] = v open[i] = nil else found = true break end end else break end end end
shortest(CFrame.new(29.8, -351.83, -284.6), workspace.ai2)
Issue:
It gets stuck on: 6.8759727478027 for the distance.. It doesn't go farther |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:22 PM |
| You would probably receive more help on the scripters thread, this thread is often filled with inexpierenced programmers, or lazy programmers. Scripters usualy has more people willing to work on a larger, interesting projects. (Such as this) |
|
|
| Report Abuse |
|
|
|
| 21 Mar 2014 11:31 PM |
| Nevermind I retested it and it is fine. |
|
|
| Report Abuse |
|
|
Absurdism
|
  |
| Joined: 18 Jul 2013 |
| Total Posts: 2568 |
|
|
| 21 Mar 2014 11:37 PM |
| @LeadStormTest, no. Just, no. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 12:54 AM |
You would probably receive more help on the scripters thread, this thread is often filled with inexpierenced programmers, or lazy programmers. Scripters usualy has more people willing to work on a larger, interesting projects. (Such as this) -------------------------- Sure... If I wanted to get flamed out of that sub-forum then I would've brought this issue there. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 01:24 AM |
@LeadStormTest Nope. das for trullls bruh. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 12:48 PM |
Meh, i'm always lazy with my replies on this sub-forum, but on the scripters sub-thread, there are actually a few smart people(The percent is slowly decreasing, to more noobish topics sadly)
Alt. of Jetta765214 |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2014 01:02 PM |
It's not A* if it doesn't work. :p Good job it did. :) |
|
|
| Report Abuse |
|
|