• 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.3] [Revscriptsys] Free Lua scripting service - Post your requests! Let's learn it together!

Lua:
local decayItems = {
    [1945] = 1946, [1946] = 1945
}
local slots = {
    -- aqui sao os slots da esteira, por onde os itens vao ir passando... podem ser adicionados quantos quiser...
    Position(32364, 32183, 6), Position(32365, 32183, 6), Position(32366, 32183, 6), Position(32367, 32183, 6),    Position(32368, 32183, 6),
    Position(32369, 32183, 6), Position(32370, 32183, 6), Position(32371, 32183, 6), Position(32372, 32183, 6),    Position(32373, 32183, 6),
    Position(32374, 32183, 6), Position(32375, 32183, 6), Position(32376, 32183, 6)
}

local itemtable = {
    --aqui pode ter ate 100 itens.. a chance nunca pode se repetir, ela deve ser de 1 a 100...
    -- inserir os itens respeitando a ordem: [1], [2], [3], ...  ate o ultimo [100]
    [1] = {id = 2148, chance = 1},
    [2] = {id = 2398, chance = 5},
    [3] = {id = 2386, chance = 10},
    [4] = {id = 2643, chance = 15},
    [5] = {id = 2461, chance = 20},
    [6] = {id = 2510, chance = 25},
    [7] = {id = 2649, chance = 30},
    [8] = {id = 2643, chance = 35},
    [9] = {id = 2647, chance = 40},
    [10] = {id = 9078, chance = 45},
    [11] = {id = 2490, chance = 50},
    [12] = {id = 2457, chance = 55},
    [13] = {id = 2152, chance = 60},
    
    
    [14] = {id = 2160, chance = 95},
    [15] = {id = 2159, chance = 99}
}

local function ender(cid, position)
    local player = Player(cid)
    local posicaofim = Position(32370, 32183, 6) -- AQUI VAI APARECER A SETA, que define o item que o player ganhou
    local item = Tile(posicaofim):getTopDownItem()
    if item then
        local itemId = item:getId()
        posicaofim:sendMagicEffect(CONST_ME_TUTORIALARROW)
        player:addItem(itemId, 1)
    end
    local alavanca = Tile(position):getTopDownItem()
    if alavanca then
        alavanca:setActionId(18562) -- aqui volta o actionid antigo, para permitir uma proxima jogada...
    end
    if itemId == 2159 or itemId == 2160 then --checar se é o ID do item LENDARIO
        broadcastMessage("O player "..player:getName().." ganhou "..item:getName().."", MESSAGE_EVENT_ADVANCE) -- se for item raro mandar no broadcast
        
        for _, pid in ipairs(getPlayersOnline()) do
            if pid ~= cid then
                pid:say("O player "..player:getName().." ganhou "..item:getName().."", TALKTYPE_MONSTER_SAY) -- se nao for lendario, mandar uma mensagem comum
            end
        end
    end
end

local function delay(position, aux)
    local item = Tile(position):getTopDownItem()
    if item then
        local slot = aux + 1
        item:moveTo(slots[slot])
    end   
end

