Ir para conteúdo
  • Cadastre-se

(Resolvido)[ACTION] remover potion flask


Ir para solução Resolvido por Xagah,

Posts Recomendados

Olá pessoal, gostaria de saber como poso colocar pras potions flask sumirem sozinhas, ou não aparecerem, logo após utilizar a potion!

aqui esta meu potion.lua! Meu ot é global 10.90 tfs 1.2

Spoiler

local config = {
    -- strong health potion
    [7588] = {health = {250, 350}, vocations = {3, 4}, text = 'paladins and knights', level = 50, emptyId = 7635},
    -- strong mana potion
    [7589] = {mana = {115, 185}, vocations = {1, 2, 3}, text = 'sorcerers, druids and paladins', level = 50, emptyId = 7635},
    -- great mana potion
    [7590] = {mana = {150, 250}, vocations = {1, 2}, text = 'sorcerers and druids', level = 80, emptyId = 7635},
    -- great health potion
    [7591] = {health = {425, 575}, vocations = {4}, text = 'knights', level = 80, emptyId = 7635},
    -- health potion potion
    [7618] = {health = {125, 175}, emptyId = 7636},
    -- mana potion potion
    [7620] = {mana = {75, 125}, emptyId = 7636},
    -- great spirit potion
    [8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3}, text = 'paladins', level = 80, emptyId = 7635},
    -- ultimate health potion
    [8473] = {health = {650, 850}, vocations = {4}, text = 'knights', level = 130, emptyId = 7635},
    -- antidote potion
    [8474] = {antidote = true, emptyId = 7636},
    -- small health potion
    [8704] = {health = {60, 85}, emptyId = 7636}
}

local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = config[item.itemid]
    if not potion then
        return true
    end

    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end

    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end

    if potion.antidote and not antidote:execute(itemEx.uid, Variant(itemEx.uid)) then
        return false
    end

    if (potion.level and player:getLevel() < potion.level)
            or (type(potion.vocations) == 'table' and not isInArray(potion.vocations, player:getVocation():getBase():getId()))
            and not (player:getGroup():getId() >= 2) then
        player:say(string.format('This potion can only be consumed by %s of level %d or higher.', potion.text, potion.level), TALKTYPE_MONSTER_SAY)
        return true
    end

    if type(potion.health) == 'table' and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

    if type(potion.mana) == 'table' and not doTargetCombatMana(0, itemEx.uid, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

        local cStorage = player:getStorageValue(Storage.Achievements.PotionAddict)
    if cStorage < 100000 then
        player:setStorageValue(Storage.Achievements.PotionAddict, math.max(1, cStorage) + 1)
    elseif cStorage == 100000 then
        player:addAchievement('Potion Addict')
        player:setStorageValue(Storage.Achievements.PotionAddict, 100001)
    end
    
    doCreatureSayWithRadius(itemEx.uid, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2, toPosition)
    setPlayerStorageValue(cid, 14582, getPlayerStorageValue(cid, 14582) + 1)
    Item(item.uid):remove(1)
    doPlayerAddItem(cid,potion.emptyId, 1)
    return true
end

 

Link para o post
Compartilhar em outros sites

MMHUCMQ.png  Esta é uma mensagem automática, este tópico foi movido para a área correta.
  Regras do fórum: http://www.tibiaking.com/forum/topic/1281-regras-gerais/#comment-7680

Este tópico foi movido:
De: Scripting OTServ > OTServ > Actions e TalkActions
Para: Suporte OTServ > OTServ > Suporte de Scripts

 

Tente assim:

Spoiler

local config = {
    -- strong health potion
    [7588] = {health = {250, 350}, vocations = {3, 4}, text = 'paladins and knights', level = 50, emptyId = 7635},
    -- strong mana potion
    [7589] = {mana = {115, 185}, vocations = {1, 2, 3}, text = 'sorcerers, druids and paladins', level = 50, emptyId = 7635},
    -- great mana potion
    [7590] = {mana = {150, 250}, vocations = {1, 2}, text = 'sorcerers and druids', level = 80, emptyId = 7635},
    -- great health potion
    [7591] = {health = {425, 575}, vocations = {4}, text = 'knights', level = 80, emptyId = 7635},
    -- health potion potion
    [7618] = {health = {125, 175}, emptyId = 7636},
    -- mana potion potion
    [7620] = {mana = {75, 125}, emptyId = 7636},
    -- great spirit potion
    [8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3}, text = 'paladins', level = 80, emptyId = 7635},
    -- ultimate health potion
    [8473] = {health = {650, 850}, vocations = {4}, text = 'knights', level = 130, emptyId = 7635},
    -- antidote potion
    [8474] = {antidote = true, emptyId = 7636},
    -- small health potion
    [8704] = {health = {60, 85}, emptyId = 7636}
}

