Class Objects.AIObject

AI object

Functions

AIObject:GetPosition() Get the object's position
AIObject:SetPosition(position) Set the object's position
AIObject:GetRotationY() Get the object's Y-axis rotation.
AIObject:SetRotationY(rotation) Set the object's Y-axis rotation.
AIObject:GetName() Get the object's unique string identifier
AIObject:SetName(name) Set the object's name (its unique string identifier)
AIObject:GetRoom() Get the current room of the object
AIObject:GetRoomNumber() Get the current room number of the object
AIObject:SetRoomNumber(ID) Set room number of the object This is used in conjunction with SetPosition to teleport the object to a new room.
AIObject:GetObjectID() Retrieve the object ID
AIObject:SetObjectID(ID) Change the object's ID.


Functions

AIObject:GetPosition()
Get the object's position

Returns:

    Vec3 a copy of the object's position
AIObject:SetPosition(position)
Set the object's position

Parameters:

  • position Vec3 the new position of the object
AIObject:GetRotationY()
Get the object's Y-axis rotation. To the best of my knowledge, the rotation of an AIObject has no effect.

Returns:

    number the object's Y-axis rotation
AIObject:SetRotationY(rotation)
Set the object's Y-axis rotation. To the best of my knowledge, the rotation of an AIObject has no effect.

Parameters:

  • rotation number The object's new Y-axis rotation
AIObject:GetName()
Get the object's unique string identifier

Returns:

    string the object's name
AIObject:SetName(name)
Set the object's name (its unique string identifier)

Parameters:

  • name string The object's new name
AIObject:GetRoom()
Get the current room of the object

Returns:

    Room current room of the object
AIObject:GetRoomNumber()
Get the current room number of the object

Returns:

    int number representing the current room of the object
AIObject:SetRoomNumber(ID)
Set room number of the object This is used in conjunction with SetPosition to teleport the object to a new room.

Parameters:

  • ID int the ID of the new room
AIObject:GetObjectID()
Retrieve the object ID

Returns:

    int a number representing the ID of the object
AIObject:SetObjectID(ID)
Change the object's ID. This will change the type of AI object it is. Note that a baddy will gain the behaviour of the tile it's on before said baddy is triggered. This means that changing the type of an AI object beneath a moveable will have no effect. Instead, this function can be used to change an object that the baddy isn't standing on. For example, you could have a pair of AIGUARD objects, and change one or the other two AIPATROL_1 based on whether the player has a certain item or not.

Parameters:

Usage:

    aiObj = TEN.Objects.GetMoveableByName("ai_guard_sphinx_room")
    aiObj:SetObjectID(TEN.Objects.ObjID.AI_PATROL1)
generated by TEN-LDoc (a fork of LDoc 1.4.6)