local function exec(cid)
    --calcular uma chance e atribuir um item
    local rand = math.random(1, 100)
    local aux, memo = 0, 0
    if rand >= 1 then
        for i = 1, #itemtable do
            local randitemid = itemtable[i].id
            local randitemchance = itemtable[i].chance
            if rand >= randitemchance then
                aux = aux + 1
                memo = randitemchance
            end
            
        end
    end
    -- Passo um: Criar um item no primeiro SLOT, e deletar se houver o item do ultimo slot.
    Game.createItem(itemtable[aux].id, 1, slots[1])
    slots[1]:sendMagicEffect(CONST_ME_POFF)
    local item = Tile(slots[#slots]):getTopDownItem()
    if item then
        item:remove()
    end
    --Passo dois: Mover itens para o proximo slot em todos os slots de 1 a 12 para o 2 > 13
    local maxslot = #slots-1
    local lastloop = 0
    for i = 1, maxslot do
        
        addEvent(delay, 1*1*60, slots[i], i)
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if not player then
        return false
    end
    if not player:removeItem(5091, 1) then -- PARA JOGAR o player precisa ter o item 5091, que representa um bilhete vendido na store ou em um npc....
        return false
    end
    
    item:transform(decayItems[item.itemid])
    item:decay()   
    --muda actionid do item para nao permitir executar duas instancias
    item:setActionId(18563)
    
    local segundos = 30
    local loopsize = segundos*2
    
    for i = 1, loopsize do
        addEvent(exec, 1*i*500, cid.uid)
    end
    addEvent(ender, (1*loopsize*500)+1000, cid.uid, fromPosition)
    
    return true
end
 
Paste it into creaturescripts/others/advance_save.lua

Lua:
local lv = player:getLevel()

Lua:
    -- rewards for lvl
    local storage = 999000
    if skill == SKILL_LEVEL then
        if lv >= 50 then
            if player:getStorageValue(storage) ~= 1 then
                player:setStorageValue(storage, 1)
                player:addItem(2160, 2)
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Congratulations! You advanced to level 50! You have been rewarded with 2 crystal coins.')
            end
        end
    end
 
Last edited:
hi can someone help me with this script its a talkaction from this post CreatureEvent - [TFS 1.3] Item Sets (https://otland.net/threads/tfs-1-3-item-sets.263693/)
I tried to do by myself but im not very good in lua

Lua:
SETS_TEXT = ""

function onSay(player, words, param)
    if SETS_TEXT == "" then
        local text = "=============================\n ========== Item Sets ==========\n============================="

        for i = 1, #ITEM_SETS do
            local itemSet = ITEM_SETS[i]
            text = string.format("%s\n\n[%s]\n\nParts:", text, itemSet.name)
            for _, part in ipairs(itemSet.parts) do
                local tempItem = Game.createItem(part.item, 1)
                local itemName =
                    tempItem:getName():gsub(
                    "(%a)(%a+)",
                    function(a, b)
                        return string.upper(a) .. string.lower(b)
                    end
                )
                text = string.format("%s\n- %s", text, itemName)
                tempItem:remove()
            end
            text = string.format("%s\n\nBonuses:", text)
            text = text .. formatSetBonuses(itemSet.bonuses)
        end
        SETS_TEXT = text
    end

    player:showTextDialog(6103, SETS_TEXT)
end

function formatSetBonuses(bonuses)
    local text = ""
    for _, bonusParts in ipairs(bonuses) do
        text = string.format("%s\n%d / %d", text, _, #bonuses)
        for _, bonus in ipairs(bonusParts) do
            if bonus.type.combatType == BONUS_TYPES.TRIGGER then
                text = string.format("%s\n- %d%% chance to cast %s dealing %d-%d damage", text, bonus.chance, bonus.type.name, bonus.min, bonus.max)
            else
                text = string.format("%s\n- %s +%d%s", text, bonus.type.name, bonus.value, bonus.type.percentage == true and "%" or "")
            end
        end
        text = string.format("%s\n--------------------------------------------", text)
    end
    return text
end
 
could someone convert this please

Lua:
local config = {
   idcoin = 24774
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local player = Player(cid)
   local item = Item(item.uid)
   if player:getItemCount(config.idcoin) > 0 then
       local coinplayer = player:getCoinsBalance()+item:getCount()
       player:getPosition():sendMagicEffect(15)
       item:remove()
       player:setCoinsBalance(coinplayer)
   else
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to carry tibia coins in your backpack.")
   end
   return true
end
 
Lua:
local tibia_coin = Action()

function tibia_coin.onUse(player)
    local count = player:getItemCount(24774)
    if count >= 1 then
        if player:removeItem(24774, count) then
            db.query("UPDATE `znote_accounts` SET `points` = `points` + " .. count .. " WHERE `id` = " .. player:getAccountId() .. ";")
            if not player:isInGhostMode() then
                player:getPosition():sendMagicEffect(32)
                player:say("+".. count .. " Tibia Coins", TALKTYPE_MONSTER_SAY, false, player)
            end
        end
    else
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have to carry Tibia Coins in your backpack.")
    end
    return true
end

tibia_coin:id(24774)
tibia_coin:register()
Post automatically merged:

Can someone update this to TFS 1.3?
 
Last edited:
I have a request:
it is possible to create a "bury treasure" system?
Would be like this:
You use a shovel (or any item of your election) and you can make a hole in any ground (grass, desert, snow etc.) could be a custom "hole" item, and you can hide items inside like a depot, then after a X time the hole will decay to the gound that was before and the char can back later and take the buried stuff, it means, all the grounds of the server could be a potential depot or a place to hide things (lootbags, weapons, gp, etc) without need to go to the dp
It is possible?
 
Can you pass this script on to TFS 1.3?
It is an exphit system

local stages = { -- ["DELEVEL-ATELEVEL"] = EXP, (OBS: NUNCA REPETIR O MSM NUMERO, SEMPRE COLOCAR UM A MAIS.)
["1-50"] = 300,
["51-100"] = 150,
["101-150"] = 75,
["151-200"] = 15,
["201-250"] = 10,
["251-300"] = 3,
["301-350"] = 2,
["351-400"] = 1,
["401-450"] = 0.7,
["451-500"] = 0.6,
["501-1000"] = 0.3,

}
ultimateExp = 0.1 -- exp que vai usar caso o level do player não tiver mais na tabela .

-- CONFIGURAÇÕES DA PARTY

partyPorcent = 40 -- Quantos Porcento da exp vai para os membros da party
levelBlockParty = 1000 -- Diferença Maxima de Level permitida para membro da party ganhar exp.
expShareRadiusX = 30 -- Distancia maxima permitida no eixo X para membro da party ganhar exp.
expShareRadiusY = 30 -- Distancia maxima permitida no eixo Y para membro da party ganhar exp.
expShareRadiusZ = 1 -- Distancia maxima permitida no eixo Z para membro da party ganhar exp.

-- CONFIGURAÇÕES DE RINGS --

local rings = { -- [ID DO ANEL] = EXP MULTIPLICADA POR X EXP.
[181] = 1.5,
[148] = 1.5,

}

local rate_bonus = get_bonus_weekend_exp()

-- FIM DAS CONFIGURAÇÕES --

function CalculeExp(monsterhp, exptotal, hit)
hit = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
return hit < 0 and 0 or hit
end

function isSummon(cid)
return getCreatureMaster(cid)
end

function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(attacker) and isMonster(cid) then
if getCreatureStorage(cid, 50001) ~= 1 then
doCreatureSetStorage(cid, 50002, getMonsterInfo(getCreatureName(cid)).experience * rateExp)
doCreatureSetStorage(cid, 50001, 1)
end
end
if type == STATSCHANGE_HEALTHLOSS then
if isMonster(cid) then
if isCreature(attacker) then
local _cid = isSummon(attacker) and getCreatureMaster(attacker) or attacker
if isPlayer(_cid) then
if useStages then
for strstage, experience in pairs(stages) do
tabstage = string.explode(strstage, "-")
if getPlayerLevel(_cid) >= tonumber(tabstage[1]) and getPlayerLevel(_cid) <= tonumber(tabstage[2]) then
ultimateExp = experience

end
end
experienceRate = ultimateExp
else
experienceRate = rateExp
end
local expgain = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * experienceRate, value)
if getCreatureStorage(cid, 50002) > 0 then
if getCreatureStorage(cid, 50002) - expgain < 0 then
expgain = getCreatureStorage(cid, 50002)
end
doCreatureSetStorage(cid, 50002, getCreatureStorage(cid, 50002) - expgain)
local ringexp = 1
for idring, expring in pairs(rings) do
if getPlayerSlotItem(_cid, 9).itemid == idring then
ringexp = expring
break
end
end
local premiumMultipliqueExp = isPremium(_cid) and premiumMultipliqueExp or 1

expgain = expgain * ringexp * premiumMultipliqueExp * rate_bonus
expboost = expgain
local testring2 = expgain - (expgain / rate_bonus)
local party = false
if isInParty(_cid) then
local partyMembers, expParty = getPartyMembers(getPartyLeader(_cid)), expgain / 100 * partyPorcent
for indice, partyMember in pairs(partyMembers) do
attackerLevel, partyLevel = getPlayerLevel(_cid), getPlayerLevel(partyMember)
attackerPos, partyPos = getThingPos(_cid), getThingPos(partyMember)
x = false
if math.abs(attackerLevel - partyLevel) > levelBlockParty then
x = true
elseif math.abs(attackerPos.x - partyPos.x) > expShareRadiusX then
x = true
elseif math.abs(attackerPos.y - partyPos.y) > expShareRadiusY then
x = true
elseif attackerPos.z ~= partyPos.z then
x = true
elseif _cid == partyMember then
x = true
end
if x then
partyMembers[indice] = nil
end
end
if #partyMembers ~= 0 then
expParty = math.ceil(expgain / 100 * partyPorcent)
expmember = math.ceil(expParty / #partyMembers)
for _, member in pairs(partyMembers) do
if member ~= _cid then
doPlayerSendTextMessage(member, 12, "You received "..expmember.." party exp.")
doPlayerAddExp(member, expmember)
end
end
doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp. (" ..partyPorcent.."% send to party)")
doPlayerAddExp(_cid, expgain - expParty)
party = true
else
party = false
end
end
if not party then
doPlayerAddExp(_cid, expgain)
doSendAnimatedText(getThingPos(_cid), math.ceil(expgain), 215)
doPlayerSendTextMessage(_cid, 23, "Você ganhou "..math.ceil(expgain).." exp.")
if getPlayerSlotItem(_cid, 9).itemid == 148 or getPlayerSlotItem(_cid, 9).itemid == 181 then
local bonus_ring = math.ceil((expgain-(expgain/(ringexp * premiumMultipliqueExp))))
doPlayerSendTextMessage(_cid, 23, "Você ganhou "..bonus_ring.." de bonus experiencia com ROE.")
end
if getGlobalStorageValue(config_weekend_exp.storage_bonus) == 1 then
doPlayerSendTextMessage(_cid, 23, "[Weekend Exp Event] Voce esta com "..((rate_bonus - 1)*100).."% de bonus experiencia.")
end
end
end
end
end
end
end
return true
end

function onCombat(cid, target)
if isMonster(target) and not isSummon(target) and not isPlayer(target) then
registerCreatureEvent(target, "ExpGain")
end
return true
end
 
Hello

i have a request about script lua for talkaction in game shop,
I try with header and footer but still not working

Lua:
local shop = TalkAction ("!Tienda")

function onSay(player, words, param)
    local storage = 85043
    local cooldown = 10

    if player:getStorageValue(storage) <= os.time() then
        player:setStorageValue(storage, os.time() + cooldown)

        local type_desc = {
            "itemids",
            "pending premium (skip)",
            "pending gender change (skip)",
            "pending character name change (skip)",
            "Outfit and addons",
            "Mounts",
            "Instant house purchase"
        }
        print("Player: " .. player:getName() .. " triggered !shop talkaction.")
        -- Create the query
        local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. player:getAccountId() .. ";")
        local served = false

        -- Detect if we got any results
        if orderQuery ~= false then
            repeat
                -- Fetch order values
                local q_id = result.getNumber(orderQuery, "id")
                local q_type = result.getNumber(orderQuery, "type")
                local q_itemid = result.getNumber(orderQuery, "itemid")
                local q_count = result.getNumber(orderQuery, "count")

                local description = "Unknown or custom type"
                if type_desc[q_type] ~= nil then
                    description = type_desc[q_type]
                end
                print("Processing type "..q_type..": ".. description)

                -- ORDER TYPE 1 (Regular item shop products)
                if q_type == 1 then
                    served = true
                    -- Get weight
                    if player:getFreeCapacity() >= ItemType(q_itemid):getWeight(q_count) then
                        db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                        player:addItem(q_itemid, q_count)
                        player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! Has recibido " .. q_count .. " x " .. ItemType(q_itemid):getName() .. "!")
                    else
                        player:sendTextMessage(MESSAGE_STATUS_WARNING, "Necessitas map capacity!")
                    end
                end

                -- ORDER TYPE 5 (Outfit and addon)
                if q_type == 5 then
                    served = true

                    local itemid = q_itemid
                    local outfits = {}

                    if itemid > 1000 then
                        local first = math.floor(itemid/1000)
                        table.insert(outfits, first)
                        itemid = itemid - (first * 1000)
                    end
                    table.insert(outfits, itemid)

                    for _, outfitId in pairs(outfits) do
                        -- Make sure player don't already have this outfit and addon
                        if not player:hasOutfit(outfitId, q_count) then
                            db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            player:addOutfit(outfitId)
                            player:addOutfitAddon(outfitId, q_count)
                            player:sendTextMessage(MESSAGE_INFO_DESCR, "Felicitaciones! Tienes un nuevo outfit!")
                        else
                            player:sendTextMessage(MESSAGE_STATUS_WARNING, "Ya tienes este outfit y addon!")
                        end
                    end
                end

                if Game.getClientVersion().min >= 870 then
                    -- ORDER TYPE 6 (Mounts)
                    if q_type == 6 then
                        served = true
                        -- Make sure player don't already have this outfit and addon
                        if not player:hasMount(q_itemid) then
                            db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            player:addMount(q_itemid)
                            player:sendTextMessage(MESSAGE_INFO_DESCR, "Felicitaciones! Has reicibido una nueva mount!")
                        else
                            player:sendTextMessage(MESSAGE_STATUS_WARNING, "Ya tienes esta mount!")
                        end
                    end
                end

                -- ORDER TYPE 7 (Direct house purchase)
                if orderType == 7 then
                    served = true
                    local house = House(orderItemId)
                    -- Logged in player is not necessarily the player that bough the house. So we need to load player from db.
                    local buyerQuery = db.storeQuery("SELECT `name` FROM `players` WHERE `id` = "..orderCount.." LIMIT 1")
                    if buyerQuery ~= false then
                        local buyerName = result.getString(buyerQuery, "name")
                        result.free(buyerQuery)
                        if house then
                            db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. orderId .. ";")
                            house:setOwnerGuid(orderCount)
                            player:sendTextMessage(MESSAGE_INFO_DESCR, "Has comprado la casa "..house:getName().." on "..buyerName..", procura tener el dinero en el banco par ala renta.")
                            print("Process complete. [".. buyerName .."] has received house: ["..house:getName().."]")
                        end
                    end
                end

                -- Add custom order types here
                -- Type 1 is for itemids (Already coded here)
                -- Type 2 is for premium (Coded on web)
                -- Type 3 is for gender change (Coded on web)
                -- Type 4 is for character name change (Coded on web)
                -- Type 5 is for character outfit and addon (Already coded here)
                -- Type 6 is for mounts (Already coded here)
                -- Type 7 is for Instant house purchase (Already coded here)
                -- So use type 8+ for custom stuff, like etc packages.
                -- if q_type == 8 then
                -- end
            until not result.next(orderQuery)
            result.free(orderQuery)
            if not served then
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "No tienes ordenes en processo en el juego.")
            end
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "No tienes ordenes pendientes.")
        end
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Solo puedes usar cada " .. cooldown .. " segundos. Remaining cooldown: " .. player:getStorageValue(storage) - os.time())
    end
    return false
end

shop:register()

Thanks you in advance!
 
Hello

i have a request about script lua for talkaction in game shop,
I try with header and footer but still not working

Lua:
local shop = TalkAction ("!Tienda")

function onSay(player, words, param)
    local storage = 85043
    local cooldown = 10

    if player:getStorageValue(storage) <= os.time() then
        player:setStorageValue(storage, os.time() + cooldown)

        local type_desc = {
            "itemids",
            "pending premium (skip)",
            "pending gender change (skip)",
            "pending character name change (skip)",
            "Outfit and addons",
            "Mounts",
            "Instant house purchase"
        }
        print("Player: " .. player:getName() .. " triggered !shop talkaction.")
        -- Create the query
        local orderQuery = db.storeQuery("SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = " .. player:getAccountId() .. ";")
        local served = false

        -- Detect if we got any results
        if orderQuery ~= false then
            repeat
                -- Fetch order values
                local q_id = result.getNumber(orderQuery, "id")
                local q_type = result.getNumber(orderQuery, "type")
                local q_itemid = result.getNumber(orderQuery, "itemid")
                local q_count = result.getNumber(orderQuery, "count")

                local description = "Unknown or custom type"
                if type_desc[q_type] ~= nil then
                    description = type_desc[q_type]
                end
                print("Processing type "..q_type..": ".. description)

                -- ORDER TYPE 1 (Regular item shop products)
                if q_type == 1 then
                    served = true
                    -- Get weight
                    if player:getFreeCapacity() >= ItemType(q_itemid):getWeight(q_count) then
                        db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                        player:addItem(q_itemid, q_count)
                        player:sendTextMessage(MESSAGE_INFO_DESCR, "Congratulations! Has recibido " .. q_count .. " x " .. ItemType(q_itemid):getName() .. "!")
                    else
                        player:sendTextMessage(MESSAGE_STATUS_WARNING, "Necessitas map capacity!")
                    end
                end

                -- ORDER TYPE 5 (Outfit and addon)
                if q_type == 5 then
                    served = true

                    local itemid = q_itemid
                    local outfits = {}

                    if itemid > 1000 then
                        local first = math.floor(itemid/1000)
                        table.insert(outfits, first)
                        itemid = itemid - (first * 1000)
                    end
                    table.insert(outfits, itemid)

                    for _, outfitId in pairs(outfits) do
                        -- Make sure player don't already have this outfit and addon
                        if not player:hasOutfit(outfitId, q_count) then
                            db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            player:addOutfit(outfitId)
                            player:addOutfitAddon(outfitId, q_count)
                            player:sendTextMessage(MESSAGE_INFO_DESCR, "Felicitaciones! Tienes un nuevo outfit!")
                        else
                            player:sendTextMessage(MESSAGE_STATUS_WARNING, "Ya tienes este outfit y addon!")
                        end
                    end
                end

                if Game.getClientVersion().min >= 870 then
                    -- ORDER TYPE 6 (Mounts)
                    if q_type == 6 then
                        served = true
                        -- Make sure player don't already have this outfit and addon
                        if not player:hasMount(q_itemid) then
                            db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
                            player:addMount(q_itemid)
                            player:sendTextMessage(MESSAGE_INFO_DESCR, "Felicitaciones! Has reicibido una nueva mount!")
                        else
                            player:sendTextMessage(MESSAGE_STATUS_WARNING, "Ya tienes esta mount!")
                        end
                    end
                end

                -- ORDER TYPE 7 (Direct house purchase)
                if orderType == 7 then
                    served = true
                    local house = House(orderItemId)
                    -- Logged in player is not necessarily the player that bough the house. So we need to load player from db.
                    local buyerQuery = db.storeQuery("SELECT `name` FROM `players` WHERE `id` = "..orderCount.." LIMIT 1")
                    if buyerQuery ~= false then
                        local buyerName = result.getString(buyerQuery, "name")
                        result.free(buyerQuery)
                        if house then
                            db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. orderId .. ";")
                            house:setOwnerGuid(orderCount)
                            player:sendTextMessage(MESSAGE_INFO_DESCR, "Has comprado la casa "..house:getName().." on "..buyerName..", procura tener el dinero en el banco par ala renta.")
                            print("Process complete. [".. buyerName .."] has received house: ["..house:getName().."]")
                        end
                    end
                end

                -- Add custom order types here
                -- Type 1 is for itemids (Already coded here)
                -- Type 2 is for premium (Coded on web)
                -- Type 3 is for gender change (Coded on web)
                -- Type 4 is for character name change (Coded on web)
                -- Type 5 is for character outfit and addon (Already coded here)
                -- Type 6 is for mounts (Already coded here)
                -- Type 7 is for Instant house purchase (Already coded here)
                -- So use type 8+ for custom stuff, like etc packages.
                -- if q_type == 8 then
                -- end
            until not result.next(orderQuery)
            result.free(orderQuery)
            if not served then
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "No tienes ordenes en processo en el juego.")
            end
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "No tienes ordenes pendientes.")
        end
    else
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Solo puedes usar cada " .. cooldown .. " segundos. Remaining cooldown: " .. player:getStorageValue(storage) - os.time())
    end
    return false
