Object functions

class ObjectFunctions

Public Static Functions

void ReadReceivedObjectList()

Use the last object list received by the server as the one being read.

Return
void

void ClearObjectList()

Clear the data from the object list stored on the server.

Return
void

void SetObjectListPid(unsigned short pid)

Set the pid attached to the ObjectList.

Return
void
Parameters
  • pid: The player ID to whom the object list should be attached.

void CopyReceivedObjectListToStore()

Take the contents of the read-only object list last received by the server from a player and move its contents to the stored object list that can be sent by the server.

Return
void

unsigned int GetObjectListSize()

Get the number of indexes in the read object list.

Return
The number of indexes.

unsigned char GetObjectListOrigin()

Get the origin of the read object list.

Return
The origin (0 for CLIENT_GAMEPLAY, 1 for CLIENT_CONSOLE, 2 for CLIENT_DIALOGUE, 3 for CLIENT_SCRIPT_LOCAL, 4 for CLIENT_SCRIPT_GLOBAL, 5 for SERVER_SCRIPT).

const char *GetObjectListClientScript()

Get the client script that the read object list originated from.

Note: This is not yet implemented.

Return
The ID of the client script.

unsigned char GetObjectListAction()

Get the action type used in the read object list.

Return
The action type (0 for SET, 1 for ADD, 2 for REMOVE, 3 for REQUEST).

unsigned char GetObjectListContainerSubAction()

Get the container subaction type used in the read object list.

Return
The action type (0 for NONE, 1 for DRAG, 2 for DROP, 3 for TAKE_ALL).

bool IsObjectPlayer(unsigned int index)

Check whether the object at a certain index in the read object list is a player.

Note: Although most player data and events are dealt with in Player packets, object activation is general enough for players themselves to be included as objects in ObjectActivate packets.

Return
Whether the object is a player.
Parameters
  • index: The index of the object.

int GetObjectPid(unsigned int index)

Get the player ID of the object at a certain index in the read object list, only valid if the object is a player.

Note: Currently, players can only be objects in ObjectActivate and ConsoleCommand packets.

Return
The player ID of the object.
Parameters
  • index: The index of the object.

const char *GetObjectRefId(unsigned int index)

Get the refId of the object at a certain index in the read object list.

Return
The refId.
Parameters
  • index: The index of the object.

unsigned int GetObjectRefNum(unsigned int index)

Get the refNum of the object at a certain index in the read object list.

Return
The refNum.
Parameters
  • index: The index of the object.

unsigned int GetObjectMpNum(unsigned int index)

Get the mpNum of the object at a certain index in the read object list.

Return
The mpNum.
Parameters
  • index: The index of the object.

int GetObjectCount(unsigned int index)

Get the count of the object at a certain index in the read object list.

Return
The object count.
Parameters
  • index: The index of the object.

int GetObjectCharge(unsigned int index)

Get the charge of the object at a certain index in the read object list.

Return
The charge.
Parameters
  • index: The index of the object.

double GetObjectEnchantmentCharge(unsigned int index)

Get the enchantment charge of the object at a certain index in the read object list.

Return
The enchantment charge.
Parameters
  • index: The index of the object.

const char *GetObjectSoul(unsigned int index)

Get the soul of the object at a certain index in the read object list.

Return
The soul.
Parameters
  • index: The index of the object.

int GetObjectGoldValue(unsigned int index)

Get the gold value of the object at a certain index in the read object list.

This is used solely to get the gold value of gold. It is not used for other objects.

Return
The gold value.
Parameters
  • index: The index of the object.

double GetObjectScale(unsigned int index)

Get the object scale of the object at a certain index in the read object list.

Return
The object scale.
Parameters
  • index: The index of the object.

bool GetObjectState(unsigned int index)

Get the object state of the object at a certain index in the read object list.

Return
The object state.
Parameters
  • index: The index of the object.

int GetObjectDoorState(unsigned int index)

Get the door state of the object at a certain index in the read object list.

Return
The door state.
Parameters
  • index: The index of the object.

int GetObjectLockLevel(unsigned int index)

Get the lock level of the object at a certain index in the read object list.

Return
The lock level.
Parameters
  • index: The index of the object.

bool DoesObjectHavePlayerActivating(unsigned int index)

Check whether the object at a certain index in the read object list has been activated by a player.

Return
Whether the object has been activated by a player.
Parameters
  • index: The index of the object.

int GetObjectActivatingPid(unsigned int index)

Get the player ID of the player activating the object at a certain index in the read object list.

Return
The player ID of the activating player.
Parameters
  • index: The index of the object.

const char *GetObjectActivatingRefId(unsigned int index)

Get the refId of the actor activating the object at a certain index in the read object list.

