Here's an example script that will generate a .TXT file containing path/waypoint X/Y/Z info for those who are not sure how to write debug stuff to a file. The "test.txt" file is written to the GG "Files" folder by default.
function pathinfo_init(e)
alreadyoutput=0 ;
debugOn = 1;
if debugOn == 1 then
-- open file operation in overwrite/create new file mode "w"
file = io.open("test.txt", "w");
-- sets the default output file i.e. test.lua
io.output(file)
end
platformstate = 0 ;
PathIndex = -1;
PointIndex = 2;
pClosest = 99999;
end
function pathinfo_main(e)
if debugOn==1 and alreadyoutput == 0 then
for pa = 1, AIGetTotalPaths(), 1 do
waypointpaths = AIGetTotalPaths()
io.write("Path=" .. pa .. "\n")
for po = 1 , AIGetPathCountPoints(pa), 1 do
io.write(" Point=" .. po .. "\n")
pDX = g_Entity[e]['x'] - AIPathGetPointX(pa,po)
pDY = g_Entity[e]['y'] - AIPathGetPointY(pa,po)
pDZ = g_Entity[e]['z'] - AIPathGetPointZ(pa,po)
io.write(" pDX=" .. pDX)
io.write(" pDY=" .. pDY)
io.write(" pDZ=" .. pDZ .. "\n")
pDist = math.sqrt(math.abs(pDX*pDX)+math.abs(pDY*pDY)+math.abs(pDZ*pDZ));
if pDist < pClosest and pDist < 200 then
pClosest = pDist
PathIndex = pa
PointIndex = po
end
end -- po
io.write("\n")
end -- pa
alreadyoutput = 1
--Destroy(e)
-- closes the open file
io.close(file)
end
PromptLocal (e,'platformstate=' .. platformstate .. ' wp paths=' .. waypointpaths .. ' closest=' .. pClosest .. ' path idx=' .. PathIndex .. ' point idx=' .. PointIndex)
end
example output attached here:
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT