Skip to content

MonsterType

MonsterType Class

The MonsterType class provides static information about monster types.

Constructor

MonsterType(name)

Basic Properties

MethodReturnsDescription
getName()stringMonster name
getNameDescription()stringName description
getExperience()numberExperience given
getHealth()numberBase health
getMaxHealth()numberMaximum health
getCombatImmunities()numberCombat immunities
getConditionImmunities()numberCondition immunities
getRunHealth()numberHealth to flee
getBaseSpeed()numberBase speed
getLight()level, colorLight info
local mt = MonsterType("Dragon")
if mt then
print("Name: " .. mt:getName())
print("HP: " .. mt:getHealth())
print("Exp: " .. mt:getExperience())
end

Classification

MethodReturnsDescription
isBoss()booleanIs boss
isRewardBoss()booleanIs reward boss
isConvinceable()booleanCan be convinced
isSummonable()booleanCan be summoned
isIllusionable()booleanCan be illusioned
isHostile()booleanIs hostile
isPushable()booleanCan be pushed
isHealthHidden()booleanHealth hidden
canPushItems()booleanPushes items
canPushCreatures()booleanPushes creatures
canWalkOnEnergy()booleanWalks on energy
canWalkOnFire()booleanWalks on fire
canWalkOnPoison()booleanWalks on poison

Combat

MethodReturnsDescription
getAttackList()tableAttack spells
getDefenseList()tableDefense spells
getTargetDistance()numberTarget distance
getStaticAttackChance()numberAttack chance
getChangeTargetChance()numberRetarget chance
getChangeTargetSpeed()numberRetarget speed
getArmor()numberArmor value
getDefense()numberDefense value

Appearance

MethodReturnsDescription
getOutfit()OutfitMonster outfit
getRace()numberRace type
getCorpseId()numberCorpse item ID

Loot

MethodReturnsDescription
getLoot()tableLoot table
addLoot(loot)-Add loot
local loot = mt:getLoot()
for _, item in ipairs(loot) do
print(item.itemId, item.chance)
end

Summons

MethodReturnsDescription
getSummonList()tableSummon list
getMaxSummons()numberMax summons

Elements

MethodReturnsDescription
getElementList()tableElement modifiers

Creation

MethodReturnsDescription
createLoot(position)tableCreate loot items
createLootContainer(position)ContainerCreate loot container

Examples

Monster Info

local function getMonsterInfo(name)
local mt = MonsterType(name)
if not mt then
return nil
end
return {
name = mt:getName(),
health = mt:getHealth(),
experience = mt:getExperience(),
hostile = mt:isHostile(),
boss = mt:isBoss()
}
end

Check Immunities

local function isImmuneToFire(monsterType)
local immunities = monsterType:getCombatImmunities()
return bit.band(immunities, COMBAT_FIREDAMAGE) ~= 0
end