local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = config[item.itemid]
    if not potion then
        return true
    end

    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end

    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end

    if potion.antidote and not antidote:execute(itemEx.uid, Variant(itemEx.uid)) then
        return false
    end

    if (potion.level and player:getLevel() < potion.level)
            or (type(potion.vocations) == 'table' and not isInArray(potion.vocations, player:getVocation():getBase():getId()))
            and not (player:getGroup():getId() >= 2) then
        player:say(string.format('This potion can only be consumed by %s of level %d or higher.', potion.text, potion.level), TALKTYPE_MONSTER_SAY)
        return true
    end

    if type(potion.health) == 'table' and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

    if type(potion.mana) == 'table' and not doTargetCombatMana(0, itemEx.uid, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

        local cStorage = player:getStorageValue(Storage.Achievements.PotionAddict)
    if cStorage < 100000 then
        player:setStorageValue(Storage.Achievements.PotionAddict, math.max(1, cStorage) + 1)
    elseif cStorage == 100000 then
        player:addAchievement('Potion Addict')
        player:setStorageValue(Storage.Achievements.PotionAddict, 100001)
    end
    
    doCreatureSayWithRadius(itemEx.uid, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2, toPosition)
    setPlayerStorageValue(cid, 14582, getPlayerStorageValue(cid, 14582) + 1)
    Item(item.uid):remove(1)
    return true
end

 

Editado por Wakon (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

@77mateus77 subistitua seu script por este 

 

potions.lua

Spoiler

local config = {

removeOnUse = "no",

usableOnTarget = "yes", -- can be used on target? (fe. healing friend)

splashable = "no",

realAnimation = "no", -- make text effect visible only for players in range 1x1

healthMultiplier = 1.0,

manaMultiplier = 1.0

}


config.removeOnUse = getBooleanFromString(config.removeOnUse)

config.usableOnTarget = getBooleanFromString(config.usableOnTarget)

config.splashable = getBooleanFromString(config.splashable)

config.realAnimation = getBooleanFromString(config.realAnimation)


local POTIONS = {

[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion

[7618] = {empty = 7636, splash = 2, health = {100, 200}}, -- health potion

[7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion

[7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion

[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion


[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion

[7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion

[7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion


[8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion

}


local exhaust = createConditionObject(CONDITION_EXHAUST)

setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))


function onUse(cid, item, fromPosition, itemEx, toPosition)

local potion = POTIONS[item.itemid]

if(not potion) then

return false

end


if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then

if(not config.splashable) then

return false

end


if(toPosition.x == CONTAINER_POSITION) then

toPosition = getThingPos(item.uid)

end


doDecayItem(doCreateItem(2016, potion.splash, toPosition))

doTransformItem(item.uid, potion.empty)

return true

end


if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then

doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)

return true

end


if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and

not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))

then

doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)

return true

end


local health = potion.health

if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then

return false

end


local mana = potion.mana

if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then

return false

end


doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)

if(not realAnimation) then

doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)

else

for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do

if(isPlayer(tid)) then

doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)

end

end

end


doAddCondition(cid, exhaust)

if(not potion.empty or config.removeOnUse) then

doRemoveItem(item.uid, 1)

return true

end

doRemoveItem(item.uid, 1)

doPlayerAddItem(cid, potion.empty, 1)

	pot_count = getPlayerItemCount(cid, potion.empty)

	doPlayerRemoveItem(cid, potion.empty, pot_count)

	doPlayerAddItem(cid, potion.empty, pot_count)

return true

end[/code]

 

Editado por Bagon (veja o histórico de edições)

                                                       “Enquanto nos derem ao menos 1% de chance, seguiremos lutando.

                                                     E venceremos! Esse é o verdadeiro e único Clube da Fé! Vai São Paulo!”

                                                                                       spfc.png

Link para o post
Compartilhar em outros sites
  • Solução

Bah, desculpe, mas claro que não!

 

@77mateus77, só remova esta linha:

 

 doPlayerAddItem(cid,potion.emptyId, 1)

e boa.

 

Ajudei? Rep++

5YkRF3w.gif

 

 

 

 

 

 

CzysZUR.gifytaam6k.png

 

 

Link para o post
Compartilhar em outros sites
  • Moderador
10 horas atrás, 77mateus77 disse:

Olá pessoal, gostaria de saber como poso colocar pras potions flask sumirem sozinhas, ou não aparecerem, logo após utilizar a potion!

aqui esta meu potion.lua! Meu ot é global 10.90 tfs 1.2

  Ocultar conteúdo

local config = {
    -- strong health potion
    [7588] = {health = {250, 350}, vocations = {3, 4}, text = 'paladins and knights', level = 50, emptyId = 7635},
    -- strong mana potion
    [7589] = {mana = {115, 185}, vocations = {1, 2, 3}, text = 'sorcerers, druids and paladins', level = 50, emptyId = 7635},
    -- great mana potion
    [7590] = {mana = {150, 250}, vocations = {1, 2}, text = 'sorcerers and druids', level = 80, emptyId = 7635},
    -- great health potion
    [7591] = {health = {425, 575}, vocations = {4}, text = 'knights', level = 80, emptyId = 7635},
    -- health potion potion
    [7618] = {health = {125, 175}, emptyId = 7636},
    -- mana potion potion
    [7620] = {mana = {75, 125}, emptyId = 7636},
    -- great spirit potion
    [8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3}, text = 'paladins', level = 80, emptyId = 7635},
    -- ultimate health potion
    [8473] = {health = {650, 850}, vocations = {4}, text = 'knights', level = 130, emptyId = 7635},
    -- antidote potion
    [8474] = {antidote = true, emptyId = 7636},
    -- small health potion
    [8704] = {health = {60, 85}, emptyId = 7636}
}

