[Client] Lua Global Character Functions

Category: LuaScript | Subcategory: Main Global Character Functions


Global Character Functions

These global Lua functions provide extensive access to character information, visual properties, and interaction with players and NPCs within the game client. They allow developers to query, modify, and manage characters efficiently, enhancing gameplay customization and control.
 

Character Basic Information
 

CharacterGetName(arrayIndex)
Returns the name of the character.
arrayIndex: (integer) Character index in the viewport.

CharacterGetIndex(arrayIndex)
Returns the unique ID of the character.
arrayIndex: (integer) Character index in the viewport.

CharacterGetIsLive(arrayIndex)
Returns if the character is alive (1) or dead (0).
arrayIndex: (integer) Character index in the viewport.

CharacterGetType(arrayIndex)
Returns the character type (player, monster, NPC).
arrayIndex: (integer) Character index in the viewport.
 

Character Position and Movement
 

CharacterGetX(arrayIndex)
Returns the map X coordinate of the character.
arrayIndex: (integer) Character index.

CharacterGetY(arrayIndex)
Returns the map Y coordinate of the character.
arrayIndex: (integer) Character index.

CharacterGetPositionX(arrayIndex)
Returns the 3D world X coordinate of the character.
arrayIndex: (integer) Character index.

CharacterGetPositionY(arrayIndex)
Returns the 3D world Y coordinate of the character.
arrayIndex: (integer) Character index.

CharacterGetPositionZ(arrayIndex)
Returns the 3D world Z coordinate (height) of the character.
arrayIndex: (integer) Character index.

CharacterSetPositionX(arrayIndex, value)
Sets a new 3D X coordinate for the character.
arrayIndex: (integer) Character index.
value: (float) New X coordinate.

CharacterSetPositionY(arrayIndex, value)
Sets a new 3D Y coordinate for the character.
arrayIndex: (integer) Character index.
value: (float) New Y coordinate.

CharacterSetPositionZ(arrayIndex, value)
Sets a new 3D Z coordinate (height) for the character.
arrayIndex: (integer) Character index.
value: (float) New Z coordinate.

CharacterSetScale(arrayIndex, value)
Sets the character's visual size (scaling).
arrayIndex: (integer) Character index.
value: (float) Scale multiplier.
 

Character Visual Rotation (Angles)
 

CharacterGetAngleX(arrayIndex)
Returns the X rotation angle.
arrayIndex: (integer) Character index.

CharacterGetAngleY(arrayIndex)
Returns the Y rotation angle.
arrayIndex: (integer) Character index.

CharacterGetAngleZ(arrayIndex)
Returns the Z rotation angle.
arrayIndex: (integer) Character index.

CharacterSetAngleX(arrayIndex, value)
Sets a new X rotation angle.
arrayIndex: (integer) Character index.
value: (float) New angle.

CharacterSetAngleY(arrayIndex, value)
Sets a new Y rotation angle.
arrayIndex: (integer) Character index.
value: (float) New angle.

CharacterSetAngleZ(arrayIndex, value)
Sets a new Z rotation angle.
arrayIndex: (integer) Character index.
value: (float) New angle.
 

Character Equipment Information
 

CharacterGetHelper(arrayIndex)
Returns the ID of the helper (pet or support entity).
arrayIndex: (integer) Character index.

CharacterGetWing(arrayIndex)
Returns the ID of the wings equipped.
arrayIndex: (integer) Character index.

CharacterGetSword(arrayIndex)
Returns the ID of the sword equipped.
arrayIndex: (integer) Character index.

CharacterGetShield(arrayIndex)
Returns the ID of the shield equipped.
arrayIndex: (integer) Character index.

CharacterGetHelm(arrayIndex)
Returns the ID of the helm equipped.
arrayIndex: (integer) Character index.

CharacterGetArmor(arrayIndex)
Returns the ID of the armor equipped.
arrayIndex: (integer) Character index.

CharacterGetPants(arrayIndex)
Returns the ID of the pants equipped.
arrayIndex: (integer) Character index.

CharacterGetGloves(arrayIndex)
Returns the ID of the gloves equipped.
arrayIndex: (integer) Character index.

CharacterGetBoots(arrayIndex)
Returns the ID of the boots equipped.
arrayIndex: (integer) Character index.
 

Character Class, Level, and Guild
 

CharacterGetLevel(arrayIndex)
Returns the current level of the character.
arrayIndex: (integer) Character index.

CharacterGetClass(arrayIndex)
Returns the basic class ID of the character.
arrayIndex: (integer) Character index.

CharacterGetFullClass(arrayIndex)
Returns the complete class ID (extended) of the character.
arrayIndex: (integer) Character index.

CharacterGetGuild(arrayIndex)
Returns the guild ID associated with the character.
arrayIndex: (integer) Character index.

CharacterGuildGetName(arrayIndex)
Returns the name of the guild.
arrayIndex: (integer) Character index.

CharacterGetGuildStatus(arrayIndex)
Returns the character's rank/status inside the guild.
arrayIndex: (integer) Character index.

GetClassName(classId)
Returns the class name based on a class ID.
classId: (integer) Class identifier.
 

Character Visibility and Actions
 

CharacterGetVisible(arrayIndex)
Returns whether the character is currently visible in the viewport.
arrayIndex: (integer) Character index.

SetCharacterAction(arrayIndex, animationId)
Forces the character to play a specific action or animation.
arrayIndex: (integer) Character index.
animationId: (integer) Animation ID.
 

Character Selection and Targeting
 

GetSelectedHero()
Returns the array index of the currently selected character.

SetSelectedHero(arrayIndex)
Sets a new selected character.
arrayIndex: (integer) Character index.

SetTargetCharacter(arrayIndex)
Sets the targeted character for interactions (attack, follow, etc.).
arrayIndex: (integer) Character index.

GetTargetCharacter()
Returns the array index of the current target character.
 

Player Interaction Functions
 

SendPlayerChat(playerName, message)
Sends a private chat message to a player.
playerName: (string) Target player's name.
message: (string) Message content.

SendTradePlayer(playerName)
Requests a trade with a player.
playerName: (string) Target player's name.

SendPartyPlayer(playerName)
Invites a player to join your party.
playerName: (string) Target player's name.

SendGuildPlayer(playerName)
Invites a player to join your guild.
playerName: (string) Target player's name.

SendShopPlayer(playerName)
Opens the player's personal shop interface.
playerName: (string) Target player's name.
 

Character Searching Utilities
 

GetPosFromPlayer(playerName)
Returns the (X, Y) map position of a player by name.
playerName: (string) Player's name.

FindCharacterStack(playerName)
Finds and returns the array index of a player by name.
playerName: (string) Player's name.

 

Conclusion

These global character functions empower Lua scripts to deeply interact with visible entities in the game client. Developers can retrieve full information about characters, control their animations, modify their positions and visual scaling, and manage player-to-player interactions like chatting, trading, and party invitations. This level of control significantly enhances the possibilities for custom UIs, automated tools, dynamic content, and player assistance systems.

Return