Skip to content
Andrew Teets edited this page Jan 12, 2015 · 17 revisions

Player

  • 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 playername
d(Player.name)
-- print out the player position table
d(Player.pos)

Additional Player Object Attributes

hasaggro
Returns if your Player is being aggroed by an Enemy (boolean).
revivestate
Returns the REVIVESTATEof the Player (number).
localmapid
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 name
local mytarget = Player:GetTarget()
if ( mytarget ) then d(mytarget.name) end

-- Using the build in navigation to move towards the mytarget we just got
if ( mytarget) then
   local pos = mytarget.pos
   Player: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).
Player:MoveTo(X,Y,Z, stoppingdistance, followmovement, randomizePaths)
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.
-- Returned Values:
Positive Values:
0 to 9999999: Successfully created a navigation path on the Navmesh towards the goal.
The number returned represents the remaining points along the path.

Negative Values:
-1 to -10: Different errorcodes, a path could not be created towards the goal.
-7: Distance to Goal is smaller than the passed stoppingdistance
-8: No Navmesh loaded / Navmesh is beeing build or not ready yet 
-10: The passed MoveTo coordinates are invalid
Player:MoveToStraight(X,Y,Z,stoppingdistance)
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.
Player:GetFishingState()
Returns the current FISHINGSTATE of the Player.
Player:GetBait()
Returns the ItemID of the currently selected Bait.
Player:SetBait(itemID)
Sets the currently selected Bait to the itemID. Returns (boolean)
Player:Gather(EntityID)
Gathers the passed Entity. Returns (boolean)
Player:GetGatherableSlotList()
Returns a lua table which contains a list of all Gatherable Items you can select from (The usual 8 Items you can select from). Returns (boolean)
Player:GetSyncLevel()
Returns the currently synced playerlevel for fates, if not synced, returns 0. (number)
Player:SyncLevel()
Syncs the Playerlevel to the current Fatelevel.
Clone this wiki locally