Return
The refId of the activating actor.
Parameters
  • index: The index of the object.

unsigned int GetObjectActivatingRefNum(unsigned int index)

Get the refNum of the actor activating the object at a certain index in the read object list.

Return
The refNum of the activating actor.
Parameters
  • index: The index of the object.

unsigned int GetObjectActivatingMpNum(unsigned int index)

Get the mpNum of the actor activating the object at a certain index in the read object list.

Return
The mpNum of the activating actor.
Parameters
  • index: The index of the object.

const char *GetObjectActivatingName(unsigned int index)

Get the name of the actor activating the object at a certain index in the read object list.

Return
The name of the activating actor.
Parameters
  • index: The index of the object.

bool GetObjectSummonState(unsigned int index)

Check whether the object at a certain index in the read object list is a summon.

Only living actors can be summoned.

Return
The summon state.

double GetObjectSummonDuration(unsigned int index)

Get the summon duration of the object at a certain index in the read object list.

Note: Returns -1 if indefinite.

Return
The summon duration.
Parameters
  • index: The index of the object.

bool DoesObjectHavePlayerSummoner(unsigned int index)

Check whether the object at a certain index in the read object list has a player as its summoner.

Only living actors can be summoned.

Return
Whether a player is the summoner of the object.
Parameters
  • index: The index of the object.

int GetObjectSummonerPid(unsigned int index)

Get the player ID of the summoner of the object at a certain index in the read object list.

Return
The player ID of the summoner.
Parameters
  • index: The index of the object.

const char *GetObjectSummonerRefId(unsigned int index)

Get the refId of the actor summoner of the object at a certain index in the read object list.

Return
The refId of the summoner.
Parameters
  • index: The index of the object.

unsigned int GetObjectSummonerRefNum(unsigned int index)

Get the refNum of the actor summoner of the object at a certain index in the read object list.

Return
The refNum of the summoner.
Parameters
  • index: The index of the object.

unsigned int GetObjectSummonerMpNum(unsigned int index)

Get the mpNum of the actor summoner of the object at a certain index in the read object list.

Return
The mpNum of the summoner.
Parameters
  • index: The index of the object.

double GetObjectPosX(unsigned int index)

Get the X position of the object at a certain index in the read object list.

Return
The X position.
Parameters
  • index: The index of the object.

double GetObjectPosY(unsigned int index)

Get the Y position of the object at a certain index in the read object list.

Return
The Y position.
Parameters
  • index: The index of the object.

double GetObjectPosZ(unsigned int index)

Get the Z position at a certain index in the read object list.

Return
The Z position.
Parameters
  • index: The index of the object.

double GetObjectRotX(unsigned int index)

Get the X rotation of the object at a certain index in the read object list.

Return
The X rotation.
Parameters
  • index: The index of the object.

double GetObjectRotY(unsigned int index)

Get the Y rotation of the object at a certain index in the read object list.

Return
The Y rotation.
Parameters
  • index: The index of the object.

double GetObjectRotZ(unsigned int index)

Get the Z rotation of the object at a certain index in the read object list.

Return
The Z rotation.
Parameters
  • index: The index of the object.

const char *GetVideoFilename(unsigned int index)

Get the videoFilename of the object at a certain index in the read object list.

Return
The videoFilename.

unsigned int GetContainerChangesSize(unsigned int objectIndex)

Get the number of container item indexes of the object at a certain index in the read object list.

Return
The number of container item indexes.
Parameters
  • index: The index of the object.

const char *GetContainerItemRefId(unsigned int objectIndex, unsigned int itemIndex)

Get the refId of the container item at a certain itemIndex in the container changes of the object at a certain objectIndex in the read object list.

Return
The refId.
Parameters
  • objectIndex: The index of the object.
  • itemIndex: The index of the container item.

int GetContainerItemCount(unsigned int objectIndex, unsigned int itemIndex)

Get the item count of the container item at a certain itemIndex in the container changes of the object at a certain objectIndex in the read object list.

Return
The item count.
Parameters
  • objectIndex: The index of the object.
  • itemIndex: The index of the container item.

int GetContainerItemCharge(unsigned int objectIndex, unsigned int itemIndex)

Get the charge of the container item at a certain itemIndex in the container changes of the object at a certain objectIndex in the read object list.

Return
The charge.
Parameters
  • objectIndex: The index of the object.
  • itemIndex: The index of the container item.

double GetContainerItemEnchantmentCharge(unsigned int objectIndex, unsigned int itemIndex)

Get the enchantment charge of the container item at a certain itemIndex in the container changes of the object at a certain objectIndex in the read object list.

Return
The enchantment charge.
Parameters
  • objectIndex: The index of the object.
  • itemIndex: The index of the container item.

