The Player object is in its core a normal Entity, but it has additional attributes as well as several functions you can call. This means all attributes an Entity has, the Player has also.
Accessing the Player object attributes
Example:
-- To print out the playernamed(Player.name)
-- print out the player position tabled(Player.pos)
Additional Player Object Attributes
hasaggro
Returns if your Player is being aggroed by an Enemy (boolean).
Returns a MAPID of the local map you are in (number).
*experience
Returns a lua table which holds experience values (table).
```lua
local experiencetable = Player.experience
d(experiencetable.current)
d(experiencetable.max)
d(experiencetable.percent)
d(experiencetable.required)
```
role
Returns the ROLE of the player for when you enqueue in anything in the DutyFinder.
cp
Returns a lua table which holds craftingpoint values (table).
```lua
local cptable = Player.cp
d(cptable.current) -- current Crafting Points
d(cptable.max) -- max Crafting Points
d(cptable.percent) -- Crafting Points percent
```
gp
Returns a lua table which holds gatheringpoint values (table).
```lua
local gptable = Player.gp
d(gptable.current) -- current Gathering Points
d(gptable.max) -- max Gathering Points
d(gptable.percent) -- Gathering Points percent
```
Player Object Functions
Calling a function of the player object, example:
-- To get the current Target Entity and print out its namelocalmytarget=Player:GetTarget()
if ( mytarget ) thend(mytarget.name) end-- Using the build in navigation to move towards the mytarget we just gotif ( mytarget) thenlocalpos=mytarget.posPlayer:MoveTo(pos.x,pos.y,pos.z)
end
Player Functions
Player:GetTarget()
Returns an Entity of your target, returns 0 if you dont have one.
Player:SetTarget(EntityID)
Selects the Entity by its ID. Returns (boolean).
Player:ClearTarget()
Deselects the current Target. Returns (boolean).
Player:Interact(EntityID)
Interacts with the Entity. Returns (boolean).
Player:SetFacing(X,Y,Z)
Turns your Player towards the position X,Y,Z. Returns (boolean).
Player:SetFacing(radians)
Turns your Player by radian value. Returns (boolean).
Intelligently navigates the Player towards the position X,Y,Z and stops before reaching that position at **stoppingdistance**. This stoppingdistance argument is optional. This Function uses the navigation mesh to find its path towards the goal.
Moves the Player to the position X,Y,Z and stops before reaching that position at **stoppingdistance**. This stoppingdistance argument is optional. This function does NOT use any mesh navigation. Returns (boolean).
Player:Move(MOVEMENTSTATE)
Moves the Player into the direction of MOVEMENTSTATE. This function does NOT use any mesh navigation. Returns (boolean).
Player:FollowTarget(EntityID)
Uses the ingame "/follow " command on the passed EntityID. Returns (boolean).
Player:Stop()
Stops the Player from any active movement or navigation. Returns (boolean).
Player:IsMoving()
If the Player is currently moving in any direction. Returns (boolean).
Player:IsMoving(MOVEMENTSTATE)
If the Player is currently moving in the MOVEMENTSTATE direction. Returns (boolean).
Player:GetSpeed(MOVEMENTSTATE)
Returns the current Playerspeed into the MOVEMENTSTATE direction (number)..
Player:SetSpeed(MOVEMENTSTATE,number)
Sets the current maximum Playerspeed into the MOVEMENTSTATE direction to **number**..
Player:SetSpeed() no longer supported 12/5/2014 (link)
Player:GetAetheryteList()
Returns a lua table containing a whole list of all Aetherytes.
Player:Teleport(AetheryteID)
Teleports the Player to the Aetheryte with the AetheryteID.
Player:Respawn()
Respawns your Player when you are dead, check the REVIVESTATE before doing that.