Page 1 of 1

Path:GetEstimatedPath() changed?

Posted: 07 Feb 2012, 01:20
by PepeAmpere
This is part of Spacebug queen move script, that was correct with Spring 83.0, but it is not not correct with 85.0.

Image

Again the same for quote :) :

Code: Select all

 
(...)
 local starty = Spring.GetGroundHeight(startx, startz)
  local yloc = Spring.GetGroundHeight(xloc, zloc)
  local thePath = Spring.RequestPath(QUEEN_PATH_TYPE, startx, starty, startz, xloc, yloc, zloc)
  -- Spring.MarkerAddLine(startx, starty, startz, xloc, yloc, zloc)
  --thePath.GetEstimatedPath
  --
  if (thePath ~= nil) then
    local morePath, startIdxOfDetailedPath = thePath.GetEstimatedPath(thePath)
    if (morePath ~= nil) then
      local curx, curz = startx, startz
      local lastMilepost = 0
(...)
Now infolog says:

Code: Select all

[f=0072999] Error: LuaRules::RunCallIn: error = 2, GameFrame, [string "LuaRules/Gadgets/unit_spacebugs.lua"]:1376: attempt to call field 'GetEstimatedPath' (a nil value)
stack traceback:
	[string "LuaRules/Gadgets/unit_spacebugs.lua"]:1376: in function 'PathItUp'
	[string "LuaRules/Gadgets/unit_spacebugs.lua"]:1509: in function 'QueenAttackManager'
	[string "LuaRules/Gadgets/unit_spacebugs.lua"]:1612: in function 'RunQueenAI'
	[string "LuaRules/Gadgets/unit_spacebugs.lua"]:1811: in function 'GameFrame'
	[string "LuaRules/gadgets.lua"]:931: in function <[string "LuaRules/gadgets.lua"]:929>
	(tail call): ?
Here is the wiki of luaPathfinding http://springrts.com/wiki/Lua_PathFinder but it does not helped me much. Do you know, if the wiki page is actual or how was Pathing changed?

Re: Path:GetEstimatedPath() changed?

Posted: 07 Feb 2012, 01:37
by Kloot
Sorry, this happened during the 85.0 QTPFS merge.

TLDR: GetEstimatedPath is now GetPathWayPoints because the function returns all waypoints of a path (not just the "estimated" ones, which are a detail specific to the default pathfinder when it is used), so its name was misleading and not general enough now that Spring can support multiple pathfinder backends.

Re: Path:GetEstimatedPath() changed?

Posted: 07 Feb 2012, 10:21
by PepeAmpere
Thx, now it works. :-)