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

All LUA functions in TFS 0.2.10

Status
Not open for further replies.

habiba

New Member
Joined
Aug 26, 2007
Messages
586
Reaction score
4
Location
Örebro, Sweden
Here is all Lua Functions From TFS 0.2.10
If some dont know how to see them
go in to Mystic Spirit\doc\LUA_FUNCTIONS---->Or Look Here

--------------------------------------------------------------
Use (CTRL+F) If you want to search after a Function

--------------------------------------------------------------
setPlayerGroupId(cid, newGroupId)
playerLearnInstantSpell(cid, name)
canPlayerLearnInstantSpell(cid, name)
getPlayerLearnedInstantSpell(cid, name)
getPlayerInstantSpellCount(cid)
getPlayerInstantSpellInfo(cid, index)
getInstantSpellInfoByName(cid, name)
getInstantSpellWords(name)
setPlayerStorageValue(uid, valueid, newvalue)
getGlobalStorageValue(valueid)
setGlobalStorageValue(valueid, newvalue)
getTilePzInfo(pos)
getTileHouseInfo(pos)
getItemRWInfo(uid)
getThingfromPos(pos)
getThing(uid)
queryTileAddThing(uid, pos, <optional> flags)
getThingPos(uid)
doRemoveItem(uid, <optional> n)
doPlayerFeed(cid, food)

doPlayerSendDefaultCancel(cid, ReturnValue)
doTeleportThing(cid, newpos, <optional> pushmove)
doTransformItem(uid, toitemid, <optional> count/subtype)
doCreatureSay(cid, text, type)
doSendMagicEffect(pos, type)
doSendDistanceShoot(frompos, topos, type)
doChangeTypeItem(uid, newtype)
doSetItemActionId(uid, actionid)
doSetItemText(uid, text)
doSetItemSpecialDescription(uid, desc)
doSendAnimatedText(pos, text, color)
doPlayerAddSkillTry(cid, skillid, n)
doCreatureAddHealth(cid, health)
doPlayerAddMana(cid, mana)
doPlayerAddManaSpent(cid, mana)
doPlayerAddSoul(cid, soul)
doPlayerAddItem(uid, itemid, <optional> count/subtype)
doPlayerAddItemEx(cid, uid, <optional: default: 0> useCidPosOnFail)
doPlayerSendTextMessage(cid, MessageClasses, message)
doPlayerRemoveMoney(cid, money)
doShowTextDialog(cid, itemid, text)
doDecayItem(uid)
doCreateItem(itemid, type/count, pos)
doCreateItemEx(itemid, <optional> count/subtype)
doTileAddItemEx(pos, uid)
doCreateTeleport(itemid, topos, createpos)
doSummonCreature(name, pos)
doConvinceCreature(cid, target)
doRemoveCreature(cid)
doMoveCreature(cid, direction)
doPlayerSetTown(cid, townid)
doPlayerSetVocation(cid,voc)
doPlayerRemoveItem(cid,itemid,count)
doPlayerAddExp(cid,exp)
doPlayerSetGuildId(cid, id)
doPlayerSetGuildRank(cid, rank)
doPlayerSetGuildNick(cid, nick)
doPlayerAddOutfit(cid,looktype,addons)
doPlayerRemOutfit(cid,looktype,addons)
doSetCreatureLight(cid, lightLevel, lightColor, time)
doSetCreatureDropLoot(cid, doDrop)
getCreatureCondition(cid, condition)
isPlayer(cid)
isCreature(cid)
isContainer(uid)
isMoveable(uid)
getPlayerByName(name)
getPlayerGUIDByName(name)
registerCreatureEvent(uid, eventName)
getContainerSize(uid)
getContainerCap(uid)
getContainerItem(uid, slot)
doAddContainerItem(uid, itemid, <optional> count/subtype)
getHouseOwner(houseid)
getHouseName(houseid)
getHouseEntry(houseid)
getHouseRent(houseid)
getHouseTown(houseid)
getHouseAccessList(houseid, listid)
getHouseByPlayerGUID(playerGUID)
setHouseAccessList(houseid, listid, listtext)
setHouseOwner(houseid, ownerGUID)
getWorldType()
getWorldTime()
getWorldLight()
getWorldCreatures(type)
getWorldUpTime()
broadcastMessage(message, type)
getGuildId(guild_name)
getPlayerSex(cid)
doPlayerSetSex(cid, newSex)
createCombatArea( {area}, <optional> {extArea} )
createConditionObject(type)
setCombatArea(combat, area)
setCombatCondition(combat, condition)
setCombatParam(combat, key, value)
setConditionParam(condition, key, value)
addDamageCondition(condition, rounds, time, value)
addOutfitCondition(condition, lookTypeEx, lookType, lookHead, lookBody, lookLegs, lookFeet)
setCombatCallBack(combat, key, function_name)
setCombatFormula(combat, type, mina, minb, maxa, maxb)
setConditionFormula(combat, mina, minb, maxa, maxb)
doCombat(cid, combat, param)
createCombatObject()
doAreaCombatHealth(cid, type, pos, area, min, max, effect)
doTargetCombatHealth(cid, target, type, min, max, effect)
doAreaCombatMana(cid, pos, area, min, max, effect)
doTargetCombatMana(cid, target, min, max, effect)
doAreaCombatCondition(cid, pos, area, condition, effect)
doTargetCombatCondition(cid, target, condition, effect)
doAreaCombatDispel(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)
doSetMonsterOutfit(cid, name, time)
doSetItemOutfit(cid, item, time)
doSetCreatureOutfit(cid, outfit, time)
getCreatureOutfit(cid)
getCreaturePosition(cid)
getCreatureName(cid)
getCreatureSpeed(cid)
getCreatureBaseSpeed(cid)
getCreatureTarget(cid)
isItemStackable(itemid)
isItemRune(itemid)
isItemDoor(itemid)
isItemContainer(itemid)
isItemFluidContainer(itemid)
getItemName(itemid)
getItemWeight(itemid, count)
debugPrint(text)
isInArray(array, value)
addEvent(callback, delay, parameter)
stopEvent(eventid)
doPlayerPopupFYI(cid, message)
mayNotLogout(cid, value)
mayNotMove(cid, value)
doPlayerAddPremiumDays(cid, days)
doPlayerRemovePremiumDays(cid, days)
getPlayerPremiumDays(cid)
getPlayerSkullType(cid)
getPromotedVocation(vocation)
getPlayerBlessing(cid, blessing)
doPlayerAddBlessing(cid, blessing)
savePlayers()
escapeString(str)​
 
