Path:GetEstimatedPath() changed?

Path:GetEstimatedPath() changed?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
PepeAmpere
Posts: 591
Joined: 03 Jun 2010, 01:28

Path:GetEstimatedPath() changed?

Post 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?
Attachments
unit_spacebugs.lua
full file
(65.01 KiB) Downloaded 8 times
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Path:GetEstimatedPath() changed?

Post 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.
User avatar
PepeAmpere
Posts: 591
Joined: 03 Jun 2010, 01:28

Re: Path:GetEstimatedPath() changed?

Post by PepeAmpere »

Thx, now it works. :-)
Post Reply

Return to “Lua Scripts”