Description: Send message to all players Parameters: Returns: Nothing Example:1local message = 'Hello'2local messageType = MESSAGE_STATUS_DEFAULT3Game.broadcastMessage(message, messageType)Copied!Added in version: 1.0
Description: Convert numeric representation of IPv4 to string with dot separated octets Parameters: Returns: String Example:1function Player:onLook(thing, position, distance)2if thing:isCreature() then3if thing:isPlayer() then4local playerIp = thing:getIp()5local ip = Game.convertIpToString(playerIp)6local description = string.format("IP: [%s].", ip)7end8end9self:sendTextMessage(MESSAGE_INFO_DESCR, description)10return true11endCopied!Added in version: 1.0
Description: Creates an item. Parameters: Returns: The item created. (userdata) Example:1-- Create an item somewhere on the map.2local item = Game.createItem(2400, 1, Position(100, 100, 7))3--4-- Create a temporary item that is given to a player (if it isn't moved from creation it will be deleted)5local player = Player(...)6player:addItemEx(Game.createItem(2400, 1))Copied!Added in version: 1.0
Description: Creates a container with given size. Parameters: Returns: The container created. (userdata) Example:1-- Create an amulet of loss as a container with size 5 at position: x 100, y 100, z 7.2local item = Game.createContainer(ITEM_AMULETOFLOSS, 5, Position(100, 100, 7))3--4-- Create a temporary container that is given to a player (if it isn't moved from creation it will be deleted)5local player = Player(...)6player:addItemEx(Game.createContainer(ITEM_AMULETOFLOSS, 5))Copied!Added in version: 1.1
Description: Creates a monster. Parameters: Returns: The monster created. (userdata) Example:1-- This should always create this monster.2local monster = Game.createMonster("demon", Position(100, 100, 7), false, true)3if not monster then4-- Something went wrong?5endCopied!Added in version: 1.0
Description: Creates a npc. Parameters: Returns: The npc created. (userdata) Example:1-- This may possibly not create the npc.2local npc = Game.createMonster("some npc", Position(100, 100, 7), false, false)3if not npc then4-- Something is probably blocking that position and around it aswell5endCopied!Added in version: 1.0
Description: Creates a tile if it can. Parameters: Returns: The tile created or the previous existing one. (userdata) Example:1local tile = Game.createTile(100, 100, 7)2local ground = tile:getGround()3if ground then4print(ground:getName())5endCopied!Added in version: 1.0
Description: Creates a tile if it can. Parameters: Returns: The tile created or the previous existing one. (userdata) Example:1local tile = Game.createTile(Position(100, 100, 7))2local ground = tile:getGround()3if ground then4print(ground:getName())5endCopied!Added in version: 1.0
Description: Find the experience rate related to a certain level. Parameters: Returns: The experience rate related to the specified level. Example:1-- Print the experience rate for level 8 to the console2print(Game.getExperienceStage(8))Copied!Added in version: 1.0
Description: Gets the current gamestate. Parameters: None Returns: Current gamestate on the server. Example:1print(Game.getGameState())Copied!Added in version: 1.0
Description: Get all houses. Parameters: None Returns: A table containing all houses (userdata). Example:1-- This prints the names of all houses that exist on the server2local houses = Game.getHouses()3for i = 1, #houses do4print(houses[i]:getName())5endCopied!Added in version: 1.0
Description: Find the total amount of monsters on the server. Parameters: None Returns: Total amount of monsters on the server. Example:1print(Game.getMonsterCount())Copied!Added in version: 1.0
Description: Find the total amount of npcs on the server. Parameters: None Returns: Total amount of npcs on the server. Example:1print(Game.getNpcCount())Copied!Added in version: 1.0
Description: Find the total amount of players on the server. Parameters: None Returns: Total amount of players on the server. Example:1print(Game.getPlayerCount())Copied!Added in version: 1.0
Description: Get all connected players. Parameters: None Returns: A table containing all connected players (userdata). Example:1-- This prints the names of all players connected to the server2local players = Game.getPlayers()3for i = 1, #players do4print(players[i]:getName())5endCopied!Added in version: 1.0
Description: Gets a message associated with the value. Parameters: Returns: true Example:1-- This makes no sense but its an example.2local player = Player(...)3player:say(Game.getReturnMessage(RETURNVALUE_YOUARENOTTHEOWNER), TALKTYPE_SAY)Copied!Added in version: 1.0
Description: Gets reversed direction. Parameters: Returns: Direction (integer) Example:1local direction = DIRECTION_NORTH2local reversedDirection = Game.getReverseDirection(direction)3print('Numerical value of SOUTH direction is equel '.. tostring(reversedDirection))Copied!Added in version: 1.0
Description: Gets skill type associatet with weapon type. Parameters: Returns: Skill type (integer) Example:1local itemtype = ItemType(...)2local weaponType = itemtype:getWeaponType()3local skillType = Game.getSkillType(weaponType)Copied!Added in version: 1.0
Description: Get all creatures in the area. Parameters: Returns: A table containing creatures found (userdata). Example:1-- This finds all players in a 5x5 area around (100, 100, 7)2local spectators = Game.getSpectators(Position(100, 100, 7), false, true, 0, 2, 0, 2)3for i = 1, #spectators do4local spectator = spectators[i]5spectator:say(spectator:getName(), TALKTYPE_SAY)6endCopied!Added in version: 1.0
Description: Get value from globalStorageTable Parameters: Returns: Value from table on empty index nil value Example:1local storage = Game.getStorageValue(1)2print(tostring(storage))Copied!Added in version: 1.0
Description: Get all towns. Parameters: None Returns: A table containing all towns (userdata). Example:1-- This prints the names of all towns that exist on the server2local towns = Game.getTowns()3for i = 1, #towns do4print(towns[i]:getName())5endCopied!Added in version: 1.0
Description: Gets the current world type. Parameters: None Returns: Current gamestate on the server. Example:1print(Game.getWorldType())Copied!Added in version: 1.0
Description: This loads a new map chunk. Parameters: Returns: Nothing Example:1Game.loadMap("data/map/some_other_map.otbm")Copied!Added in version: 1.0
Description: Sets the current gamestate. Parameters: Returns: true Example:1-- Shutdown the server2Game.setGameState(GAME_STATE_SHUTDOWN)Copied!Added in version: 1.0
Description: Insert value into globalStorageTable on specific key Parameters: Returns: Nothing Example:1Game.setStorageValue(1, 1000)Copied!Added in version: 1.0
Description: Sets the current world type. Parameters: Returns: true Example:1-- Change to hardcore pvp2Game.setWorldType(WORLD_TYPE_PVP_ENFORCED)Copied!Added in version: 1.0
Description: Starts a raid if one with said name exist. Parameters: Returns: true if the raid started, nil otherwise. Example:1if Game.startRaid("test") then2-- Raid was started.3endCopied!Added in version: 1.0
Description: This function is used to run other functions at a later time. Parameters: Returns: The id associated with this event. Example:1-- Creates an event that prints "Hello World!" to the console.2addEvent(print, 1000, "Hello World!")Copied!Added in version: 1.0
Description: This function is used to stop functions that should run later. Parameters: Returns: true if an event was stopped, false otherwise. Example:1-- Creates an event that should print "Hello World!" but it's stopped before that can happen.2local event = addEvent(print, 1000, "Hello World!")3stopEvent(event)Copied!Added in version: 1.0
Description: Returns the Unix time (epoch) in milliseconds Parameters: None Returns: The Unix time (epoch) in milliseconds Example:1print(os.mtime() .. " milliseconds have passed since the Unix epoch")Copied!Added in version: 1.0
Description: Creates a new table with specified length. Parameters: Returns: The created table. Example:1local t = table.create(5, 0)2for i = 1, #t do3t[i] = i + 14endCopied!Added in version: 1.0