Flight, did you not read my post? I'll show you where model loading must be done.
{*******************************************************************************
function GetInteractableAt(T: TTile): TRSObject;
By: Drags111 modified/fixed by pyroryan
Description: Returns the objType Interactable ID at the given tile. Interactable
objects include anything clickable that isnt a WallObject.
*******************************************************************************}
function GetInteractableAt(T: TTile): TRSObject;
var
Plane, Ground, Node, Obj, ObjTemp, ID: integer;
TempBox: TBox;
TempTile, L, Base: TTile;
begin
Result := NULL_RSOBJECT;
try
Base.X := SmartGetFieldInt(0, hook_static_BaseX);
Base.Y := SmartGetFieldInt(0, hook_static_BaseY);
L.X := T.X - Base.X;
L.Y := T.Y - Base.Y;
Plane := SmartGetFieldInt(0, hook_static_LoadedPlane);
Ground := SmartGetFieldArray3DObject(0, hook_static_GroundTiles, Plane, L.X, L.Y);
Node := SmartGetFieldObject(Ground, hook_ground_AnimableList);
while(Node <> 0)do
begin
TempBox := NULL_BOX;
Obj := SmartGetFieldObject(Node, hook_AnimableNode_GetAnimable);
if(Obj <> 0)then
begin
ID := SmartGetFieldShort(Obj, hook_InteractiveObject_GetID) and $FFFF;
if((ID = -1) or ((ID) = 65535))then //65535 is an unsigned -1....
begin
ObjTemp := SmartGetFieldObject(Obj, hook_interactiveobject2_GetObjectData);
if(ObjTemp <> 0) then
begin
ID := SmartGetFieldInt(ObjTemp, hook_secondlevelobject_GetID);
if((ID = -1) or ((ID and $FFFF) = 65535))then
begin
SmartFreeObject(ObjTemp);
Break;
end;
//<<<<<<<<<<<<<<<<<<<<<<<<<<RIGHT HERE OR>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
TempBox.X1 := (Base.X + SmartGetFieldShort(ObjTemp, hook_animableentity_getAreaX1));
TempBox.Y1 := (Base.Y + SmartGetFieldShort(ObjTemp, hook_animableentity_getAreaY1));
TempBox.X2 := (Base.X + SmartGetFieldShort(ObjTemp, hook_animableentity_getAreaX2));
TempBox.Y2 := (Base.Y + SmartGetFieldShort(ObjTemp, hook_animableentity_getAreaY2));
TempTile.X := (Base.X + (SmartGetFieldInt(ObjTemp, hook_animable_PixelX) / 512));
TempTile.Y := (Base.Y + (SmartGetFieldInt(ObjTemp, hook_animable_PixelY) / 512));
SmartFreeObject(ObjTemp);
end;
end else //ID is valid, so we can use Obj
begin
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<RIGHT HERE>>>>>>>>>>>>>>>>>>>>>>
TempBox.X1 := (Base.X + SmartGetFieldShort(Obj, hook_animableentity_getAreaX1));
TempBox.Y1 := (Base.Y + SmartGetFieldShort(Obj, hook_animableentity_getAreaY1));
TempBox.X2 := (Base.X + SmartGetFieldShort(Obj, hook_animableentity_getAreaX2));
TempBox.Y2 := (Base.Y + SmartGetFieldShort(Obj, hook_animableentity_getAreaY2));
TempTile.X := (Base.X + (SmartGetFieldInt(Obj, hook_animable_PixelX) / 512));
TempTile.Y := (Base.Y + (SmartGetFieldInt(Obj, hook_animable_PixelY) / 512));
end;
Result := NewObject(ID, OBJECT_TYPE_INTERACTABLE, T, TempTile, TempBox);
SmartFreeObject(Obj);
Break;
end;
SmartFreeObject(Node);
Node := SmartGetFieldObject(Node, hook_AnimableNode_GetNext);
end;
finally
try
SmartFreeObject(Ground);
except
end;
try
SmartFreeObject(Obj);
except
end;
try
SmartFreeObject(ObjTemp);
except
end;
try
SmartFreeObject(Node);
except
end;
end;
end;