local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = config[item.itemid]
    if not potion then
        return true
    end

    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end

    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end

    if potion.antidote and not antidote:execute(itemEx.uid, Variant(itemEx.uid)) then
        return false
    end

    if (potion.level and player:getLevel() < potion.level)
            or (type(potion.vocations) == 'table' and not isInArray(potion.vocations, player:getVocation():getBase():getId()))
            and not (player:getGroup():getId() >= 2) then
        player:say(string.format('This potion can only be consumed by %s of level %d or higher.', potion.text, potion.level), TALKTYPE_MONSTER_SAY)
        return true
    end

    if type(potion.health) == 'table' and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

    if type(potion.mana) == 'table' and not doTargetCombatMana(0, itemEx.uid, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

        local cStorage = player:getStorageValue(Storage.Achievements.PotionAddict)
    if cStorage < 100000 then
        player:setStorageValue(Storage.Achievements.PotionAddict, math.max(1, cStorage) + 1)
    elseif cStorage == 100000 then
        player:addAchievement('Potion Addict')
        player:setStorageValue(Storage.Achievements.PotionAddict, 100001)
    end
    
    doCreatureSayWithRadius(itemEx.uid, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2, toPosition)
    setPlayerStorageValue(cid, 14582, getPlayerStorageValue(cid, 14582) + 1)
    Item(item.uid):remove(1)
    doPlayerAddItem(cid,potion.emptyId, 1)
    return true
end

 

 

 

ai

 

local config = {
    -- strong health potion
    [7588] = {health = {250, 350}, vocations = {3, 4}, text = 'paladins and knights', level = 50},
    -- strong mana potion
    [7589] = {mana = {115, 185}, vocations = {1, 2, 3}, text = 'sorcerers, druids and paladins', level = 50},
    -- great mana potion
    [7590] = {mana = {150, 250}, vocations = {1, 2}, text = 'sorcerers and druids', level = 80},
    -- great health potion
    [7591] = {health = {425, 575}, vocations = {4}, text = 'knights', level = 80},
    -- health potion potion
    [7618] = {health = {125, 175},
    -- mana potion potion
    [7620] = {mana = {75, 125},
    -- great spirit potion
    [8472] = {health = {250, 350}, mana = {100, 200}, vocations = {3}, text = 'paladins', level = 80},
    -- ultimate health potion
    [8473] = {health = {650, 850}, vocations = {4}, text = 'knights', level = 130},
    -- antidote potion
    [8474] = {antidote = true},
    -- small health potion
    [8704] = {health = {60, 85}
}

local antidote = Combat()
antidote:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
antidote:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
antidote:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
antidote:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
antidote:setParameter(COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = Condition(CONDITION_EXHAUST_HEAL)
exhaust:setParameter(CONDITION_PARAM_TICKS, (configManager.getNumber(configKeys.EX_ACTIONS_DELAY_INTERVAL) - 100))
-- 1000 - 100 due to exact condition timing. -100 doesn't hurt us, and players don't have reminding ~50ms exhaustion.

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = config[item.itemid]
    if not potion then
        return true
    end

    if itemEx.itemid ~= 1 or itemEx.type ~= THING_TYPE_PLAYER then
        return true
    end

    local player = Player(cid)
    if player:getCondition(CONDITION_EXHAUST_HEAL) then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_YOUAREEXHAUSTED))
        return true
    end

    if potion.antidote and not antidote:execute(itemEx.uid, Variant(itemEx.uid)) then
        return false
    end

    if (potion.level and player:getLevel() < potion.level)
            or (type(potion.vocations) == 'table' and not isInArray(potion.vocations, player:getVocation():getBase():getId()))
            and not (player:getGroup():getId() >= 2) then
        player:say(string.format('This potion can only be consumed by %s of level %d or higher.', potion.text, potion.level), TALKTYPE_MONSTER_SAY)
        return true
    end

    if type(potion.health) == 'table' and not doTargetCombatHealth(0, itemEx.uid, COMBAT_HEALING, potion.health[1], potion.health[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

    if type(potion.mana) == 'table' and not doTargetCombatMana(0, itemEx.uid, potion.mana[1], potion.mana[2], CONST_ME_MAGIC_BLUE) then
        return false
    end

        local cStorage = player:getStorageValue(Storage.Achievements.PotionAddict)
    if cStorage < 100000 then
        player:setStorageValue(Storage.Achievements.PotionAddict, math.max(1, cStorage) + 1)
    elseif cStorage == 100000 then
        player:addAchievement('Potion Addict')
        player:setStorageValue(Storage.Achievements.PotionAddict, 100001)
    end
    
    doCreatureSayWithRadius(itemEx.uid, 'Aaaah...', TALKTYPE_MONSTER_SAY, 2, 2, toPosition)
    setPlayerStorageValue(cid, 14582, getPlayerStorageValue(cid, 14582) + 1)
    Item(item.uid):remove(1)
    return true
end

 

 

20230912_034613.png.cf49b650c34dd7d7b1f79bd49c70f53c.png

Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código.  #OpenSource #Programação #Contribuição

 

Link para o post
Compartilhar em outros sites
2 horas atrás, Xagah disse:

Bah, desculpe, mas claro que não!

 

@77mateus77, só remova esta linha:

 


 doPlayerAddItem(cid,potion.emptyId, 1)

e boa.

 

Ajudei? Rep++

Obrigado deu certinho! Rep++, e Obrigado a todos que tentaram me ajudar, não cheguei a testar o script de vocês, darei rep para todos!

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por Imperius
      Olá, pessoal! Acabei encontrando um script que tinha feito a um tempo atrás. Estou compartilhando aqui para quem quiser usar ou melhorar.
       
      É bem parecido com os outros sistemas de roleta, igual deste tópico: https://tibiaking.com/forums/topic/101557-action-cassino-roleta-de-items/
       
      Como funciona?
       
      O "Treasure Chest" é um item custom, onde o jogador têm a possibilidade de ganhar itens raros ou bem meia boca. Tudo dependerá da sorte.
       
      O jogador precisa tacar o treasure chest na bancada e acionar a alavanca. O treasure chest irá se transformar em vários itens de forma randômica no qual o jogador poderá ou não ganhar. No final, apenas um item é entregue ao jogador.
       
      Para entender melhor o seu funcionamento, segue o GIF abaixo:
       

       
       
      em data > actions > actions.xml
       
       
      em data > actions > scripts > crie um arquivo chamado leverTreasureChest.lua
       
       
      no banco de dados do servidor, adicione o seguinte código em "SQL":
       
       
       

      Também estou disponibilizando uma página PHP, para quem quiser usar no site do servidor. Na página tem informações sobre o funcionamento, quais são os possíveis prêmios e a lista de jogadores que ganharam os itens raros.
       

       
       
      Espero ter ajudado de alguma forma! : )
       
      treasure_chest.php
    • Por amoxicilina
      Action: Remover skull
       
       
    • Por Skyligh
      Olá pessoal, venho hoje aqui para postar um sistema de pokemon muito procurado, o famoso, Tm System. Siga o tutorial a risca ou seu trabalho será invão.
      Quote
      Seu Funcionameto: Basícamente funciona assim; ele adiciona um "Attack" novo a um pokemon ou substitui um existente, dependendo da vontado do player.
      Versões testadas: Qualquer derivado do PDA
      http://www.havencrest.co.uk/images/page-divider 2.jpg
      Vamos ao que interessa, vá em actions.xml e cole a seguinte tag:
        <action itemid="id do item que será usado" event="script" value="tmSystem.lua"/> Atenção o item que será usado no system, não deve ter o attributo "Usable" ou você terá erros. Agora crie um arquivo em {data/actions/scripts} chamado tmSystem.lua e cole o seguinte script dentro:
        function onUse(cid, item, frompos, item2, topos) local tm = tmabilities local pokemon = getCreatureSummons(cid)[1] local slotball = getPlayerSlotItem(cid, 8).uid local tmname = getItemNameById(item2.itemid) local i = item2.itemid if #getCreatureSummons(cid) == 0 then return doPlayerSendCancel(cid, "Need pokemon to learn a "..tmname..".") end if getItemAttribute(slotball, "TM") == tmname then return doPlayerSendCancel(cid, "Your pokemon was learned this TM.") end if isInArray(tm[""..tmname..""], getPokemonName(pokemon)) then doPlayerSetVocation(cid, 49) openChannelDialog(cid) else doPlayerSendCancel(cid, "This TM not compatible in your pokemon.") end return true end http://www.havencrest.co.uk/images/page-divider 2.jpg Agora vamos em {creaturescripts.xml} e colaremos a seguinte tag:
        <event type="joinchannel" name="TmChoose" event="script" value="tmsys.lua"/> Agora crie o arquivo tmsys.lua em {creaturescripts/scripts} e cole isso dentro:
        [CODE] function onJoinChannel(cid, channelId, users, isTv) if getPlayerVocation(cid) == 49 then else return true end local summon = getCreatureSummons(cid)[1] local moves = movestable[getCreatureName(summon)] local n = 1 for a = 1, 12 do local b = getNewMoveTable(moves, a) if b then n = n + 1 end end for b = 13, 23 do if channelId == b then local tm = tmabilities local pokemon = getCreatureSummons(cid)[1] local slotball = getPlayerSlotItem(cid, 8).uid local slotm = getPlayerSlotItem(cid, 9) local tmname = getItemNameById(slotm.itemid) if n >= channelId - 11 then doPlayerSendTextMessage(cid, 27, "Congralutions! Your "..getPokemonName(pokemon).." learn a new TM ("..tmname..").") doItemSetAttribute(slotball, "TM", tmname) doItemSetAttribute(slotball, "TMN", channelId - 11) doSendMagicEffect(getThingPosition(pokemon), 28) doSendMagicEffect(getThingPosition(pokemon), 29) doRemoveItem(slotm.uid) if useKpdoDlls then doUpdateMoves(cid) end else doPlayerSendCancel(cid, "Put tm on at last empty slot.") end return false end end return true end http://www.havencrest.co.uk/images/page-divider 2.jpgNesta parte você precisa de muita atenção, você terá que criar 10 channels como no modelo abaixo:
        <channel id="13" name="[Put on M1]"> <vocation id="49"/> </channel>   <channel id="14" name="[Put on M2]"> <vocation id="49"/> </channel> Em channel id você seguira a ordem 13 a 23, em vocations id pode deixar do jeito que esta. Agora crie uma vocation com o id 49 ou cole a seguinte tag no vocations.xml:
        <vocation id="49" name="TM" description="pokemon trainer" needpremium="0" gaincap="0" gainhp="55" gainmana="0" gainhpticks="0" gainhpamount="0" gainmanaticks="0" gainmanaamount="0" manamultiplier="1.1" attackspeed="-1" soulmax="251" gainsoulticks="-1" fromvoc="1" lessloss="0"> <formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/> <skill fist="2" club="2" sword="2" axe="2" distance="2" shielding="2" fishing="2" experience="1.1"/> </vocation> Imagem Postada http://www.havencrest.co.uk/images/page-divider 2.jpgAgora vamos em {data/lib} e crie um arquivo chamado tmSystem.lua e cole as seguintes linhas nele:
        tmabilities = { ["Solar Beam"] = {"Blastoise", "Venusaur", "Charizard"}, ["Fire Blast"] = {"Blastoise", "Venusaur", "Charizard"}, } Nesta parte você edita, para cada magia[""] = nome dos pokemons que poderam ter essa magia por tm. Tipo do jeito que esta ai, se você for tentar colocar um fire blast em um bulba não vai pegar.. Para adicionar mais magias, basta copiar a linha e colocar o nome da magia nova e seus respectivos pokemons. http://www.havencrest.co.uk/images/page-divider 2.jpg Preste atenção, para cada magia feita, terá que haver um item com o nome da magia. E o id deste item deve ser colocado na tag da actions. ou seja(exemplo): abra o item.xml pegue o item que deseje usar e coloque o nome "Solar Beam"(do mesmo jeito da lib), pegue o id dele e cole na tag da actions. Espero que tenham intendido está parte. http://www.havencrest.co.uk/images/page-divider 2.jpg A ultima parte da instalção, vamos em {data/talkactions/scripts} e abra o arquivo move1.lua e substitua a parte de "if it = 1" até o ultimo "end" antes da parte "if not move then":
        local msgs = {"use ", ""} function doAlertReady(cid, id, movename, n, cd) if not isCreature(cid) then return true end local myball = getPlayerSlotItem(cid, 8) if myball.itemid > 0 and getItemAttribute(myball.uid, cd) == "cd:"..id.."" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(myball.uid).." - "..movename.." (m"..n..") is ready!") return true end local p = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid) if not p or #p <= 0 then return true end for a = 1, #p do if getItemAttribute(p[a], cd) == "cd:"..id.."" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(p[a]).." - "..movename.." (m"..n..") is ready!") return true end end end function onSay(cid, words, param, channel) if param ~= "" then return true end if string.len(words) > 3 then return true end if #getCreatureSummons(cid) == 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a pokemon to use moves.") return 0 end --alterado v1.5 local mypoke = getCreatureSummons(cid)[1] if getCreatureCondition(cid, CONDITION_EXHAUST) then return true end if getCreatureName(mypoke) == "Evolution" then return true end if getCreatureName(mypoke) == "Ditto" or getCreatureName(mypoke) == "Shiny Ditto" then name = getPlayerStorageValue(mypoke, 1010) --edited else name = getCreatureName(mypoke) end --local name = getCreatureName(mypoke) == "Ditto" and getPlayerStorageValue(mypoke, 1010) or getCreatureName(mypoke) local it = string.sub(words, 2, 3) local move = movestable[name].move1 local cdzin = "move"..it.."" local slotball = getPlayerSlotItem(cid, 8).uid local tmname = getItemAttribute(slotball, "TM") if it == "2" then if getItemAttribute(slotball, "TMN") == 2 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move2 end elseif it == "3" then if getItemAttribute(slotball, "TMN") == 3 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move3 end elseif it == "4" then if getItemAttribute(slotball, "TMN") == 4 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move4 end elseif it == "5" then if getItemAttribute(slotball, "TMN") == 5 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move5 end elseif it == "6" then if getItemAttribute(slotball, "TMN") == 6 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move6 end elseif it == "7" then if getItemAttribute(slotball, "TMN") == 7 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move7 end elseif it == "8" then if getItemAttribute(slotball, "TMN") == 8 then move = {name = ""..tmname.."", level = 0, cd =15, dist = 0, target = 0} else move = movestable[name].move8 end elseif it == "9" then if getItemAttribute(slotball, "TMN") == 9 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move9 end elseif it == "10" then if getItemAttribute(slotball, "TMN") == 10 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move10 end elseif it == "11" then if getItemAttribute(slotball, "TMN") == 11 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move11 end elseif it == "12" then if getItemAttribute(slotball, "TMN") == 12 then move = {name = ""..tmname.."", level = 0, cd = 12, dist = 0, target = 0} else move = movestable[name].move12 end end if not move then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon doesn't recognize this move.") return true end if getPlayerLevel(cid) < move.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need be atleast level "..move.level.." to use this move.") return true end if getCD(getPlayerSlotItem(cid, 8).uid, cdzin) > 0 and getCD(getPlayerSlotItem(cid, 8).uid, cdzin) < (move.cd + 2) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to wait "..getCD(getPlayerSlotItem(cid, 8).uid, cdzin).." seconds to use "..move.name.." again.") return true end if getTileInfo(getThingPos(mypoke)).protection then doPlayerSendCancel(cid, "Your pokemon cannot use moves while in protection zone.") return true end if getPlayerStorageValue(mypoke, 3894) >= 1 then return doPlayerSendCancel(cid, "You can't attack because you is with fear") --alterado v1.3 end --alterado v1.6 if (move.name == "Team Slice" or move.name == "Team Claw") and #getCreatureSummons(cid) < 2 then doPlayerSendCancel(cid, "Your pokemon need be in a team for use this move!") return true end --alterado v1.6 if isCreature(getCreatureTarget(cid)) and isInArray(specialabilities["evasion"], getCreatureName(getCreatureTarget(cid))) and math.random(1, 100) <= 10 then local target = getCreatureTarget(cid) if isCreature(getMasterTarget(target)) then --alterado v1.6 doSendMagicEffect(getThingPos(target), 211) doSendAnimatedText(getThingPos(target), "TOO BAD", 215) doTeleportThing(target, getClosestFreeTile(target, getThingPos(mypoke)), false) doSendMagicEffect(getThingPos(target), 211) doFaceCreature(target, getThingPos(mypoke)) return true --alterado v1.6 end end if move.target == 1 then if not isCreature(getCreatureTarget(cid)) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don\'t have any targets.") return 0 end if getCreatureCondition(getCreatureTarget(cid), CONDITION_INVISIBLE) then return 0 end if getCreatureHealth(getCreatureTarget(cid)) <= 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your have already defeated your target.") return 0 end if not isCreature(getCreatureSummons(cid)[1]) then return true end if getDistanceBetween(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid))) > move.dist then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Get closer to the target to use this move.") return 0 end if not isSightClear(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid)), false) then return 0 end end local newid = 0 if isSleeping(mypoke) or isSilence(mypoke) then --alterado v1.5 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't do that right now.") return 0 else newid = setCD(getPlayerSlotItem(cid, 8).uid, cdzin, move.cd) end doCreatureSay(cid, ""..getPokeName(mypoke)..", "..msgs[math.random(#msgs)]..""..move.name.."!", TALKTYPE_SAY) local summons = getCreatureSummons(cid) --alterado v1.6 addEvent(doAlertReady, move.cd * 1000, cid, newid, move.name, it, cdzin) for i = 2, #summons do if isCreature(summons[i]) and getPlayerStorageValue(cid, 637501) >= 1 then docastspell(summons[i], move.name) --alterado v1.6 end end docastspell(mypoke, move.name) doCreatureAddCondition(cid, playerexhaust) if useKpdoDlls then doUpdateCooldowns(cid) end return 0 end Até que enfim.. Se fizeram tudo certo o sistema vai funcionar se não.... Caso não itendam alguma parte da explicação podem me perguntar por aqui...
      Creditos
      Smix
    • Por tataboy67
      Dungeon System v1.1

      A pedido de um usuário em meu Discord, resolvi ajuda-lo e desenvolver um sistema totalmente interativo e de qualidade aqui para vocês.
      Bom, o sistema se baseia em uma ActionID que ao clicar, podemos ai entrar em uma dungeon, tendo tempo para finaliza-la e até um cooldown, caso queira entrar novamente.

      Imagens do sistema:
       

      Vamos ao Código:

      Em actions, crie um arquivo com o nome de: Dungeon Actions.lua
       
      Em creaturescripts, crie um arquivo com o nome de: Dungeon Creaturescript.lua
       
      Ainda em creaturescripts, crie outro arquivo com o nome de: Type Dungeon Creaturescript.lua
       
       Na LIB, crie um arquivo com o nome de Dungeon System Lib.lua, e adicione:
       
      Em creaturescripts.xml, adicione:
       
       
      Em actions.xml, adicione:
       Em libs.lua, adicione:
      dofile('data/lib/Dungeon System Lib.lua')  
      v1.1 (Nova atualização, agora pode spawnar mobs dentro da DG, e ao sair, eles são removidos)

      (CREDITOS TOTAIS A MIM: @tataboy67)

      Essa é a primeira versão. Ainda pretendo colocar para nascer mobs, remover mobs ao entrar, etc etc...
       
    • Por tataboy67
      Opa boa noite rapaziada, tudo bom?
       
      Eu estou treinando um pouco scripts e acabei que tendo a ideia de fazer algo relacionado com as Guilds.
      Então resolvi trazer 1 sistema de Guild Dungeon Lever para mim treinar  

      Estou em fase de treinamento, então por favor, deem dicas e criticas ao sistema ! Obrigado ...

      Como o sistema funciona?

      Terá uma alavanca com local para os jogadores de sua Guild ficarem... O jogador que estiver na posição principal e próxima a alavanca irá clicar na alavanca que fará com que todos entrem na Dungeon. Os jogadores terão um tempo "x" para terminar, porém se o tempo acabar, o jogador será teleportado de volta para a posição principal da alavanca (Aonde o jogador clicou).



      Como configurar o script?
      local config = { time = 10, -- 1 Second. (1*60 To Minutes) level = 100, -- Level Necessary. dungeonPos = Position(1454, 909, 7), -- Dungeon Pos. needPos = { [1] = Position(1447, 915, 7), -- Position (where the player will click on the lever) and back position. [2] = Position(1449, 914, 7) }, fromPos = {x = 1449, y = 904, z = 7}, -- Position /\ < from the dungeon toPos = {x = 1456, y = 911, z = 7}, -- Position \/ > from the dungeon Storagetime = 39320, -- Storage Time. StorageDay = 39321, -- Storage Day. Timer = 24*60*60 -- To re-enter in the dungeon. (24hours) } time ------------------ Tempo que os jogadores ficarão dentro da Dungeon.
      level ----------------- Nível que todos precisam ser para entrar.
      dungeonPos ------ Posição que todos os jogadores serão teleportados.
      needPos ------------ Posição que os jogadores devem estar para serem teleportados.
      fromPos ------------- Posição SUPERIOR ESQUERDO da sala.
      toPos ----------------- Posição INFERIOR DIREITO da sala.
      Storagetime -------- Não mexer se não souber.
      StorageDay ----------- Não mexer se não souber.
      Timer ------------------ Tempo que o jogador terá que esperar para entrar novamente na Dungeon.
       
       

      Sem mais delongas, vamos ao script:
      Adicione a linha em:
      (data/actions/actions.xml)
      <!-- Script GUILD --> <action actionid="29305" script="Dungeon_Guild.lua" />  
      Adicione a linha em:
      (data/actions/scripts/Dungeon_Guild.lua)
      local config = { time = 5, -- 1 Second. (1*60 To Minutes) inside the dungeon. level = 100, -- Level Necessary. dungeonPos = Position(1454, 909, 7), -- Dungeon Pos. needPos = { [1] = Position(1447, 915, 7), -- Position (where the player will click on the lever) and back position. [2] = Position(1449, 914, 7) }, fromPos = {x = 1449, y = 904, z = 7}, -- Position /\ < from the dungeon toPos = {x = 1456, y = 911, z = 7}, -- Position \/ > from the dungeon Storagetime = 39320, -- Storage Time. StorageDay = 39321, -- Storage Day. Timer = 24*60*60 -- To re-enter in the dungeon. (24hrs) } function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey) local guild = player:getGuild() for i = 1, #config.needPos do local playerTile = Tile(config.needPos[i]):getTopCreature() if not playerTile or not playerTile:isPlayer() then player:getPosition():sendMagicEffect(CONST_ME_POFF) player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You need 2 players and stay on the orange floor.") return true end if not playerTile:getGuild() and not player:getGuild() then player:getPosition():sendMagicEffect(CONST_ME_POFF) return player:sendTextMessage(MESSAGE_STATUS_SMALL, "One of the members does not have guild.") end if playerTile:getLevel() < config.level then player:getPosition():sendMagicEffect(CONST_ME_POFF) return player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level "..config.level.." or higher.") end if player:getGuild():getId() ~= playerTile:getGuild():getId() then player:getPosition():sendMagicEffect(CONST_ME_POFF) return player:sendTextMessage(MESSAGE_STATUS_SMALL, "Only players in your guild can join you.") end if player:getStorageValue(config.Storagetime) - os.time() > 0 and playerTile:getStorageValue(config.Storagetime) - os.time() > 0 then player:getPosition():sendMagicEffect(CONST_ME_POFF) return false end if player:getStorageValue(config.StorageDay) - os.time() > 0 and playerTile:getStorageValue(config.StorageDay) - os.time() > 0 then player:getPosition():sendMagicEffect(CONST_ME_POFF) player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You're in cooldown to enter in a dungeon again. Cooldown: %s.", string.diff(player:getStorageValue(config.StorageDay)-os.time()))) return false end local players = {} for x = config.fromPos.x, config.toPos.x do for y = config.fromPos.y, config.toPos.y do for z = config.fromPos.z, config.toPos.z do local tile = Tile(x, y, z) local creature = tile:getTopCreature() if creature and creature:isPlayer() then players[#players+1] = creature end end end end if #players > 0 then player:getPosition():sendMagicEffect(CONST_ME_POFF) return player:sendTextMessage(MESSAGE_STATUS_SMALL, "Already has a guild inside.") end player:teleportTo(config.dungeonPos) playerTile:teleportTo(config.dungeonPos) playerTile:getPosition():sendMagicEffect(50) addEvent(function() player:teleportTo(config.needPos[i]) playerTile:teleportTo(config.needPos[i]) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) playerTile:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) player:setStorageValue(config.StorageDay, os.time() + config.Timer) playerTile:setStorageValue(config.StorageDay, os.time() + config.Timer) end, config.time*1000) return false end return true end
      Créditos:
      @KotZletY
      E eu  

      Espero que gostem ? ...

      Edit* Adicionado Tempo para que você possa entrar novamente na Dungeon:


      Rep+
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo