Metatable:Creature - RodrigoOt/forgottenserver GitHub Wiki
The Creature metatable contains all of the methods that handle/require creatures.
This metatable is also inherited by the Player, Monster and Npc metatables, therefore they can use these Creature methods.
Creating an instance of the Creature metatable (2 options):
local creature = Creature(uid)
local creature = Creature(name)
###Available methods:
[addCondition(condition[, force = false])](#addCondition{condition[, force = false]})
addHealth(healthChange)
[addMana(manaChange[, animationOnLoss = false])](#addMana{manaChange[, animationOnLoss = false]})
canSee(position)
canSeeCreature(creature)
changeSpeed(delta)
getBaseSpeed()
[getCondition(conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0]])](#getCondition{conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0]]})
getDamageMap()
getDescription(distance)
getDirection()
getFollowCreature()
getHealth()
getId()
getLight()
getMana()
getMaster()
getMaxHealth()
getMaxMana()
getName()
getOutfit()
getParent()
[getPathTo(pos[, minTargetDist = 0[, maxTargetDist = 1[, fullPathSearch = true[, clearSight = true[, maxSearchDist = 0]]]]])](#getPathTo{pos[, minTargetDist = 0[, maxTargetDist = 1[, fullPathSearch = true[, clearSight = true[, maxSearchDist = 0]]]]]})
getPosition()
getSkull()
getSpeed()
getSummons()
getTarget()
getTile()
isCreature()
isHealthHidden()
isInGhostMode()
isItem()
isMonster()
isNpc()
isPlayer()
isRemoved()
isTile()
registerEvent(name)
remove()
[removeCondition(conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0[, force = false]]])](#removeCondition{conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0[, force = false]]]})
[say(text, type[, ghost = false[, target = nil[, position]]])](#say{text, type[, ghost = false[, target = nil[, position]]]})
setDirection(direction)
setDropLoot(doDrop)
setFollowCreature(followedCreature)
setHiddenHealth(hide)
[setLight(color, level)](#setLight{color, level})
setMaster(master)
setMaxHealth(maxHealth)
setOutfit(outfit)
setSkull(skull)
setTarget(target)
[teleportTo(position[, pushMovement = false])](#teleportTo{position[, pushMovement = false]})
unregisterEvent(name)
###### addCondition(condition[, force = false]) > **Description:** N/A > **Parameters:**
- _condition_ - _No description_
- _force_ - _(optional, default: false)_
###### addHealth(healthChange) > **Description:** N/A > **Parameters:**
- _healthChange_ - _No description_
###### addMana(manaChange[, animationOnLoss = false]) > **Description:** N/A > **Parameters:**
- _manaChange_ - _No description_
- _animationOnLoss_ - _(optional, default: false)_
###### canSee(position) > **Description:** N/A > **Parameters:**
- _position_ - _No description_
###### canSeeCreature(creature) > **Description:** N/A > **Parameters:**
- _creature_ - _No description_
###### changeSpeed(delta) > **Description:** N/A > **Parameters:**
- _delta_ - _No description_
###### getBaseSpeed() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getBaseSpeed() ``` > **Added in version:** 1.0
###### getCondition(conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0]]) > **Description:** N/A > **Parameters:**
- _conditionType_ - _No description_
- _conditionId_ - _(optional, default: CONDITIONID_COMBAT)_
- _subId_ - _(optional, default: 0)_
###### getDamageMap() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getDamageMap() ``` > **Added in version:** 1.0
###### getDescription(distance) > **Description:** N/A > **Parameters:**
- _distance_ - _No description_
###### getDirection() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getDirection() ``` > **Added in version:** 1.0
###### getFollowCreature() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getFollowCreature() ``` > **Added in version:** 1.0
###### getHealth() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getHealth() ``` > **Added in version:** 1.0
###### getId() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getId() ``` > **Added in version:** 1.0
###### getLight() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getLight() ``` > **Added in version:** 1.0
###### getMana() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getMana() ``` > **Added in version:** 1.0
###### getMaster() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getMaster() ``` > **Added in version:** 1.0
###### getMaxHealth() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getMaxHealth() ``` > **Added in version:** 1.0
###### getMaxMana() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getMaxMana() ``` > **Added in version:** 1.0
###### getName() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getName() ``` > **Added in version:** 1.0
###### getOutfit() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getOutfit() ``` > **Added in version:** 1.0
###### getParent() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getParent() ``` > **Added in version:** 1.0
###### getPathTo(pos[, minTargetDist = 0[, maxTargetDist = 1[, fullPathSearch = true[, clearSight = true[, maxSearchDist = 0]]]]]) > **Description:** N/A > **Parameters:**
- _pos_ - _No description_
- _minTargetDist_ - _(optional, default: 0)_
- _maxTargetDist_ - _(optional, default: 1)_
- _fullPathSearch_ - _(optional, default: true)_
- _clearSight_ - _(optional, default: true)_
- _maxSearchDist_ - _(optional, default: 0)_
###### getPosition() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getPosition() ``` > **Added in version:** 1.0
###### getSkull() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getSkull() ``` > **Added in version:** 1.0 for players, since 1.1 for any creature
###### getSpeed() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getSpeed() ``` > **Added in version:** 1.0
###### getSummons() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getSummons() ``` > **Added in version:** 1.0
###### getTarget() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getTarget() ``` > **Added in version:** 1.0
###### getTile() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:getTile() ``` > **Added in version:** 1.0
###### isCreature() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isCreature() ``` > **Added in version:** 1.0
###### isHealthHidden() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isHealthHidden() ``` > **Added in version:** 1.0
###### isInGhostMode() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isInGhostMode() ``` > **Added in version:** 1.0
###### isItem() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isItem() ``` > **Added in version:** 1.0
###### isMonster() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isMonster() ``` > **Added in version:** 1.0
###### isNpc() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isNpc() ``` > **Added in version:** 1.0
###### isPlayer() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isPlayer() ``` > **Added in version:** 1.0
###### isRemoved() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:isRemoved() ``` > **Added in version:** 1.0
###### isTile() > **Description:** N/A > **Parameters:** None > **Returns:** false > **Example:** ```Lua local creature = Creature(...) creature:isTile() ``` > **Added in version:** 1.1
###### registerEvent(name) > **Description:** N/A > **Parameters:**
- _name_ - _No description_
###### remove() > **Description:** N/A > **Parameters:** None > **Returns:** N/A > **Example:** ```Lua local creature = Creature(...) creature:remove() ``` > **Added in version:** 1.0
###### removeCondition(conditionType[, conditionId = CONDITIONID_COMBAT[, subId = 0[, force = false]]]) > **Description:** N/A > **Parameters:**
- _conditionType_ - _No description_
- _conditionId_ - _(optional, default: CONDITIONID_COMBAT)_
- _subId_ - _(optional, default: 0)_
- _force_ - _(optional, default: false)_
###### say(text, type[, ghost = false[, target = nil[, position]]]) > **Description:** Test description > **Parameters:**
- _text_ - _Text shown to others._
- _type_ - _Type of text that is shown._
- _ghost_ - _(optional, default: false)_
- _target_ - _(optional, default: nullptr)_
- _position_ - _(optional)_
###### setDirection(direction) > **Description:** N/A > **Parameters:**
- _direction_ - _No description_
###### setDropLoot(doDrop) > **Description:** N/A > **Parameters:**
- _doDrop_ - _No description_
###### setFollowCreature(followedCreature) > **Description:** N/A > **Parameters:**
- _followedCreature_ - _No description_
###### setHiddenHealth(hide) > **Description:** N/A > **Parameters:**
- _hide_ - _No description_
###### setLight(color, level) > **Description:** N/A > **Parameters:**
- _color_ - _No description_
- _level_ - _No description_
###### setMaster(master) > **Description:** N/A > **Parameters:**
- _master_ - _No description_
###### setMaxHealth(maxHealth) > **Description:** N/A > **Parameters:**
- _maxHealth_ - _No description_
###### setOutfit(outfit) > **Description:** N/A > **Parameters:**
- _outfit_ - _No description_
###### setSkull(skull) > **Description:** N/A > **Parameters:**
- _skull_ - _No description_
###### setTarget(target) > **Description:** N/A > **Parameters:**
- _target_ - _No description_
###### teleportTo(position[, pushMovement = false]) > **Description:** N/A > **Parameters:**
- _position_ - _No description_
- _pushMovement_ - _(optional, default: false)_
###### unregisterEvent(name) > **Description:** N/A > **Parameters:**
- _name_ - _No description_