# Creature management

Derive from Actor

Before using creature API, please create creature management object. The methods as follows:

local Creature = class.Creature.new()

The specific function name and description are as follows:

Serial number Function name Description
1 getAttr(...) Obtain attribute setting of creature
2 setAttr(...) Obtain attribute of creature
3 isAdult(...) Determine whether the creature is an adult
4 setOxygenNeed(...) Set if oxygen is necessary
5 getTamedOwnerID(...) Obtain the ID of tamer
6 setPanic(...) Set whether it is in panic
7 setAIActive(...) Set if AI takes effect
8 getActorID(...) Obtain actor ID of creature
9 getActorName(...) Obtain the name of creature
10 addModAttrib(...) Increase the attribute of model set
11 getModAttrib(...) Obtain the attribute of model set
12 setTeam(...) Set the creature team
13 getTeam(...) Set the creature team
14 getMaxFood(...) Get max satiety
15 getFood(...) Get satiety
16 setFood(...) Set satiety
17 getHpRecover(...) HP recovery
18 getMaxOxygen(...) Max oxygen volume
19 getWalkSpeed(...) Walking speed
20 getSwimSpeed(...) Swimming speed(in water)
21 getJumpPower(...) Jump force
22 getMass(...) Weight
23 getDodge(...) Dodge
24 getPunchAttack(...) Melee attack
25 getRangeAttack(...) Ranged attack
26 getPunchDefense(...) Melee defense
27 getRangeDefense(...) Ranged defense
28 setMaxHp(...) Set HP
29 setHP(...) Set HP
30 setHpRecover(...) Set HP recovery
31 setOxygen(...) Set oxygen
32 setWalkSpeed(...) Set walking speed
33 setSwimSpeed(...) Set swimming speed(in water)
34 setJumpPower(...) Set the jump force
35 setDodge(...) Set dodging
36 setPunchAttack(...) Set melee attack
37 setRangeAttack(...) Set ranged attack
38 setPunchDefense(...) Set melee defense
39 setRangeDefense(...) Set ranged defense

# getAttr

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain attribute setting of creature
  • The specific use cases are as follows:
--The player clicks on the creature,and the chat box displays the creature's attributes
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the specified attribute of the specified creature
	--The first parameter is the id of the creature in the archive to get the attribute
	--The second parameter is the attribute to be obtained,2 is the current health value,which can be viewed in "Biometric Attribute Enumeration" of "Game Data Type"
	local result,value=Creature:getAttr(event.toobjid,2)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." The current life value is:"..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setAttr

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain attribute of creature
  • The specific use cases are as follows:
--The player clicks on the creature to set the creature's attributes
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the specified attributes of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the attribute to be set,1 is the maximum health value,which can be viewed in "Biometric Attribute Enumeration" of "Game Data Type"
	--The third parameter is the value to be set
	Creature:setAttr(event.toobjid,1,999)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the maximum health value is set to 999")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# isAdult

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Determine whether the creature is an adult
  • The specific use cases are as follows:
--The player clicks on the creature,and the chat box shows whether the creature is an adult
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--To determine whether a creature is an adult,the parameter is the id of the creature in the archive
	local result=Creature:isAdult(event.toobjid)
	if result==0 then--if grown up
		--Show in chat box
		Chat:sendSystemMsg("The creature with objid "..event.toobjid.." is an adult")
	else--if minor
		--Show in chat box
		Chat:sendSystemMsg("objid is "..event.toobjid.." biological underage")
	end
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setOxygenNeed

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set if oxygen is necessary
  • The specific use cases are as follows:
--The player clicks on the creature to set whether the creature needs oxygen generation
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set whether the creature needs oxygen
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is whether oxygen is needed:true needs false does not need
	Creature:setOxygenNeed(event.toobjid,false)
	--Show in chat box
	Chat:sendSystemMsg("The creature with objid "..event.toobjid.." is set to survive without oxygen")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getTamedOwnerID

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain the ID of tamer
  • The specific use cases are as follows:
--The player clicks on the creature,the chat box displays the creature owner
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get whether the specified creature is tamed and by whom
	local result,uin=Creature:getTamedOwnerID(event.toobjid)
	if uin==0 then--if not tamed
		--Show in chat box
		Chat:sendSystemMsg("The creature with objid "..event.toobjid.." has not been tamed")
	else--if tamed
		--Show in chat box
		Chat:sendSystemMsg("The creature with objid "..event.toobjid.."was being player"..uin.."tamed")
	end
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setPanic

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set whether it is in panic
  • The specific use cases are as follows:
--The player clicks on the creature to set whether the creature panics
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set whether the creature is panicking
	--The first parameter is the id of the creature in the archive
	--The second parameter is whether you are panicking:true is false or not
	Creature:setPanic(event.toobjid,true)
	--Show in chat box
	Chat:sendSystemMsg("The creature with objid "..event.toobjid.." is set to panic")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setAIActive

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set if AI takes effect
  • The specific use cases are as follows:
--The player clicks on the creature to set whether the creature AI is effective
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set whether biological AI is effective
	--The first parameter is the id of the creature in the archive
	--The second parameter is whether AI is effective:true is false or not
	Creature:setAIActive(event.toobjid,false)
	--Show in chat box
	Chat:sendSystemMsg("Bird AI with objid "..event.toobjid.." is set to not take effect")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getActorID

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain actor ID of creature
  • The specific use cases are as follows:
--The player clicks on the creature and displays the creature id in the chat box
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the biological id of the specified creature,the parameter is the id of the creature in the archive
	local result,actorid=Creature:getActorID(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." Creature id in the current archive is:"..actorid)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getActorName

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain the name of creature
  • The specific use cases are as follows:
--The player clicks on the creature and displays the creature's name in the chat box
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the creature name of the specified creature,the parameter is the id of the creature in the archive
	local result,name=Creature:getActorName(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the name of the creature is:"..name)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# addModAttrib

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Increase the attribute of model set
  • The specific use cases are as follows:
--The player clicks on the creature to increase the buff attribute of the clicked creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Increase the buff attribute of the specified creature
	--The first parameter is the id of the creature whose attribute is to be added in the archive
	--The second parameter is the enchantment attribute to be added,0 is the movement speed,you can check it in "Enchantment Attribute Type" of "Game Data Type"
	--The third parameter is the value to be added
	Creature:addModAttrib(event.toobjid,0,1)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature movement speed enchantment level is increased by 1")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getModAttrib

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Obtain the attribute of model set
  • The specific use cases are as follows:
--The player clicks on the creature,the chat box displays the creature buff attribute
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the buff attribute value of the specified creature
	--The first parameter is the id of the creature in the archive to get the attribute
	--The second parameter is the enchantment attribute to be obtained,0 is the movement speed,you can check it in "Enchantment Attribute Type" of "Game Data Type"
	local result,value=Creature:getModAttrib(event.toobjid,0)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature's movement speed enchantment level is:"..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setTeam

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set the creature team
  • The specific use cases are as follows:
--Players click on creatures to set up creature teams
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the team to which the creature belongs
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the team id to be set
	Creature:setTeam(event.toobjid,1)
	--Show in chat box
	Chat:sendSystemMsg("The creature with objid "..event.toobjid.." is set to Team 1")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getTeam

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set the creature team
  • The specific use cases are as follows:
--The player clicks on the creature to get the creature team
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the team that the specified creature belongs to,the parameter is the id of the creature to get in the archive
	local result,teamid=Creature:getTeam(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the team of the creature belongs to:"..teamid)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getMaxFood

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get max satiety
  • The specific use cases are as follows:
--The player clicks on the creature to get the creature's maximum hunger
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the maximum hunger of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getMaxFood(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the maximum hunger of the creature is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getFood

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Get satiety
  • The specific use cases are as follows:
--The player clicks on the creature to get the creature's current hunger
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the current hunger of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getFood(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the creature's current hunger is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setFood

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set satiety
  • The specific use cases are as follows:
--The player clicks on the creature to set the creature's current hunger
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the current hunger of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setFood(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the current hunger of the creature is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getHpRecover

  • Parameters and types:
  • Return value and types:
  • The main role of this method: HP recovery
  • The specific use cases are as follows:
--Players click on creatures to get creature HP recovery
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the HP recovery of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getHpRecover(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." Creature HP is restored to "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getMaxOxygen

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Max oxygen volume
  • The specific use cases are as follows:
--The player clicks on the creature to get the maximum oxygen value of the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the maximum oxygen value of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getMaxOxygen(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." biological maximum oxygen value is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getWalkSpeed

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Walking speed
  • The specific use cases are as follows:
--The player clicks on the creature to get the walking speed of the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the walking speed of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getWalkSpeed(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." Creature walking speed is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getSwimSpeed

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Swimming speed(in water)
  • The specific use cases are as follows:
--The player clicks on the creature to get the creature's swimming speed
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the swimming speed of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getSwimSpeed(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature swimming speed is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getJumpPower

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Jump force
  • The specific use cases are as follows:
--The player clicks on the creature to gain the creature's jumping power
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the jumping power of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getJumpPower(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature jumping force is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getMass

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Weight
  • The specific use cases are as follows:
--The player clicks on the creature to get the weight of the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the weight of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getMass(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid..",the biological weight is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getDodge

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Dodge
  • The specific use cases are as follows:
--Players click on creatures to get creature dodge value
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the dodge value of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getDodge(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature dodge value is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getPunchAttack

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Melee attack
  • The specific use cases are as follows:
--Players click on creatures to get melee attacks
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the melee attack of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getPunchAttack(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." Creature melee attack is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getRangeAttack

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Ranged attack
  • The specific use cases are as follows:
--The player clicks on the creature to get a remote attack from the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the remote attack of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getRangeAttack(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." Creature remote attack is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getPunchDefense

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Melee defense
  • The specific use cases are as follows:
--Players click on creatures to gain creature melee defense
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the melee defense of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getPunchDefense(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." Creature melee defense is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# getRangeDefense

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Ranged defense
  • The specific use cases are as follows:
--Players click on creatures to gain creature long-range defense
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Get the long-range defense of the specified creature,the parameter is the id of the creature to be obtained in the archive
	local result,value=Creature:getRangeDefense(event.toobjid)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." Creature long-range defense is "..value)
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setMaxHp

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set HP
  • The specific use cases are as follows:
--The player clicks on the creature to set the creature's maximum health
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the maximum health of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setMaxHp(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("The creature with objid "..event.toobjid.." has its maximum health set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setHP

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set HP
  • The specific use cases are as follows:
--The player clicks the creature to set the creature's current health
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the current health value of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setHP(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the current health value of the creature is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setHpRecover

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set HP recovery
  • The specific use cases are as follows:
--The player clicks the creature to set the creature's life recovery
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the life recovery of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setHpRecover(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("obj."..event.toobjid.." creature's life recovery is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setOxygen

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set oxygen
  • The specific use cases are as follows:
--The player clicks the creature to set the oxygen value of the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the oxygen value of the specified organism
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setOxygen(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." biological oxygen value is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setWalkSpeed

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set walking speed
  • The specific use cases are as follows:
--The player clicks the creature to set the walking speed of the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the walking speed of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setWalkSpeed(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature's walking speed is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setSwimSpeed

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set swimming speed(in water)
  • The specific use cases are as follows:
--The player clicks on the creature to set the creature's swimming speed
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the swimming speed of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setSwimSpeed(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature's swimming speed is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setJumpPower

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set the jump force
  • The specific use cases are as follows:
--The player clicks on the creature to set the jumping power of the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the jumping power of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setJumpPower(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." the jumping power of the creature is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setDodge

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set dodging
  • The specific use cases are as follows:
--The player clicks the creature to set the dodge value of the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the dodge value of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setDodge(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("obj."..event.toobjid.." creature's dodge value is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setPunchAttack

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set melee attack
  • The specific use cases are as follows:
--The player clicks on the creature to set the creature's melee attack
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set melee attacks for specified creatures
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setPunchAttack(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("The melee attack of the creature with objid"..event.toobjid.." is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setRangeAttack

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set ranged attack
  • The specific use cases are as follows:
--The player clicks on a creature to set up a remote attack on the creature
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the remote attack of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setRangeAttack(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("obj."..event.toobjid.." creature's long range attack is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setPunchDefense

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set melee defense
  • The specific use cases are as follows:
--The player clicks the creature to set the creature's melee defense
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the melee defense of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setPunchDefense(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("The melee defense of the creature with objid"..event.toobjid.." is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)

# setRangeDefense

  • Parameters and types:
  • Return value and types:
  • The main role of this method: Set ranged defense
  • The specific use cases are as follows:
--The player clicks on the creature to set the creature's long-range defense
--This function will be executed when the creature is clicked
local function Player_ClickActor(event)
	--Set the long-range defense of the specified creature
	--The first parameter is the id of the creature to be set in the archive
	--The second parameter is the value to be set
	Creature:setRangeDefense(event.toobjid,100)
	--Show in chat box
	Chat:sendSystemMsg("objid is "..event.toobjid.." creature's range defense is set to 100")
end
--Register the listener,execute Player_ClickActor function when clicking the creature
ScriptSupportEvent:registerEvent([=[Player.ClickActor]=],Player_ClickActor)
Last Update: 6/11/2020, 9:30:46 PM