end

shop:register()

Thanks you in advance!
Édit , solution i deleted line gameclientversion
 
Someone would have the talkaction script "! Flask" or "! Vials", that when speaking the command the flasks disappear instead of coming to backpack.
 
Hello everyone,

Today i was modifying an ancient script, the forge, and is working perfect, but is not very RPG forge.
Im looking for some help, i have tried several local position = and others lines but not working,
I want add for example on a training room ( without monsters ) but like a depot, no one can enter and push, and,

Put a left item 1, put a right item 2 ( necessary items )
In the middle appears the item,
The script works, for one item, use it on you, and for 2 you can use it on backpack and i want do it more rpg, if anyone can explain me , thanks in advance

Lua:
local mpa = Action()

local craft = {
    level = 100,
    items = {
        [1] = {item = 2800, count = 100},
        [2] = {item = 2159, count = 200},
       
    },
    craftedItem = {2472, 1},
}

function mpa.onUse(player, item, fromPosition, itemEx, toPosition)
   
    if player:getLevel() < craft.level then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You do not have level, you will need level 100.")
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end
             
    for k, v in pairs(craft.items) do
        if player:getItemCount(v.item) < v.count then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You do not have necessary items, items necessary x100 Star Herb + x200 Scarab Coins.")
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            return true
        end
    end

    for k, v in pairs(craft.items) do
        player:removeItem(v.item, v.count)
    end

    player:addItem(craft.craftedItem[1], craft.craftedItem[2])
    player:removeItem(item.itemid, 1)
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You have Crafted: "..craft.craftedItem[2].."x "..ItemType(craft.craftedItem[1]):getName()..".")
    player:getPosition():sendMagicEffect(50)
   
    return true
