This method is pretty heavy (excessive usage might be affecting performance)
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 horizontallyfor _, spectator inipairs(spectators) do-- iterates over all spectators and prints their typeprint(type(spectator)) -- prints userdataend
Game.getPlayers()
local players = Game.getPlayers()print(#players) -- prints players onlinefor _, player inipairs(players) do-- iterate through players online and print their namesprint(player:getName()end
Game.loadMap()
path
Game.loadMap("/data/world/map.otbm")
Game.getExperienceStage()
level
local experienceStage = Game.getExperienceStages(100)print(experienceStage) -- prints current experience stage for level 100
Game.getMonstersCount()
local monstersCount = Game.getMonstersCount()print(monstersCount) -- prints number of alive monsters
Game.getPlayersCount()
local playersCount = Game.getPlayersCount()print(playersCount) -- prints number of players online
Game.getNpcCount()
local npcCount = Game.getNpcCount()print(npcCount) -- prints number of npcs
Game.getMonsterTypes()
local monsterTypes = Game.getMonsterTypes()for _, monsterType inipairs(monsterTypes) do-- iterates through monster types and prints their namesprint(monsterType:getName())end
Game.getTowns()
local towns = Game.getTowns()for _, townin ipairs(towns) do-- iterates through towns and prints their namesprint(town:getName()) TODO FIND THE METHODend
Game.getHouses()
local houses = Game.getHouses()for _, house inipairs(houses) do-- iterates through houses and prints their owners guidprint(house:getOwnerGuid())end
Game.getGameState()
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
Game.setGameState()
state
Game.setGameState(GAME_STATE_NORMAL) -- sets game state to state normal
Game.getWorldType()
local worldType = Game.getWorldType()print(worldType) -- prints currently set world type ex. WORLD_TYPE_PVP
Game.setWorldType()
worldType
Game.setWorldType(WORLD_TYPE_NO_PVP) -- sets current world type to non pvp
Game.getReturnMessage()
returnValue
local player =Player(...)if player thenlocal returnMessage = Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE)print(returnMessage) -- prints Sorry not possible. player:sendCancelMessage(returnMessage)end
Game.createItem()
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 containercontainer:addItemEx(item)-- or delete it to avoid memory leakitem:remove()item = Game.createItem(2160, 1, Position(1001, 1000, 7)print(item:getPosition().x) -- prints 1001
Game.createContainer()
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 containercontainer:addItemEx(container)-- or delete it to avoid memory leakcontainer:remove()container = Game.createContainer(2160, 10, Position(1001, 1000, 7)print(container:getPosition().x) -- prints 1001
Game.createMonster()
monsterName, position[, extended = false[, force = false]]
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
local monster = Game.createMonster("rat", Position(1000, 1000, 7), false, true)if monster thenprint(monster:getId()) -- prints monster unique idend
Game.createNpc()
npcName, position[, extended = false[, force = false]]
local npc = Game.createNpc("Nekiro", Position(1000, 1000, 7), false, true)if npc thenprint(npc:getId()) -- prints npc unique idend
Game.createTile()
x, y, z[, isDynamic = false]
position[, isDynamic = false]
Dynamic tiles can store items and creatures, in most cases walkable one. (They take more memory too)
local tile = Game.createTile(1001, 1000, 7, false)-- or Game.createTile(Position(1001, 1000, 7), false)if tile thenprint(tile:getPosition().x) -- prints 1001end
Game.createMonsterType()
name
This method can overwrite already created monster types and clear their loot and spells
local newMonsterType = Game.createMonsterType("SpecialRat")-- creates new (or overwrites if exists) monster typeif newMonsterType thenprint(newMonsterType:getName()) -- prints SpecialRatend
Game.startRaid()
raidName
This method might get soon deprecated in favor of raid system written in Lua
Game.startRaid("RatsThais") -- starts raid with name RatsThais
Game.getClientVersion()
local clientVersion = Game.getClientVersion()print(clientVersion) -- prints table: 0x93ff90-- prints min and max allowed client version and version stringprint(clientVersion.min, clientVersion.max, clientVersion.string)
Game.reload()
reloadType
Game.reload(RELOAD_TYPE_GLOBAL) -- reloads all libsGame.reload(RELOAD_TYPE_ACTIONS) -- reloads all actions-- and so on...