const char *GetContainerItemSoul(unsigned int objectIndex, unsigned int itemIndex)

Get the soul of the container item at a certain itemIndex in the container changes of the object at a certain objectIndex in the read object list.

Return
The soul.
Parameters
  • objectIndex: The index of the object.
  • itemIndex: The index of the container item.

int GetContainerItemActionCount(unsigned int objectIndex, unsigned int itemIndex)

Get the action count of the container item at a certain itemIndex in the container changes of the object at a certain objectIndex in the read object list.

Return
The action count.
Parameters
  • objectIndex: The index of the object.
  • itemIndex: The index of the container item.

bool DoesObjectHaveContainer(unsigned int index)

Check whether the object at a certain index in the read object list has a container.

Note: Only ObjectLists from ObjectPlace packets contain this information. Objects from received ObjectSpawn packets can always be assumed to have a container.

Return
Whether the object has a container.
Parameters
  • index: The index of the object.

void SetObjectListCell(const char *cellDescription)

Set the cell of the temporary object list stored on the server.

The cell is determined to be an exterior cell if it fits the pattern of a number followed by a comma followed by another number.

Return
void
Parameters
  • cellDescription: The description of the cell.

void SetObjectListAction(unsigned char action)

Set the action type of the temporary object list stored on the server.

Return
void
Parameters
  • action: The action type (0 for SET, 1 for ADD, 2 for REMOVE, 3 for REQUEST).

void SetObjectListConsoleCommand(const char *consoleCommand)

Set the console command of the temporary object list stored on the server.

When sent, the command will run once on every object added to the object list. If no objects have been added, it will run once without any object reference.

Return
void
Parameters
  • consoleCommand: The console command.

void SetObjectRefId(const char *refId)

Set the refId of the temporary object stored on the server.

Return
void
Parameters
  • refId: The refId.

void SetObjectRefNum(int refNum)

Set the refNum of the temporary object stored on the server.

Every object loaded from .ESM and .ESP data files has a unique refNum which needs to be retained to refer to it in packets.

On the other hand, objects placed or spawned via the server should always have a refNum of 0.

Return
void
Parameters
  • refNum: The refNum.

void SetObjectMpNum(int mpNum)

Set the mpNum of the temporary object stored on the server.

Every object placed or spawned via the server is assigned an mpNum by incrementing the last mpNum stored on the server. Scripts should take care to ensure that mpNums are kept unique for these objects.

Objects loaded from .ESM and .ESP data files should always have an mpNum of 0, because they have unique refNumes instead.

Return
void
Parameters
  • mpNum: The mpNum.

void SetObjectCount(int count)

Set the object count of the temporary object stored on the server.

This determines the quantity of an object, with the exception of gold.

Return
void
Parameters
  • count: The object count.

void SetObjectCharge(int charge)

Set the charge of the temporary object stored on the server.

Object durabilities are set through this value.

Return
void
Parameters
  • charge: The charge.

void SetObjectEnchantmentCharge(double enchantmentCharge)

Set the enchantment charge of the temporary object stored on the server.

Object durabilities are set through this value.

Return
void
Parameters
  • charge: The enchantment charge.

void SetObjectSoul(const char *soul)

Set the soul of the temporary object stored on the server.

Return
void
Parameters
  • refId: The soul.

void SetObjectGoldValue(int goldValue)

Set the gold value of the temporary object stored on the server.

This is used solely to set the gold value for gold. It has no effect on other objects.

Return
void
Parameters
  • goldValue: The gold value.

void SetObjectScale(double scale)

Set the scale of the temporary object stored on the server.

Objects are smaller or larger than their default size based on their scale.

Return
void
Parameters
  • scale: The scale.

void SetObjectState(bool objectState)

Set the object state of the temporary object stored on the server.

Objects are enabled or disabled based on their object state.

Return
void
Parameters
  • objectState: The object state.

void SetObjectLockLevel(int lockLevel)

Set the lock level of the temporary object stored on the server.

Return
void
Parameters
  • lockLevel: The lock level.

void SetObjectSummonDuration(float summonDuration)

Set the summon duration of the temporary object stored on the server.

Return
void
Parameters
  • summonDuration: The summon duration.

void SetObjectDisarmState(bool disarmState)

Set the disarm state of the temporary object stored on the server.

Return
void
Parameters
  • disarmState: The disarmState.

void SetObjectSummonState(bool summonState)

Set the summon state of the temporary object stored on the server.

This only affects living actors and determines whether they are summons of another living actor.

Return
void
Parameters
  • summonState: The summon state.

void SetObjectPosition(double x, double y, double z)

Set the position of the temporary object stored on the server.

Return
void
Parameters
  • x: The X position.
  • y: The Y position.
  • z: The Z position.