end

mpa:id(2800, 2159)
mpa:register()
 
can you create curses for one quest? ex: have 30% chance to curse the player with one curse below:

1: -5% hp each 10sec;

2: if you kill one creature in one area with corners(X, Y) has a chance to spawn one creature closer you.

3: if you attack one creature, has a chance in the last hit, the creature heal himself complete.

4: if you kill one certain number of creature, you have a 50% chance to kill himself

if the player stay more long time wich 30min with one curse, he will killed.

thank you <3

it's equal to curse of Soul War? or adapted? your choice
 
i was wondering if you can make an example of a quest chest that the player need kill x monster to be opened.
i dont have level doors on my server but i want for example if a player go to crusader helmet quest that player who want do the quest need to kill the giant spider if he don't kill the giant spider can't open the chest :) please if that is possible ofc and hope you understand what i mean :D thanks
 
Lua Script E
Paste it into creaturescripts/others/advance_save.lua

Lua:
local lv = player:getLevel()

Lua:
    -- rewards for lvl
    local storage = 999000
    if skill == SKILL_LEVEL then
        if lv >= 50 then
            if player:getStorageValue(storage) ~= 1 then
                player:setStorageValue(storage, 1)
                player:addItem(2160, 2)
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Congratulations! You advanced to level 50! You have been rewarded with 2 crystal coins.')
            end
        end
    end

