• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[TFS 1.0 / 1.2] LUA Functions

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
all tfs 1.0 lua functions sorted alphabetically, excluding metamethods
Code:
addDamageCondition(condition, rounds, time, value)
addEvent(callback, delay, ...)
addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
broadcastMessage(message, type)
canPlayerLearnInstantSpell(cid, name)
canPlayerWearOutfit(cid, lookType, addons)
cleanMap()
createCombatArea( {area}, <optional> {extArea} )
createCombatObject()
createConditionObject(type)
Creature.getClosestFreePosition(self, position, extended)
debugPrint(text)
doAddCondition(cid, condition)
doAddContainerItem(uid, itemid, <optional> count/subtype)
doAddContainerItemEx(uid, virtualId)
doAddMapMark(cid, pos, type, description)
doAreaCombatCondition(cid, pos, area, condition, effect)
doAreaCombatDispel(cid, pos, area, type, effect)
doAreaCombatHealth(cid, type, pos, area, min, max, effect)
doAreaCombatMana(cid, pos, area, min, max, effect)
doChallengeCreature(cid, target)
doChangeSpeed(cid, delta)
doChangeTypeItem(uid, newtype)
doCombat(cid, combat, param)
doConvinceCreature(cid, target)
doCreateItem(itemid, type/count, pos)
doCreateItemEx(itemid, <optional> count/subtype)
doCreateNpc(name, pos)
doCreateTeleport(itemid, topos, createpos)
doCreatureAddHealth(cid, health)
doCreatureChangeOutfit(cid, outfit)
doCreatureSay(cid, text, type, ...)
doCreatureSayWithRadius(cid, text, type, radiusx, radiusy, position)
doCreatureSetLookDir(cid, direction)
doDecayItem(uid)
doForceSummonCreature(name, pos)
doMonsterChangeTarget(cid)
doMoveCreature(cid, direction)
doPlayerAddBlessing(cid, blessing)
doPlayerAddExp(cid, exp, useMult, ...)
doPlayerAddItem(cid, itemid, <optional: default: 1> count, <optional: default: 1> canDropOnMap, <optional: default: 1>subtype)
doPlayerAddItem(uid, itemid, <optional: default: 1> count/subtype)
doPlayerAddItemEx(cid, uid, ...)
doPlayerAddMana(cid, mana, ...)
doPlayerAddManaSpent(cid, mana)
doPlayerAddMoney(cid, money)
doPlayerAddMount(cid, mountId)
doPlayerAddOutfit(cid, lookType, addons)
doPlayerAddPremiumDays(cid, days)
doPlayerAddSkillTry(cid, skillid, n)
doPlayerAddSoul(cid, soul)
doPlayerFeed(cid, food)
doPlayerJoinParty(cid, leaderId)
doPlayerPopupFYI(cid, message)
doPlayerRemOutfit(cid, lookType, addons)
doPlayerRemoveItem(cid, itemid, count, <optional> subtype, <optional> ignoreEquipped)
doPlayerRemoveMoney(cid, money)
doPlayerRemoveMount(cid, mountId)
doPlayerRemovePremiumDays(cid, days)
doPlayerSendCancel(cid, text)
doPlayerSendTextMessage(cid, type, text, ...)
doPlayerSetBalance(cid, balance)
doPlayerSetGuildLevel(cid, level)
doPlayerSetGuildNick(cid, nick)
doPlayerSetOfflineTrainingSkill(cid, skill)
doPlayerSetSex(cid, sex)
doPlayerSetTown(cid, town)
doPlayerSetVocation(cid, vocation)
doRelocate(pos, posTo)
doRemoveCondition(cid, type[, subId])
doRemoveCreature(cid)
doRemoveItem(uid, ...)
doSendDistanceShoot(fromPos, toPos, distanceEffect, ...)
doSendMagicEffect(pos, magicEffect, ...)
doSendTutorial(cid, tutorialId)
doSetCreatureDropLoot(cid, doDrop)
doSetCreatureLight(cid, lightLevel, lightColor, time)
doSetCreatureOutfit(cid, outfit, time)
doSetItemActionId(uid, actionId)
doSetItemOutfit(cid, item, time)
doSetItemSpecialDescription(uid, desc)
doSetItemText(uid, text)
doSetMonsterOutfit(cid, name, time)
doSetMonsterTarget(cid, target)
doShowTextDialog(cid, itemId, text)
doSummonCreature(name, pos)
doTargetCombatCondition(cid, target, condition, effect)
doTargetCombatDispel(cid, target, type, effect)
doTargetCombatHealth(cid, target, type, min, max, effect)
doTargetCombatMana(cid, target, min, max, effect)
doTeleportThing(uid, dest, pushMovement)
doTileAddItemEx(pos, uid)
doTransformItem(uid, newItemId, ...)
Game.convertIpToString(ip)
Game.getStorageValue(key)
Game.setStorageValue(key, value)
getAccountNumberByPlayerName(name)
getBlessingsCost(level)
getConfigInfo(info)
getContainerCap(uid)
getContainerCapById(itemId)
getContainerItem(uid, slot)
getContainerSize(uid)
getCreatureBaseSpeed(cid)
getCreatureCondition(cid, condition[, subId])
getCreatureHealth(cid)
getCreatureMaster(cid)
getCreatureMaxHealth(cid)
getCreatureName(cid)
getCreatureOutfit(cid)
getCreaturePosition(cid)
getCreatureSpeed(cid)
getCreatureSummons(cid)
getCreatureTarget(cid)
getDepotId(uid)
getDistanceBetween(firstPosition, secondPosition)
getFluidSourceType(itemId)
getGlobalStorageValue(key)
getGuildId(guildName)
getHouseAccessList(id, listId)
getHouseByPlayerGUID(playerGUID)
getHouseEntry(houseId)
getHouseName(houseId)
getHouseOwner(houseId)
getHouseRent(id)
getHouseTilesSize(houseId)
getHouseTown(houseId)
getInstantSpellInfoByName(cid, name)
getInstantSpellWords(name)
getIPByPlayerName(name)
getItemDescriptions(itemId)
getItemIdByName(name)
getItemName(itemId)
getItemRWInfo(uid)
getItemWeight(itemId, ...)
getItemWeightByUID(uid, ...)
getMonsterFriendList(cid)
getMonsterTargetList(cid)
getOnlinePlayers()
getPartyMembers(cid)
getPlayerAccess(cid)
getPlayerAccountType(cid)
getPlayerBalance(cid)
getPlayerBlessing(cid, blessing)
getPlayerByName(name)
getPlayerDepotItems(cid, depotId)
getPlayerFlagValue(cid, flag)
getPlayerFood(cid)
getPlayerFreeCap(cid)
getPlayerGroupId(cid)
getPlayerGUID(cid)
getPlayerGUIDByName(name)
getPlayerGuildId(cid)
getPlayerGuildLevel(cid)
getPlayerGuildName(cid)
getPlayerGuildNick(cid)
getPlayerGuildRank(cid)
getPlayerInstantSpellCount(cid)
getPlayerInstantSpellInfo(cid, index)
getPlayerIp(cid)
getPlayerItemById(cid, deepSearch, itemId, ...)
getPlayerItemCount(cid, itemId, ...)
getPlayerLastLoginSaved(cid)
getPlayerLearnedInstantSpell(cid, name)
getPlayerLevel(cid)
getPlayerLight(cid)
getPlayerLookDir(cid)
getPlayerLossPercent(cid)
getPlayerMagLevel(cid)
getPlayerMana(cid)
getPlayerMasterPos(cid)
getPlayerMaxMana(cid)
getPlayerMoney(cid)
getPlayerMount(cid, mountId)
getPlayerName(cid)
getPlayerParty(cid)
getPlayerPosition(cid)
getPlayerPremiumDays(cid)
getPlayersByAccountNumber(accountNumber)
getPlayersByIPAddress(ip, mask)
getPlayerSex(cid)
getPlayerSkill(cid, skillId)
getPlayerSkullType(cid)
getPlayerSlotItem(cid, slot)
getPlayerSoul(cid)
getPlayerStorageValue(cid, key)
getPlayerTown(cid)
getPlayerVocation(cid)
getPromotedVocation(vocationId)
getPvpBlessingCost(level)
getSpectators(centerPos, rangex, rangey, multifloor, onlyPlayers)
getThing(uid)
getThingfromPos(pos)
getThingPos(uid)
getTibianTime()
getTileHouseInfo(pos)
getTileInfo(position)
getTileItemById(position, itemId, ...)
getTileItemByType(position, itemType)
getTilePzInfo(position)
getTileThingByPos(position)
getTileThingByTopOrder(position, topOrder)
getTopCreature(position)
getTownId(townName)
getTownName(townId)
getTownTemplePosition(townId)
getWaypointPosition(name)
getWorldCreatures(type)
getWorldLight()
getWorldTime()
getWorldUpTime()
hasProperty(uid, prop)
isContainer(uid)
isCorpse(uid)
isCreature(cid)
isDepot(uid)
isDruid(cid)
isInArray(array, value)
isInRange(pos, fromPos, toPos)
isInWar(cid, target)
isItem(uid)
isItemContainer(itemId)
isItemDoor(itemId)
isItemFluidContainer(itemId)
isItemMovable(itemId)
isItemRune(itemId)
isItemStackable(itemId)
isKnight(cid)
isMonster(cid)
isMovable(uid)
isNpc(cid)
isNumber(str)
isPaladin(cid)
isPlayer(cid)
isPlayerGhost(cid)
isPlayerPzLocked(cid)
isPremium(cid)
isSightClear(fromPos, toPos, floorCheck)
isSorcerer(cid)
isSummon(cid)
isValidUID(uid)
mayNotMove(cid, value)
numberToVariant(number)
Player.feed(self, food)
Player.isUsingOtClient(self)
Player.sendCancelMessage(self, message)
Player.sendExtendedOpcode(self, opcode, buffer)
playerLearnInstantSpell(cid, name)
Position.getNextPosition(self, direction, steps)
positionToVariant(pos)
pushThing(thing)
queryTileAddThing(thing, position, ...)
registerClass(className, baseClass, newFunction)
registerCreatureEvent(cid, name)
registerEnum(value)
registerEnumIn(tableName, value)
registerGlobalMethod(functionName, function)
registerGlobalVariable(name, value)
registerMetaMethod(className, functionName, function)
registerMethod(className, functionName, function)
registerTable(tableName)
registerVariable(tableName, name, value)
saveServer()
sendChannelMessage(channelId, type, message)
sendGuildChannelMessage(guildId, type, message)
setCombatArea(combat, area)
setCombatCallBack(combat, key, function_name)
setCombatCondition(combat, condition)
setCombatFormula(combat, type, mina, minb, maxa, maxb)
setCombatParam(combat, key, value)
setConditionFormula(combat, mina, minb, maxa, maxb)
setConditionParam(condition, key, value)
setGlobalStorageValue(key, value)
setHouseAccessList(id, listId, listText)
setHouseOwner(id, guid)
setPlayerGroupId(cid, groupId)
setPlayerStorageValue(cid, key, value)
stopEvent(eventid)
string.split(str, sep)
stringToVariant(string)
targetPositionToVariant(pos)
unregisterCreatureEvent(cid, name)
variantToNumber(var)
variantToPosition(var)
variantToString(var)