void SetObjectRotation(double x, double y, double z)

Set the rotation of the temporary object stored on the server.

Return
void
Parameters
  • x: The X rotation.
  • y: The Y rotation.
  • z: The Z rotation.

void SetObjectActivatingPid(unsigned short pid)

Set the player ID of the player activating the temporary object stored on the server. Currently only used for ObjectActivate packets.

Return
void
Parameters
  • pid: The pid of the player.

void SetObjectDoorState(int doorState)

Set the door state of the temporary object stored on the server.

Doors are open or closed based on their door state.

Return
void
Parameters
  • doorState: The door state.

void SetObjectDoorTeleportState(bool teleportState)

Set the teleport state of the temporary object stored on the server.

If a door’s teleport state is true, interacting with the door teleports a player to its destination. If it’s false, it opens and closes like a regular door.

Return
void
Parameters
  • teleportState: The teleport state.

void SetObjectDoorDestinationCell(const char *cellDescription)

Set the door destination cell of the temporary object stored on the server.

The cell is determined to be an exterior cell if it fits the pattern of a number followed by a comma followed by another number.

Return
void
Parameters
  • cellDescription: The description of the cell.

void SetObjectDoorDestinationPosition(double x, double y, double z)

Set the door destination position of the temporary object stored on the server.

Return
void
Parameters
  • x: The X position.
  • y: The Y position.
  • z: The Z position.

void SetObjectDoorDestinationRotation(double x, double z)

Set the door destination rotation of the temporary object stored on the server.

Note: Because this sets the rotation a player will have upon using the door, and rotation on the Y axis has no effect on players, the Y value has been omitted as an argument.

Return
void
Parameters
  • x: The X rotation.
  • z: The Z rotation.

void SetPlayerAsObject(unsigned short pid)

Set a player as the object in the temporary object stored on the server. Currently only used for ConsoleCommand packets.

Return
void
Parameters
  • pid: The pid of the player.

void SetContainerItemRefId(const char *refId)

Set the refId of the temporary container item stored on the server.

Return
void
Parameters
  • refId: The refId.

void SetContainerItemCount(int count)

Set the item count of the temporary container item stored on the server.

Return
void
Parameters
  • count: The item count.

void SetContainerItemCharge(int charge)

Set the charge of the temporary container item stored on the server.

Return
void
Parameters
  • charge: The charge.

void SetContainerItemEnchantmentCharge(double enchantmentCharge)

Set the enchantment charge of the temporary container item stored on the server.

Return
void
Parameters
  • charge: The enchantment charge.

void SetContainerItemSoul(const char *soul)

Set the soul of the temporary container item stored on the server.

Return
void
Parameters
  • refId: The soul.

void SetContainerItemActionCountByIndex(unsigned int objectIndex, unsigned int itemIndex, int actionCount)

Set the action count of the container item at a certain itemIndex in the container changes of the object at a certain objectIndex in the object list stored on the server.

When resending a received Container packet, this allows you to correct the amount of items removed from a container by a player when it conflicts with what other players have already taken.

Return
void
Parameters
  • objectIndex: The index of the object.
  • itemIndex: The index of the container item.
  • actionCount: The action count.

void AddObject()

Add a copy of the server’s temporary object to the server’s currently stored object list.

In the process, the server’s temporary object will automatically be cleared so a new one can be set up.

Return
void

void AddContainerItem()

Add a copy of the server’s temporary container item to the container changes of the server’s temporary object.

In the process, the server’s temporary container item will automatically be cleared so a new one can be set up.

Return
void

void SendObjectActivate(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectActivate packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendObjectPlace(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectPlace packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendObjectSpawn(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectSpawn packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendObjectDelete(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectDelete packet.

Return
void
Parameters
  • broadcast: Whether this packet should be sent only to the player for whom the current object list was initialized or to everyone on the server.

void SendObjectLock(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectLock packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendObjectTrap(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectTrap packet.

Return
void
Parameters
  • broadcast: Whether this packet should be sent only to the player for whom the current object list was initialized or to everyone on the server.

void SendObjectScale(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectScale packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendObjectState(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send an ObjectState packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendDoorState(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send a DoorState packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendDoorDestination(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send a DoorDestination packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendContainer(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send a Container packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendVideoPlay(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send a VideoPlay packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).

void SendConsoleCommand(bool sendToOtherPlayers, bool skipAttachedPlayer)

Send a ConsoleCommand packet.

Return
void
Parameters
  • sendToOtherPlayers: Whether this packet should be sent to players other than the player attached to the packet (false by default).
  • skipAttachedPlayer: Whether the packet should skip being sent to the player attached to the packet (false by default).