Lua script error: [Scripts Interface]
C:\Users\........\otservbr-global-develop\data\scripts\creaturescripts\others\advance_save.lua
...lop\data\scripts\creaturescripts\others\advance_save.lua:29: attempt to index global 'player' (a nil value)
stack traceback:
[C]: in function '__index'
...lop\data\scripts\creaturescripts\others\advance_save.lua:29: in main chunk
[C]: in function 'reload'
 
hi I'm new in revscipts and my question is how is make example multi chest quest like this
Lua:
function onUse(cid, item, frompos, item2, topos)

       if item.uid == 8560 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Emerald Sword.")
               doPlayerAddItem(cid,8930,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8561 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Spellbook of dark Mysteries.")
               doPlayerAddItem(cid,8918,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8562 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Master Archer's Armor.")
               doPlayerAddItem(cid,8888,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8563 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Robe of the Underworld.")
               doPlayerAddItem(cid,8890,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8564 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Fireborn Giant Armor.")
               doPlayerAddItem(cid,8881,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8565 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Obsidian Truncheon.")
               doPlayerAddItem(cid,8928,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8566 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Royal Crossbow.")
               doPlayerAddItem(cid,8851,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8567 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Warsinger Bow.")
               doPlayerAddItem(cid,8854,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end
       elseif item.uid == 8568 then
           queststatus = getPlayerStorageValue(cid,8560)
           if queststatus == -1 then
               doPlayerSendTextMessage(cid,22,"You have found a Hellforged Axe.")
               doPlayerAddItem(cid,8924,1)
               doPlayerAddOutfit(cid, 289, 2)
               doPlayerAddOutfit(cid, 288, 2)
               setPlayerStorageValue(cid,8560,1)
           else
               doPlayerSendTextMessage(cid,22,"It is empty.")
           end

    else
        return 0
       end

       return 1
end

and normal quest with items,exp,mount,outfits ?
Thanks for help ;)
 
Anyone can make a script that converts the Mirror Image monster into Knight, Druid, Sorcerer, or Paladin Apparition.
If EK hits first the Mirror Image it will be converted into Knight's Apparition, if ED hits first it converts into Druid's Apparition-

Thanks.
 
Lua Script E
It's my function:
Lua:
function advanceSave.onAdvance(player, skill, oldLevel, newLevel)

Your script is using cid instead of player, example:
Lua:
function advanceSave.onAdvance(cid, skill, oldLevel, newLevel)
Under function add this line:
Lua:
local player = Player(cid)
or change cid to player but you will have to change code inside everywhere where is cid.
 
hello could you make available a free bless Revscriptsys up to level 999?

and

configure this script for revscriptsys?

local config = {
--{exp, item, quantidade}
{40000, 2152, 5}, -- lower level
{90000, 2152, 6}, -- same level
{110000, 2152, 7}, -- higher level
}

function onKill(cid, target)
if isPlayer(cid) and isPlayer(target) then
if getPlayerLevel(target) < getPlayerLevel(cid) then
doPlayerAddItem(cid, config[1][2], config[1][3])
doPlayerAddExp(cid, config[1][1])

elseif getPlayerLevel(target) == getPlayerLevel(cid) then
doPlayerAddItem(cid, config[2][2], config[2][3])
doPlayerAddExp(cid, config[2][1])

elseif getPlayerLevel(target) > getPlayerLevel(cid) then
doPlayerAddItem(cid, config[3][2], config[3][3])
doPlayerAddExp(cid, config[3][1])
end
end
return true
end
 
Looking to create a script which gives double loot chance
Lua:
local creatureevent = CreatureEvent("extraloot")
requirePremium = true -- true/false
extraLootChance = 12 -- loot chance percent
function creatureevent.onKill((creature, target)
    local targetMonster = target:getMonster()
    if not targetMonster then
        return print("targetMonster = true")
        return true
    end
    if math.random(100) <= extraLootChance then
        success = true
    else
        sucess = false
    end
    return print("Success is: " .. success)
    local loot = creature:getLoot()
    return print(creature " loot is: " .. loot)
    if success then
        if requirePremium then
            if (!player:isPremium()) then
                return print("Player is premium.")
                return true
            else
                return true
            end
        else
            return print("Player is not premium.")
            return true
        end
    else
        return true
    end
end
 
Last edited:
Back
Top