I think TileToWorld is broken, I tried switching the pitch+yaw, but no result :(
I do get the tiles of the NPC, run this in Lumby bank, it'll writeln the tile of the banker:
program New;
var
npcstuff, npccount, i : integer;
const
//Global Static Hooks
SettingsArray = 'uc.ub'; //int[]
CurrentLevels = 'bg.t'; //int[]
MaxLevels = 'ua.R'; //int[]
Experiances = 'va.Z'; //int[]
BaseX = 'fb.m'; //int
BaseY = 'ea.h'; //int
MyPlayer = 'r.X'; //Player
CompassAngle = 'h.l'; //int (MinimapInt1)
MapOffsetAngle = 'ef.c'; //int (MinimapInt2)
BaseLayer = 'hc.pb'; //int (plane/terrainInt)
GroundSettings = 'jc.q'; //byte[][][] (groundByteArray)
GroundHeights = 'u.wc'; //int[][][] (groundIntArray)
CamX = 'dh.i'; //int
CamY = 'mb.A'; //int
CamZ = 'nd.y'; //int
CamPitch = 'pd.c'; //int (CamCurveX)
CamYaw = 'hc.hb'; //int (CamCurveY)
//Character Hooks
CurrentX = 'fb'; //int
CurrentY = 'nc'; //int
CharAnim = 'bc'; //int
{Not updated}CharMotion = 'T'; //int
CharName = 'rc'; //StringWrap
//StringWrap Hooks
StringBytes = 'lf'; //byte[]
procedure TileToWorld(tileX, tileY, height: integer; var screenX, screenY: integer);
var
cx, cy, cz, dx, dy, dz, locX, locY, layer: Integer;
pitch, yaw, sinYaw, cosYaw, sinPitch, cosPitch, rotation: extended;
begin
locX:= tileX - SmartGetFieldInt(0,BaseX);
locY:= tileY - SmartGetFieldInt(0,BaseY);
if (locX < 0) or (locY < 0) or (locX > 103) or (locY > 103) then
Exit;
layer:= SmartGetFieldInt(0,BaseLayer);
if (layer < 3) and ((2 and SmartGetFieldArray3DByte(0,GroundSettings,1,locX,locY)) = 2) then
Inc(layer);
cz:= SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX,locY+1) +
SmartGetFieldArray3DInt(0,GroundHeights,layer,locX+1,locY+1);
cx:= locX * 128 + 64 - SmartGetFieldInt(0,CamX);
cy:= locY * 128 + 64 - SmartGetFieldInt(0,CamY);
cz:= (cz / 4) - height - SmartGetFieldInt(0,CamZ);
pitch:= SmartGetFieldInt(0,CamPitch) * Pi / 1024;
yaw:= SmartGetFieldInt(0,CamYaw) * Pi / 1024;
sinYaw:= sin(yaw);
cosYaw:= cos(yaw);
sinPitch:= sin(pitch);
cosPitch:= cos(pitch);
rotation:= cosYaw*cy-sinYaw*cx;
dx:= Round(sinYaw*cy+cosYaw*cx);
dy:= Round(sinPitch*cz+cosPitch*rotation);
dz:= Round(cosPitch*cz-sinPitch*rotation);
screenX:= (dx * 512) / dy + 256;
screenY:= (dz * 512) / dy + 167;
end;
procedure GetMyPos(var x, y: Integer);
var
me: Integer;
begin
me:= SmartGetFieldObject(0,MyPlayer);
x:= SmartGetFieldInt(0,BaseX) + SmartGetFieldInt(me,CurrentX) shr 7;
y:= SmartGetFieldInt(0,BaseY) + SmartGetFieldInt(me,CurrentY) shr 7;
SmartFreeObject(me);
end;
var x, y : integer;
begin
SmartSetup('me10', false, true);
GetMyPos(x, y);
writeln(inttostr(x));
writeln(inttostr(y));
npccount := SmartGetFieldInt(0, 'a.j');
writeln('There are/is '+inttostr(npccount)+' NPC(''s)');
for i := 0 to npccount-1 do
writeln(inttostr(SmartGetFieldArrayInt(0, 'a.h', i)));
npcstuff := SmartGetFieldArrayObject(0, 'th.g', 11055);
writeln(inttostr(npcstuff));
Writeln(IntToStr(SmartGetFieldInt(0,BaseX)+SmartGetFieldInt(npcstuff, 'fb') shr 7));
Writeln(IntToStr(SmartGetFieldInt(0,BaseY)+SmartGetFieldInt(npcstuff, 'nc') shr 7));
TileToWorld(SmartGetFieldInt(0,BaseX)+SmartGetFieldInt(npcstuff, 'fb') shr 7,SmartGetFieldInt(0,BaseY)+SmartGetFieldInt(npcstuff, 'nc') shr 7, 0, x, y);
//smartMoveMouse(x, y);
SmartFreeObject(npcstuff);
end.
Returns:
Successfully compiled
3208
3220
There are/is 1 NPC('s)
11055
217341412
3207 //npc X
3222 //npc Y
Successfully executed