# Actor Management

Before using the Actor API, you need to create an Actor management object as follows:

local Actor = class.Actor.new()

The specific function name and description are as follows:

Serial number Function name Description
1 isPlayer(...) Detect if it's a player
2 isMob(...) Detect if it's a monster
3 getObjType(...) Get actor type: creature / player...)
4 isInAir(...) If it's in the air
5 getPosition(...) Get the location of actor
6 setPosition(...) Set the location of actor
7 jump(...) Jump
8 killSelf(...) Kill yourself
9 getCurPlaceDir(...) Get the current facing direction
10 tryMoveToActor(...) Moving to the target actor
11 tryMoveToPos(...) Move toward target actor
12 addBuff(...) Increase buff
13 hasBuff(...) Whether there is a buff
14 removeBuff(...) Remove buff
15 clearAllBuff(...) Clear all the buffs
16 clearAllBadBuff(...) Clear all the negative buffs
17 getBuffList(...) Get the buff list
18 getBuffLeftTick(...) Get the remaining itck of the current index corresponding buff
19 addHP(...) Increase current HP
20 getHP(...) Get the current HP
21 getMaxHP(...) Get the current maximum HP
22 addOxygen(...) Increase oxygen value
23 getOxygen(...) Obtain oxygen value
24 addEnchant(...) Increase the enchantment of related equipment
25 removeEnchant(...) Remove the enchantment of related equipment
26 findNearestBlock(...) Find blocks nearby
27 setFaceYaw(...) Set perspective lateral offset angle of actor
28 getFaceYaw(...) Get perspective lateral offset angle of actor
29 turnFaceYaw(...) Change the crosswise deviation angle of actor
30 setFacePitch(...) Set the upward angle of actor's view
31 getFacePitch(...) Get the upward angle of actor's view
32 turnFacePitch(...) Change the upward deviation angle of actor
33 playBodyEffect(...) Play the effects
34 stopBodyEffect(...) Stop the effects
35 playBodyEffectByFile(...) Play the file effects
36 stopBodyEffectByFile(...) Stop the file effects
37 playSound(...) Play sound
38 playSoundSpecial(...) Play sound(specific type:GSOUND_TYPE)
39 clearActorWithId(...) Clear the creature's id whose id is actorid
40 setAttackType(...) Set the damage type
41 setImmuneType(...) Set damage immunity type
42 mountActor(...) Get on, off the vehicle
43 setActionAttrState(...) Set the behavior, attribute and state of creature
44 getActionAttrState(...) Obtain status of creature special attribute
45 tryNavigationToPos(...) Find the way to target location
46 randomActorID(...) Create a creature randomly in the resource library
47 getRidingActorObjId(...) Get the Pferd's objid
48 playBodyEffectById(...) Play effect on specified players 1.2+
49 stopBodyEffectById(...) Stop effect on specified players 1.2+
50 setBodyEffectScale(...) Set up effect size on specified players 1.2+
51 playSoundEffectById(...) Play sound effect on specified Actor 1.3+
52 stopSoundEffectById(...) Stop sound effect on specified Actor 1.3+
53 appendSpeed(...) Attach a speed to the actor 1.3+
54 getFaceDirection(...) Get actor orientation 1.3+
55 calcDirectionByDirection(...) x,y,z : number : Coordinate 1.3+
56 calcDirectionByAngle(...) pitch : number : Vertical Offset Angle 1.3+
57 calcDirectionByYawDirection(...) x,y,z : number : Coordinate 1.3+
58 calcDirectionByYawAngle(...) yaw : number : Horizontal Offset Angle 1.3+
59 getEyeHeight(...) objid : number : Unique ID 1.3+
60 getEyePosition(...) objid : number : Unique ID 1.3+
61 getBodySize(...) objid : number : Unique ID 1.3+

# isPlayer

  • Parameters and types:objid
  • Return value and types:
  • The main role of this method: Detect if it's a player
  • The specific use cases are as follows:
local result = Actor:isPlayer(objid)

# isMob

  • Parameters and types:objid
  • Return value and types:
  • The main role of this method: Detect if it's a monster
  • The specific use cases are as follows:
local result = Actor:isMob(objid)

# getObjType

  • Parameters and types:objid
  • Return value and types:
  • The main role of this method: Get actor type: creature / player...)
  • The specific use cases are as follows:
local result = Actor:getObjType(objid)

# isInAir

  • Parameters and types:
  • Return value and types:
  • The main role of this method: If it's in the air
  • The specific use cases are as follows:
local result = Actor:isInAir(objid)

# getPosition

  • Parameters and types:objid
  • Return value and types:
  • The main role of this method: Get the location of actor
  • The specific use cases are as follows:
local result = Actor:getPosition(objid)

# setPosition

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set the location of actor
  • The specific use cases are as follows:
local result = Actor:setPosition(objid, x, y, z)

# jump

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Jump
  • The specific use cases are as follows:
local result = Actor:jump(objid)

# killSelf

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Kill yourself
  • The specific use cases are as follows:
local result = Actor:killSelf(objid)

# getCurPlaceDir

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get the current facing direction
  • The specific use cases are as follows:
local result = Actor:getCurPlaceDir(objid)

# tryMoveToActor

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Moving to the target actor
  • The specific use cases are as follows:
local result = Actor:tryMoveToActor(self_objid, target_objid, speed)

# tryMoveToPos

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Move toward target actor
  • The specific use cases are as follows:
local result = Actor:tryMoveToPos(objid, x, y, z, speed)

# addBuff

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Increase buff
  • The specific use cases are as follows:
local result = Actor:addBuff(objid, buffid, bufflv, customticks)

# hasBuff

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Whether there is a buff
  • The specific use cases are as follows:
local result = Actor:hasBuff(objid, buffid)

# removeBuff

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Remove buff
  • The specific use cases are as follows:
local result = Actor:removeBuff(objid, buffid)

# clearAllBuff

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Clear all the buffs
  • The specific use cases are as follows:
local result = Actor:clearAllBuff(objid)

# clearAllBadBuff

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Clear all the negative buffs
  • The specific use cases are as follows:
local result = Actor:clearAllBadBuff(objid)

# getBuffList

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get the buff list
  • The specific use cases are as follows:
local result = Actor:getBuffList(objid)

# getBuffLeftTick

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get the remaining itck of the current index corresponding buff
  • The specific use cases are as follows:
local result = Actor:getBuffLeftTick(objid, buffid)

# addHP

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Increase current HP
  • The specific use cases are as follows:
local result = Actor:addHP(objid, hp)

# getHP

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get the current HP
  • The specific use cases are as follows:
local result = Actor:getHP(objid)

# getMaxHP

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get the current maximum HP
  • The specific use cases are as follows:
local result = Actor:getMaxHP(objid)

# addOxygen

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Increase oxygen value
  • The specific use cases are as follows:
local result = Actor:addOxygen(objid, oxygen)

# getOxygen

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain oxygen value
  • The specific use cases are as follows:
local result = Actor:getOxygen(objid)

# addEnchant

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Increase the enchantment of related equipment
  • The specific use cases are as follows:
local result = Actor:addEnchant(objid, slot, enchantId, enchantLevel)

# removeEnchant

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Remove the enchantment of related equipment
  • The specific use cases are as follows:
local result = Actor:removeEnchant(objid, slot, enchantId)

# findNearestBlock

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Find blocks nearby
  • The specific use cases are as follows:
local result = Actor:findNearestBlock(objid, blockid, blockRange)

# setFaceYaw

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set perspective lateral offset angle of actor
  • The specific use cases are as follows:
local result = Actor:setFaceYaw(objid, yaw)

# getFaceYaw

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get perspective lateral offset angle of actor
  • The specific use cases are as follows:
local result = Actor:getFaceYaw(objid)

# turnFaceYaw

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Change the crosswise deviation angle of actor
  • The specific use cases are as follows:
local result = Actor:turnFaceYaw(objid, offset)

# setFacePitch

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set the upward angle of actor's view
  • The specific use cases are as follows:
local result = Actor:setFacePitch(objid, pitch)

# getFacePitch

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get the upward angle of actor's view
  • The specific use cases are as follows:
local result = Actor:getFacePitch(objid)

# turnFacePitch

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Change the upward deviation angle of actor
  • The specific use cases are as follows:
local result = Actor:turnFacePitch(objid, offset)

# playBodyEffect

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Play the effects
  • The specific use cases are as follows:
local result = Actor:playBodyEffect(objid, type)

# stopBodyEffect

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Stop the effects
  • The specific use cases are as follows:
local result = Actor:stopBodyEffect(objid, type)

# playBodyEffectByFile

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Play the file effects
  • The specific use cases are as follows:
local result = Actor:playBodyEffectByFile(objid, filename, sync)

# stopBodyEffectByFile

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Stop the file effects
  • The specific use cases are as follows:
local result = Actor:stopBodyEffectByFile(objid, filename)

# playSound

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Play sound
  • The specific use cases are as follows:
local result = Actor:playSound(objid, name, volume, pitch, flag)

# playSoundSpecial

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Play sound(specific type:GSOUND_TYPE)
  • The specific use cases are as follows:
local result = Actor:playSoundSpecial(objid, name, type)

# clearActorWithId

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Clear the creature's id whose id is actorid
  • The specific use cases are as follows:
local result = Actor:clearActorWithId(actorid, bkill)

# setAttackType

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set the damage type
  • The specific use cases are as follows:
local result = Actor:setAttackType(objid, attacktype)

# setImmuneType

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set damage immunity type
  • The specific use cases are as follows:
local result = Actor:setImmuneType(objid, immunetype, isadd)

# mountActor

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get on, off the vehicle
  • The specific use cases are as follows:
local result = Actor:mountActor(objid, mountobjid, posindex)

# setActionAttrState

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set the behavior, attribute and state of creature
  • The specific use cases are as follows:
local result = Actor:setActionAttrState(objid, actionattr, switch)

# getActionAttrState

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain status of creature special attribute
  • The specific use cases are as follows:
local result = Actor:getActionAttrState(objid, actionattr)

# tryNavigationToPos

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Find the way to target location
  • The specific use cases are as follows:
local result = Actor:tryNavigationToPos(objid, x, y, z, cancontrol)

# randomActorID

  • Parameters and types:nil
  • Return value and types:
  • The main role of this method: Create a creature randomly in the resource library
  • The specific use cases are as follows:
local result = Actor:randomActorID()

# getRidingActorObjId

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get the Pferd's objid
  • The specific use cases are as follows:
local result = Actor:getRidingActorObjId(objid)

# playBodyEffectById 1.2+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Play effect on specified players
  • The specific use cases are as follows:
local result = Actor:playBodyEffectById(objid, particleId, scale)

# stopBodyEffectById 1.2+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Stop effect on specified players
  • The specific use cases are as follows:
local result = Actor:stopBodyEffectById(objid, particleId)

# setBodyEffectScale 1.2+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set up effect size on specified players
  • The specific use cases are as follows:
local result = Actor:setBodyEffectScale(objid, particleId, scale)

# playSoundEffectById 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Play sound effect on specified Actor
  • The specific use cases are as follows:
local result = Actor:playSoundEffectById(objid, soundId, volume, pitch, isLoop)

# stopSoundEffectById 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Stop sound effect on specified Actor
  • The specific use cases are as follows:
local result = Actor:stopSoundEffectById(objid, soundId)

# appendSpeed 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Attach a speed to the actor
  • The specific use cases are as follows:
local result = Actor:appendSpeed(objid, x, y, z)

# getFaceDirection 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get actor orientation
  • The specific use cases are as follows:
local result = Actor:getFaceDirection(objid)

# calcDirectionByDirection 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: x,y,z : number : Coordinate
  • The specific use cases are as follows:
local result = Actor:calcDirectionByDirection(objid, vx, vy, vz)

# calcDirectionByAngle 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: pitch : number : Vertical Offset Angle
  • The specific use cases are as follows:
local result = Actor:calcDirectionByAngle(objid, yaw, pitch)

# calcDirectionByYawDirection 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: x,y,z : number : Coordinate
  • The specific use cases are as follows:
local result = Actor:calcDirectionByYawDirection(objid, vx, vy, vz)

# calcDirectionByYawAngle 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: yaw : number : Horizontal Offset Angle
  • The specific use cases are as follows:
local result = Actor:calcDirectionByYawAngle(objid, yaw, pitch)

# getEyeHeight 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: objid : number : Unique ID
  • The specific use cases are as follows:
local result = Actor:getEyeHeight(objid)

# getEyePosition 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: objid : number : Unique ID
  • The specific use cases are as follows:
local result = Actor:getEyePosition(objid)

# getBodySize 1.3+

  • Parameters and types:
  • Return value and types:
  • The main role of this method: objid : number : Unique ID
  • The specific use cases are as follows:
local result = Actor:getBodySize(objid)
Last Update: 11/22/2019, 2:31:59 PM