- Game.getSpectators()
- Game.getPlayers()
- Game.loadMap()
- Game.getExperienceStage()
- Game.getMonstersCount()
- Game.getPlayersCount()
- Game.getNpcCount()
- Game.getMonsterTypes()
- Game.getTowns()
- Game.getHouses()
- Game.getGameState()
- Game.setGameState()
- Game.getWorldType()
- Game.setWorldType()
- Game.getReturnMessage()
- Game.createItem()
- Game.createContainer()
- Game.createMonster()
- Game.createNpc()
- Game.createTile()
- Game.createMonsterType()
- Game.startRaid()
- Game.getClientVersion()
- Game.reload()
{% hint style="success" %} Parameters in square brackets "[parameter]" are optional
and their default value is specified after the name e.g "= false" {% endhint %}
position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]]
{% hint style="danger" %} This method is pretty heavy (excessive usage might be affecting performance) {% endhint %}
local position = Position(1000, 1000, 7)
local spectators = Game.getSpectators(position, false, true, 10, 10, 10, 10)
-- get all spectators from position in radius of 10 vertically and horizontally
for _, spectator in ipairs(spectators) do
-- iterates over all spectators and prints their type
print(type(spectator)) -- prints userdata
end
local players = Game.getPlayers()
print(#players) -- prints players online
for _, player in ipairs(players) do
-- iterate through players online and print their names
print(player:getName()
end
path
Game.loadMap("/data/world/map.otbm")
level
local experienceStage = Game.getExperienceStages(100)
print(experienceStage) -- prints current experience stage for level 100
local monstersCount = Game.getMonstersCount()
print(monstersCount) -- prints number of alive monsters
local playersCount = Game.getPlayersCount()
print(playersCount) -- prints number of players online
local npcCount = Game.getNpcCount()
print(npcCount) -- prints number of npcs
local monsterTypes = Game.getMonsterTypes()
for _, monsterType in ipairs(monsterTypes) do
-- iterates through monster types and prints their names
print(monsterType:getName())
end
local towns = Game.getTowns()
for _, townin ipairs(towns) do
-- iterates through towns and prints their names
print(town:getName()) TODO FIND THE METHOD
end
local houses = Game.getHouses()
for _, house in ipairs(houses) do
-- iterates through houses and prints their owners guid
print(house:getOwnerGuid())
end
local gameState = Game.getGameState()
if gameState == GAME_STATE_CLOSED then
-- checks if server is closed, if it's then open it
Game.setGameState(GAME_STATE_NORMAL)
end
state
Game.setGameState(GAME_STATE_NORMAL) -- sets game state to state normal
local worldType = Game.getWorldType()
print(worldType) -- prints currently set world type ex. WORLD_TYPE_PVP
worldType
Game.setWorldType(WORLD_TYPE_NO_PVP) -- sets current world type to non pvp
returnValue
local player = Player(...)
if player then
local returnMessage = Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE)
print(returnMessage) -- prints Sorry not possible.
player:sendCancelMessage(returnMessage)
end
itemId[, count[, position]]
local item = Game.createItem(2160)
print(item) -- prints memory address
-- at this point item was created, but not added to anywhere, so it's stored in memory
-- either add it to any container
container:addItemEx(item)
-- or delete it to avoid memory leak
item:remove()
item = Game.createItem(2160, 1, Position(1001, 1000, 7)
print(item:getPosition().x) -- prints 1001
itemId, size[, position]
local container = Game.createContainer(1987, 10)
print(container) -- prints memory address
-- at this point container was created, but not added to anywhere, so it's stored in memory
-- either add it to any container
container:addItemEx(container)
-- or delete it to avoid memory leak
container:remove()
container = Game.createContainer(2160, 10, Position(1001, 1000, 7)
print(container:getPosition().x) -- prints 1001
monsterName, position[, extended = false[, force = false]]
{% hint style="info" %} extended means monster can be spawned in area near the specified position
force means monster will be always spawned in specified position, even if position is blocked {% endhint %}
local monster = Game.createMonster("rat", Position(1000, 1000, 7), false, true)
if monster then
print(monster:getId()) -- prints monster unique id
end
npcName, position[, extended = false[, force = false]]
local npc = Game.createNpc("Nekiro", Position(1000, 1000, 7), false, true)
if npc then
print(npc:getId()) -- prints npc unique id
end
x, y, z[, isDynamic = false]
position[, isDynamic = false]
{% hint style="info" %} Dynamic tiles can store items and creatures, in most cases walkable one. (They take more memory too) {% endhint %}
local tile = Game.createTile(1001, 1000, 7, false)
-- or Game.createTile(Position(1001, 1000, 7), false)
if tile then
print(tile:getPosition().x) -- prints 1001
end
name
{% hint style="danger" %} This method can overwrite already created monster types and clear their loot and spells {% endhint %}
local newMonsterType = Game.createMonsterType("SpecialRat")
-- creates new (or overwrites if exists) monster type
if newMonsterType then
print(newMonsterType:getName()) -- prints SpecialRat
end
raidName
{% hint style="warning" %} This method might get soon deprecated in favor of raid system written in Lua {% endhint %}
Game.startRaid("RatsThais") -- starts raid with name RatsThais
local clientVersion = Game.getClientVersion()
print(clientVersion) -- prints table: 0x93ff90
-- prints min and max allowed client version and version string
print(clientVersion.min, clientVersion.max, clientVersion.string)
reloadType
Game.reload(RELOAD_TYPE_GLOBAL) -- reloads all libs
Game.reload(RELOAD_TYPE_ACTIONS) -- reloads all actions
-- and so on...