tfs 1.0 metamethod lua functions (updated 13th July)
http://pastebin.com/nws8xHmK

tfs 1.0 source-made lua functions

http://pastebin.com/s5b4yVa7

tfs 1.0 lua-made lua functions
http://pastebin.com/bgpNHax2

tfs 1.2 metamethod lua functions
http://pastebin.com/wrnD8jHH

.::::. Functions last updated on January 17th .::::.
 
Last edited by a moderator:
Nice to have it, only one thing! Please dont make the text smaller! Some of us are used to the "normal" text size haha
Tho I think, since shadowcores is online there wont be alot of 10+ rl maps. They insted prefer 8.60 due to players rather play that. Its not easy to try and take out shadowcores and the other server. But I guess someone will use this. Im gonna stick with 0.4 3777 & 3884! :)
WibbenZ
 
Anyone know how getOnlinePlayers() works? It gives only number of players online or some tables? I can't find it in source. ;s
 
@Szaki
compat.lua:
Code:
function getOnlinePlayers()
 local result = {}
 for _, player in ipairs(Game.getPlayers()) do
 result[#result + 1] = player:getName()
 end
 return result
end

luascript.cpp:
Code:
int32_t LuaScriptInterface::luaGameGetPlayers(lua_State* L)
{
 // Game.getPlayers()
 lua_Number index = 0;
 lua_createtable(L, g_game.getPlayersOnline(), 0);
 for (const auto& playerEntry : g_game.getPlayers()) {
 pushNumber(L, ++index);
 pushUserdata<Player>(L, playerEntry.second);
 setMetatable(L, -1, "Player");
 lua_rawset(L, -3);
 }
 return 1;
}

try printing function results to figure out what it does
 
I need to get getAccountByName(name);??? is it the same as?
getAccountNumberByPlayerName(name)?
 
TFS 1.0 flags should be awsome to get aswell. Thanks.

Need flag to do CTRL + Z ingame for players.
 
It exists similar functions like
doGuildAddEnemy(guild, enemy, war, type)
doGuildRemoveEnemy(guild, enemy)

in TFS 1.0?
 
nope, why do you need those?
 
You don't need those for war system :p
 
Back
Top