It's not for newbies because u dont use it dosen't mean other people wont use it. And yes i use it. Do u serious think that i will open an file to "search" for the function. I have this page as my main page so the only thing i have to do is just open my internet explorder and i'll find what i need.
 
I honestly think it's easier to search for a function on a web page, here, than to open a text-document, since I always have my internet browser running and it's easy to navigate here instead of opening the explorer and venture far, far into the computer to find a single file. ;P
 
I honestly think it's easier to search for a function on a web page, here, than to open a text-document, since I always have my internet browser running and it's easy to navigate here instead of opening the explorer and venture far, far into the computer to find a single file. ;P

I'll bether close the thread to avoid Bumps.

P.s) The maiker of this thread should Update it every time there's an New release.
 
I'll bether close the thread to avoid Bumps.

P.s) The maiker of this thread should Update it every time there's an New release.

It's a sticky anyway, what's point of bumping?

This is a good thread to ask what functions does, and to inform thread creator about changes in Lua functions and new ones.

Thread opened.
 
Agreed, it is a very helpful post, at least for me it has been.

And to start off with the questions, I have one. In the function getCreatureTarget do I get the Player UID if for example the monster is targeting a player?

Thanks.
 
You can check who he is attacking.
target = getCreatureTarget(cid)
getCreatureName(target)
or if is a player:
if isPlayer(target) == 1
 
Where are functions:
getPlayerVocation(cid)
and other "getPlayerXxxxx"?
Is it hard to copy list from source? :>
You can also add what function return true/false/value and limits of values. Like:
doPlayerAddItem(uid, itemid, <optional> count/subtype) - always return "1" (TRUE), count: max. 100
 
Last edited:
could someone explain to me how the addevent function works, i have seen it in a lot of scripts and even NPC scripts but I'm not sure what it really does or how to use it. Yes, i'v tried searching maybe i just looked for the wrong thing so don't flame and say use search and if there is a thread about it you could just add the link

thanks
 
addevent(event, time, parameters)
event = the function you use for the event
time = the time the event takes place.
parameters = i dont really know, probably a guideline.

Sample script:
PHP:
function onStepIn(cid, item, pos)
p = {cid = cid, tpos = pos}
addEvent(Teleport, 3000, p)
end

function Teleport(p)
local tpos = {x=xxx, y=yyy, z=z}
doTeleportThing(cid, tpos, 0) --sometimes doTeleportThing(p.cid, tpos, 0)--
end
When stepping on a tile, the player will get teleport after 3 seconds, i hoped this helped you.
 
addevent(event, time, parameters)
event = the function you use for the event
time = the time the event takes place.
parameters = i dont really know, probably a guideline.

Sample script:
PHP:
function onStepIn(cid, item, pos)
p = {cid = cid, tpos = pos}
addEvent(Teleport, 3000, p)
end

function Teleport(p)
local tpos = {x=xxx, y=yyy, z=z}
doTeleportThing(cid, tpos, 0) --sometimes doTeleportThing(p.cid, tpos, 0)--
end
When stepping on a tile, the player will get teleport after 3 seconds, i hoped this helped you.

Probably a guideline? What's that supposed to mean? ^.-

Parameters is what should be sent to the function, it must be an array since addEvent can only take 1 parameter for the parameters huah sounds wierd but well:
PHP:
my_function = function(params)
    print(params.message)
    return params.returnValue
end

addEvent(my_function, 10*1000, {message="Hello!", returnValue=1})

After ten seconds this script would print "Hello!" and return 1. Here's another way, not really used oftenly cuz then you must be exact with where you place the parameters inside the params table:
PHP:
my_function = function(params)
    print(params[1])
    return params[2]
end

addEvent(my_function, 10*1000, {"Hello!", 1})

Btw, your code won't work ^.^
 
Status
Not open for further replies.
Back
Top