• 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!

[LUA] 0.4 TFS Functions

pugamoline

uint32_t patch_mem(char *
Joined
Nov 15, 2011
Messages
189
Reaction score
19
Hard-Coded Functions

Lua:
getCreatureHealth(cid)
getCreatureMaxHealth(cid[, ignoreModifiers = false])
getCreatureMana(cid)
getCreatureMaxMana(cid[, ignoreModifiers = false])
getCreatureHideHealth(cid)
doCreatureSetHideHealth(cid, hide)
getCreatureSpeakType(cid)
doCreatureSetSpeakType(cid, type)
getCreatureLookDirection(cid)
getPlayerLevel(cid)
getPlayerExperience(cid)
getPlayerMagLevel(cid[, ignoreModifiers = false])
getPlayerSpentMana(cid)
getPlayerFood(cid)
getPlayerAccess(cid)
getPlayerGhostAccess(cid)
getPlayerSkillLevel(cid, skill[, ignoreModifiers = false])
getPlayerSkillTries(cid, skill)
getPlayerTown(cid)
getPlayerVocation(cid)
getPlayerIp(cid)
getPlayerRequiredMana(cid, magicLevel)
getPlayerRequiredSkillTries(cid, skillId, skillLevel)
getPlayerItemCount(cid, itemid[, subType = -1])
getPlayerMoney(cid)
getPlayerSoul(cid[, ignoreModifiers = false])
getPlayerFreeCap(cid)
getPlayerLight(cid)
getPlayerSlotItem(cid, slot)
getPlayerWeapon(cid[, ignoreAmmo = false])
getPlayerItemById(cid, deepSearch, itemId[, subType = -1])
getPlayerDepotItems(cid, depotid)
getPlayerGuildId(cid)
getPlayerGuildName(cid)
getPlayerGuildRankId(cid)
getPlayerGuildRank(cid)
getPlayerGuildNick(cid)
getPlayerGuildLevel(cid)
getPlayerGUID(cid)
getPlayerNameDescription(cid)
doPlayerSetNameDescription(cid, desc)
getPlayerSpecialDescription(cid)
doPlayerSetSpecialDescription(cid, desc)
getPlayerAccountId(cid)
getPlayerAccount(cid)
getPlayerFlagValue(cid, flag)
getPlayerCustomFlagValue(cid, flag)
getPlayerPromotionLevel(cid)
doPlayerSetPromotionLevel(cid, level)
getPlayerGroupId(cid)
doPlayerSetGroupId(cid, newGroupId)
doPlayerSendOutfitWindow(cid)
doPlayerLearnInstantSpell(cid, name)
doPlayerUnlearnInstantSpell(cid, name)
getPlayerLearnedInstantSpell(cid, name)
getPlayerInstantSpellCount(cid)
getPlayerInstantSpellInfo(cid, index)
getInstantSpellInfo(cid, name)
getCreatureStorageList(cid)
getCreatureStorage(uid, key)
doCreatureSetStorage(uid, key, value)
getStorageList()
getStorage(key)
doSetStorage(key, value)
getChannelUsers(channelId)
getPlayersOnline()
getTileInfo(pos)
getThingFromPos(pos[, displayError = true])
getThing(uid[, recursive = RECURSE _FIRST])
doTileQueryAdd(uid, pos[, flags[, displayError = true]])
doItemRaidUnref(uid)
getThingPosition(uid)
getTileItemById(pos, itemId[, subType = -1])
getTileItemByType(pos, type)
getTileThingByPos(pos)
getTopCreature(pos)
doRemoveItem(uid[, count = -1])
doPlayerFeed(cid, food)
doPlayerSendCancel(cid, text)
doPlayerSendDefaultCancel(cid, ReturnValue)
getSearchString(fromPosition, toPosition[, fromIsCreature = false[, toIsCreature = false]])
getClosestFreeTile(cid, targetpos[, extended = false[, ignoreHouse = true]])
doTeleportThing(cid, newpos[, pushmove = true[, fullTeleport = true]])
doTransformItem(uid, newId[, count/subType])
doCreatureSay(uid, text[, type = SPEAK _SAY[, ghost = false[, cid = 0[, pos]]]])
doSendCreatureSquare(cid, color[, player])
doSendMagicEffect(pos, type[, player])
doSendDistanceShoot(fromPos, toPos, type[, player])
doSendAnimatedText(pos, text, color[, player])
doPlayerAddSkillTry(cid, skillid, n[, useMultiplier = true])
doCreatureAddHealth(cid, health[, hitEffect[, hitColor[, force]]])
doCreatureAddMana(cid, mana)
setCreatureMaxHealth(cid, health)
setCreatureMaxMana(cid, mana)
doPlayerSetMaxCapacity(cid, cap)
doPlayerAddSpentMana(cid, amount[, useMultiplier = true])
doPlayerAddSoul(cid, amount)
doPlayerAddItem(cid, itemid[, count/subtype = 1[, canDropOnMap = true[, slot = 0]]])
doPlayerAddItem(cid, itemid[, count = 1[, canDropOnMap = true[, subtype = 1[, slot = 0]]]])
doPlayerAddItemEx(cid, uid[, canDropOnMap = false[, slot = 0]])
doPlayerSendTextMessage(cid, MessageClasses, message)
doPlayerSendChannelMessage(cid, author, message, SpeakClasses, channel)
doPlayerSendToChannel(cid, targetId, SpeakClasses, message, channel[, time])
doPlayerOpenChannel(cid, channelId)
doPlayerAddMoney(cid, money)
doPlayerRemoveMoney(cid, money)
doPlayerTransferMoneyTo(cid, target, money)
doShowTextDialog(cid, itemid, text)
doDecayItem(uid)
doCreateItem(itemid[, type/count], pos)
doCreateItemEx(itemid[, count/subType = -1])
doTileAddItemEx(pos, uid)
doAddContainerItemEx(uid, virtuid)
doRelocate(pos, posTo[, creatures = true[, unmovable = true]])
doCleanTile(pos[, forceMapLoaded = false])
doCreateTeleport(itemid, topos, createpos)
doCreateMonster(name, pos[, extend = false[, force = false[, displayError = true]]])
doCreateNpc(name, pos[, displayError = true])
doSummonMonster(cid, name)
doConvinceCreature(cid, target)
getMonsterTargetList(cid)
getMonsterFriendList(cid)
doMonsterSetTarget(cid, target)
doMonsterChangeTarget(cid)
getMonsterInfo(name)
doAddCondition(cid, condition)
doRemoveCondition(cid, type[, subId])
doRemoveConditions(cid[, onlyPersistent])
doRemoveCreature(cid[, forceLogout = true])
doMoveCreature(cid, direction[, flag = FLAG _NOLIMIT])
doSteerCreature(cid, position)
doPlayerSetPzLocked(cid, locked)
doPlayerSetTown(cid, townid)
doPlayerSetVocation(cid,voc)
doPlayerRemoveItem(cid, itemid[, count[, subType = -1]])
doPlayerAddExperience(cid, amount)
doPlayerSetGuildId(cid, id)
doPlayerSetGuildLevel(cid, level[, rank])
doPlayerSetGuildNick(cid, nick)
doPlayerAddOutfit(cid, looktype, addon)
doPlayerRemoveOutfit(cid, looktype[, addon = 0])
doPlayerAddOutfitId(cid, outfitId, addon)
doPlayerRemoveOutfitId(cid, outfitId[, addon = 0])
canPlayerWearOutfit(cid, looktype[, addon = 0])
canPlayerWearOutfitId(cid, outfitId[, addon = 0])
getCreatureCondition(cid, condition[, subId = 0])
doCreatureSetDropLoot(cid, doDrop)
getPlayerLossPercent(cid, lossType)
doPlayerSetLossPercent(cid, lossType, newPercent)
doPlayerSetLossSkill(cid, doLose)
getPlayerLossSkill(cid)
doPlayerSwitchSaving(cid)
doPlayerSave(cid[, shallow = false])
isPlayerPzLocked(cid)
isPlayerSaving(cid)
isCreature(cid)
isMovable(uid)
getCreatureByName(name)
getPlayerByGUID(guid)
getPlayerByNameWildcard(name~[, ret = false])
getPlayerGUIDByName(name[, multiworld = false])
getPlayerNameByGUID(guid[, multiworld = false[, displayError = true]])
doPlayerChangeName(guid, oldName, newName)
registerCreatureEvent(uid, eventName)
unregisterCreatureEvent(uid, eventName)
getContainerSize(uid)
getContainerCap(uid)
getContainerItem(uid, slot)
doAddContainerItem(uid, itemid[, count/subType = 1])
getHouseInfo(houseId[, displayError = true])
getHouseAccessList(houseid, listId)
getHouseByPlayerGUID(playerGUID)
getHouseFromPos(pos)
setHouseAccessList(houseid, listid, listtext)
setHouseOwner(houseId, owner[, clean])
getWorldType()
setWorldType(type)
getWorldTime()
getWorldLight()
getWorldCreatures(type)
getWorldUpTime()
getGuildId(guildName)
getGuildMotd(guildId)
getPlayerSex(cid[, full = false])
doPlayerSetSex(cid, newSex)
createCombatArea({area}[, {extArea}])
createConditionObject(type[, ticks[, buff[, subId]]])
setCombatArea(combat, area)
setCombatCondition(combat, condition)
setCombatParam(combat, key, value)
setConditionParam(condition, key, value)
addDamageCondition(condition, rounds, time, value)
addOutfitCondition(condition, outfit)
setCombatCallBack(combat, key, function_name)
setCombatFormula(combat, type, mina, minb, maxa, maxb[, minl, maxl[, minm, maxm[, minc[, maxc]]]])
setConditionFormula(combat, mina, minb, maxa, maxb)
doCombat(cid, combat, param)
createCombatObject()
doCombatAreaHealth(cid, type, pos, area, min, max, effect)
doTargetCombatHealth(cid, target, type, min, max, effect)
doCombatAreaMana(cid, pos, area, min, max, effect)
doTargetCombatMana(cid, target, min, max, effect)
doCombatAreaCondition(cid, pos, area, condition, effect)
doTargetCombatCondition(cid, target, condition, effect)
doCombatAreaDispel(cid, pos, area, type, effect)
doTargetCombatDispel(cid, target, type, effect)
doChallengeCreature(cid, target)
numberToVariant(number)
stringToVariant(string)
positionToVariant(pos)
targetPositionToVariant(pos)
variantToNumber(var)
variantToString(var)
variantToPosition(var)
doChangeSpeed(cid, delta)
doCreatureChangeOutfit(cid, outfit)
doSetMonsterOutfit(cid, name[, time = -1])
doSetItemOutfit(cid, item[, time = -1])
doSetCreatureOutfit(cid, outfit[, time = -1])
getCreatureOutfit(cid)
getCreatureLastPosition(cid)
getCreatureName(cid)
getCreatureSpeed(cid)
getCreatureBaseSpeed(cid)
getCreatureTarget(cid)
isSightClear(fromPos, toPos, floorCheck)
isInArray(array, value[, caseSensitive = false])
addEvent(callback, delay, ...)
stopEvent(eventid)
getPlayersByAccountId(accId)
getAccountIdByName(name)
getAccountByName(name)
getAccountIdByAccount(accName)
getAccountByAccountId(accId)
getIpByName(name)
getPlayersByIp(ip[, mask = 0xFFFFFFFF])
doPlayerPopupFYI(cid, message)
doPlayerSendTutorial(cid, id)
doPlayerSendMailByName(name, item[, town[, actor]])
doPlayerAddMapMark(cid, pos, type[, description])
doPlayerAddPremiumDays(cid, days)
getPlayerPremiumDays(cid)
doCreatureSetLookDirection(cid, dir)
getCreatureGuildEmblem(cid[, target])
doCreatureSetGuildEmblem(cid, emblem)
getCreaturePartyShield(cid[, target])
doCreatureSetPartyShield(cid, shield)
getCreatureSkullType(cid[, target])
doCreatureSetSkullType(cid, skull)
getPlayerSkullEnd(cid)
doPlayerSetSkullEnd(cid, time, type)
getPlayerBlessing(cid, blessing)
doPlayerAddBlessing(cid, blessing)
getPlayerStamina(cid)
doPlayerSetStamina(cid, minutes)
getPlayerBalance(cid)
doPlayerSetBalance(cid, balance)
getCreatureNoMove(cid)
doCreatureSetNoMove(cid, block)
getPlayerIdleTime(cid)
doPlayerSetIdleTime(cid, amount)
getPlayerLastLoad(cid)
getPlayerLastLogin(cid)
getPlayerAccountManager(cid)
getPlayerTradeState(cid)
getPlayerModes(cid)
getPlayerRates(cid)
doPlayerSetRate(cid, type, value)
getPlayerPartner(cid)
doPlayerSetPartner(cid, guid)
doPlayerFollowCreature(cid, target)
getPlayerParty(cid)
doPlayerJoinParty(cid, lid)
doPlayerLeaveParty(cid[, forced = false])
doPlayerAddMount(cid, mountId)
doPlayerRemoveMount(cid, mountId)
getPlayerMount(cid, mountId)
doPlayerSetMount(cid, mountId)
doPlayerSetMountStatus(cid, mounted)
getMountInfo([mountId])
getPartyMembers(lid)
getCreatureMaster(cid)
getCreatureSummons(cid)
getTownId(townName)
getTownName(townId)
getTownTemplePosition(townId)
getTownHouses(townId)
getSpectators(centerPos, rangex, rangey[, multifloor = false])
getVocationInfo(id)
getGroupInfo(id[, premium = false])
getVocationList()
getGroupList()
getChannelList()
getTownList()
getWaypointList()
getTalkActionList()
getExperienceStageList()
getItemIdByName(name[, displayError = true])
getItemInfo(itemid)
getItemAttribute(uid, key)
doItemSetAttribute(uid, key, value)
doItemEraseAttribute(uid, key)
getItemWeight(uid[, precise = true])
getItemParent(uid)
hasItemProperty(uid, prop)
hasPlayerClient(cid)
isIpBanished(ip[, mask])
isPlayerBanished(name/guid, type)
isAccountBanished(accountId[, playerId])
doAddIpBanishment(...)
doAddPlayerBanishment(...)
doAddAccountBanishment(...)
doAddNotation(...)
doAddStatement(...)
doRemoveIpBanishment(ip[, mask])
doRemovePlayerBanishment(name/guid, type)
doRemoveAccountBanishment(accountId[, playerId])
doRemoveNotations(accountId[, playerId])
doRemoveStatements(name/guid[, channelId])
getNotationsCount(accountId[, playerId])
getStatementsCount(name/guid[, channelId])
getBanData(value[, type[, param]])
getBanReason(id)
getBanAction(id[, ipBanishment = false])
getBanList(type[, value[, param]])
getExperienceStage(level)
getDataDir()
getLogsDir()
getConfigFile()
getConfigValue(key)
getModList()
getHighscoreString(skillId)
getWaypointPosition(name)
doWaypointAddTemporial(name, pos)
getGameState()
doSetGameState(id)
doExecuteRaid(name)
doCreatureExecuteTalkAction(cid, text[, ignoreAccess = false[, channelId = CHANNEL _DEFAULT]])
doReloadInfo(id[, cid])
doSaveServer([shallow = false])
doCleanHouse(houseId)
doCleanMap()
doRefreshMap()
doGuildAddEnemy(guild, enemy, war, type)
doGuildRemoveEnemy(guild, enemy)
doUpdateHouseAuctions()
loadmodlib(lib)
domodlib(lib)
dodirectory(dir[, recursively = false])

Scripted Functions

Lua:
doPlayerGiveItem(cid, itemid, amount, subType)
doPlayerGiveItemContainer(cid, containerid, itemid, amount, subType)
doPlayerTakeItem(cid, itemid, amount)
doPlayerBuyItem(cid, itemid, count, cost, charges)
doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
doPlayerSellItem(cid, itemid, count, cost)
doPlayerWithdrawMoney(cid, amount)
doPlayerDepositMoney(cid, amount)
doPlayerAddStamina(cid, minutes)
isPremium(cid)
getMonthDayEnding(day)
getMonthString(m)
getArticle(str)
isNumeric(str)
doNumberFormat(i)
doPlayerAddAddons(cid, addon)
doPlayerWithdrawAllMoney(cid)
doPlayerDepositAllMoney(cid)
doPlayerTransferAllMoneyTo(cid, target)
playerExists(name)
getTibiaTime()
doWriteLogFile(file, text)
getExperienceForLevel(lv)
doMutePlayer(cid, time)
getPlayerGroupName(cid)
getPlayerVocationName(cid)
getPromotedVocation(vid)
doPlayerRemovePremiumDays(cid, days)
getPlayerMasterPos(cid)
getHouseOwner(houseId)
getHouseName(houseId)
getHouseEntry(houseId)
getHouseRent(houseId)
getHousePrice(houseId)
getHouseTown(houseId)
getHouseDoorsCount(houseId)
getHouseBedsCount(houseId)
getHouseTilesCount(houseId)
getItemNameById(itemid)
getItemPluralNameById(itemid)
getItemArticleById(itemid)
getItemName(uid)
getItemPluralName(uid)
getItemArticle(uid)
getItemText(uid)
getItemSpecialDescription(uid)
getItemWriter(uid)
getItemDate(uid)
getTilePzInfo(pos)
getTileZoneInfo(pos)
doShutdown()
doSummonCreature(name, pos, displayError)
getOnlinePlayers()
getPlayerByName(name)
isPlayer(cid)
isPlayerGhost(cid)
isMonster(cid)
isNpc(cid)
doPlayerSetExperienceRate(cid, value)
doPlayerSetMagicRate(cid, value)
doPlayerAddLevel(cid, amount, round)
doPlayerAddMagLevel(cid, amount)
doPlayerAddSkill(cid, skill, amount, round)
getPartyLeader(cid)
isInParty(cid)
isPrivateChannel(channelId)
doPlayerResetIdleTime(cid)
doBroadcastMessage(text, class)
doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost)
getBooleanFromString(input)
doCopyItem(item, attributes)
doRemoveThing(uid)
setAttackFormula(combat, type, minl, maxl, minm, maxm, min, max)
setHealingFormula(combat, type, minl, maxl, minm, maxm, min, max)
doChangeTypeItem(uid, subtype)
doSetItemText(uid, text, writer, date)
doItemSetActionId(uid, aid)
getFluidSourceType(itemid)
getDepotId(uid)
getItemDescriptions(uid)
getItemWeightById(itemid, count, precision)
getItemWeaponType(uid)
getItemRWInfo(uid)
getItemLevelDoor(itemid)
isContainer(uid)
isItemStackable(itemid)
isItemRune(itemid)
isItemDoor(itemid)
isItemContainer(itemid)
isItemFluidContainer(itemid)
isItemMovable(itemid)
isCorpse(uid)
getContainerCapById(itemid)
getMonsterAttackSpells(name)
getMonsterHealingSpells(name)
getMonsterLootList(name)
getMonsterSummonList(name)
choose(...)
exhaustion.check(cid, storage)
exhaustion.get(cid, storage)
exhaustion.set(cid, storage, time)
exhaustion.make(cid, storage, time)
doConvertIntegerToIp(int, mask)
doConvertIpToInteger(str)
doRevertIp(str)
isInRange(position, fromPosition, toPosition)
getDistanceBetween(fromPosition, toPosition)
getDirectionTo(pos1, pos2)
getCreatureLookPosition(cid)
getPositionByDirection(position, direction, size)
doComparePositions(position, positionEx)
getArea(position, x, y)
Position(x, y, z, stackpos)
isValidPosition(position)
isSorcerer(cid)
isDruid(cid)
isPaladin(cid)
isKnight(cid)
isRookie(cid)
string.split(str)
string.trim(str)
string.explode(str, sep, limit)
string.expand(str)
string.timediff(diff)


REP++ :)
 
Have you tried to open /doc/LUA_FUNCTIONS in a notepad? You can even see some samples there :p

Edit: Anyway there are too many people who do not know about this, so this will surely help somebody. :)
 
Last edited:
anyone interesting in making wiki with me where we create sample code put what we find from net all for tfs 0.4 to make life easier for erryone? nowhere explains actually where and how scripts should be written no code of functions in engines sources nothing.. its kind of crazy its all undocumented for so long...
 
Back
Top