O que você quer dizer com "não dá pra usar novamente"?
info
Grupo: Lenda
Registrado: 03/10/06
Posts: 2.6k
Reputação: +309
Gênero: Masculino
Char no Tibia: Knight Orion

Depois que o efeito da primeira potion já acabou , da erro quando o player tenta usar uma segunda vez mesmo depois do primeiro bônus já ter acabado. Diz que ainda está sob efeito da poção '-'
info
Grupo: Marquês
Registrado: 16/06/07
Posts: 1.2k
Reputação: +377
Gênero: Masculino
Char no Tibia: Nenhum

Salve como exp_potion.lua em actions/scripts:
local needPA = true local needLvl = 20 local expBonus = 100 -- % local time = 0.5 -- minutos function onUse(cid, item) if not needPA or isPremium(cid) then if not needLvl or getPlayerLevel(cid) >= needLvl then if os.time() - getPlayerStorageValue(cid, 792371) > time * 60 then doPlayerSetExperienceRate(cid, 1 + (expBonus / 100)) addEvent(function(cid) if isCreature(cid) then doPlayerSetExperienceRate(cid, 1) end end, time * 1000 * 60, cid) doPlayerSendTextMessage(cid, 27, "You have "..expBonus.."% extra experience for "..time.." minutes.") setPlayerStorageValue(cid, 792371, os.time()) doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, 27, "You are still under extra experience.") end else doPlayerSendTextMessage(cid, 27, "You do not have enough level.") end else doPlayerSendTextMessage(cid, 27, "You must have a premium account to use this potion.") end return true end
Salve como exp_potion_login.lua em creaturescripts/scripts:
local expBonus = 100 -- % local time = 0.5 -- minutos function onLogin(cid) if os.time() - getPlayerStorageValue(cid, 792371) <= time * 60 then doPlayerSetExperienceRate(cid, 1 + (expBonus / 100)) local time_remaining = (time * 60) - (os.time() - getPlayerStorageValue(cid, 792371)) addEvent(function(cid) if isCreature(cid) then doPlayerSetExperienceRate(cid, 1) end end, time_remaining * 1000, cid) end return true end
Adicione essa tag em actions.xml:
<action itemid="EXP_POTION_ITEMID" script="exp_potion.lua"/>
Substitua pelo itemid da poção, é claro.
Adicione essa tag em creaturescripts.xml:
<event type="login" name="exp_potion" event="script" value="exp_potion_login.lua"/>
Editado Janeiro 7 por Omega
Omega , vlw mesmo cara funcionou certinho aqui ![]()
info
Grupo: Marquês
Registrado: 16/06/07
Posts: 1.2k
Reputação: +377
Gênero: Masculino
Char no Tibia: Nenhum

Tópico movido para a seção de dúvidas e pedidos resolvidos.
Estou com os seguintes erros ; e procuro quem poça ajudar ai a eliminar esses 3 erros , erro 1 e 2 acontece qnd um pokemon usa ps e o erro 3 é nas potions
[Error - TalkAction Interface]
[30/01/2022 17:04:25] data/talkactions/scripts/move1.lua:onSay
[30/01/2022 17:04:25] Description:
[30/01/2022 17:04:25] data/lib/some functions.lua:338: attempt to call global 'hasTile' (a nil value)
[30/01/2022 17:04:25] stack traceback:
[30/01/2022 17:04:25] data/lib/some functions.lua:338: in function 'getThingFromPosWithProtect'
Erro 2 ;
[30/01/2022 18:08:53] [Error - Spell Interface]
[30/01/2022 18:08:53] In a timer event called from:
[30/01/2022 18:08:53] data/spells/scripts/ps/Earthquake.lua:onCastSpell
[30/01/2022 18:08:53] Description:
[30/01/2022 18:08:53] data/lib/some functions.lua:338: attempt to call global 'hasTile' (a nil value)
[30/01/2022 18:08:53] stack traceback:
[30/01/2022 18:08:53] data/lib/some functions.lua:338: in function 'getThingFromPosWithProtect'
[30/01/2022 18:08:53] data/lib/newStatusSyst.lua:844: in function 'doMoveInArea2'
[30/01/2022 18:08:53] data/lib/pokemon moves.lua:1355: in function <data/lib/pokemon moves.lua:1351>
[30/01/2022 18:08:54] [Error - Spell Interface]
[30/01/2022 18:08:54] In a timer event called from:
[30/01/2022 18:08:54] data/spells/scripts/ps/Earthquake.lua:onCastSpell
[30/01/2022 18:08:54] Description:
[30/01/2022 18:08:54] data/lib/some functions.lua:338: attempt to call global 'hasTile' (a nil value)
[30/01/2022 18:08:54] stack traceback:
[30/01/2022 18:08:54] data/lib/some functions.lua:338: in function 'getThingFromPosWithProtect'
[30/01/2022 18:08:54] data/lib/newStatusSyst.lua:844: in function 'doMoveInArea2'
[30/01/2022 18:08:54] data/lib/pokemon moves.lua:1355: in function <data/lib/pokemon moves.lua:1351>
[30/01/2022 18:18:20] [Error - TalkAction Interface]
[30/01/2022 18:18:20] data/talkactions/scripts/move1.lua:onSay
[30/01/2022 18:18:20] Description:
[30/01/2022 18:18:20] data/lib/some functions.lua:338: attempt to call global 'hasTile' (a nil value)
[30/01/2022 18:18:20] stack traceback:
[30/01/2022 18:18:20] data/lib/some functions.lua:338: in function 'getThingFromPosWithProtect'
[30/01/2022 18:18:20] data/lib/newStatusSyst.lua:1119: in function 'doMoveInAreaMulti'
[30/01/2022 18:18:20] data/lib/pokemon moves.lua:458: in function 'docastspell'
[30/01/2022 18:18:20] data/talkactions/scripts/move1.lua:173: in function <data/talkactions/scripts/move1.lua:20>
Erro 3 ;
erro potion
[30/01/2022 18:48:35] [Error - Action Interface]
[30/01/2022 18:48:35] data/actions/scripts/potion.lua:onUse
[30/01/2022 18:48:35] Description:
[30/01/2022 18:48:35] data/lib/some functions.lua:338: attempt to call global 'hasTile' (a nil value)
[30/01/2022 18:48:35] stack traceback:
[30/01/2022 18:48:35] data/lib/some functions.lua:338: in function 'getThingFromPosWithProtect'
[30/01/2022 18:48:35] data/actions/scripts/potion.lua:45: in function <data/actions/scripts/potion.lua:43>
[30/01/2022 18:48:39] [Error - Action Interface]
[30/01/2022 18:48:39] data/actions/scripts/potion.lua:onUse
[30/01/2022 18:48:39] Description:
[30/01/2022 18:48:39] data/lib/some functions.lua:338: attempt to call global 'hasTile' (a nil value)
[30/01/2022 18:48:39] stack traceback:
[30/01/2022 18:48:39] data/lib/some functions.lua:338: in function 'getThingFromPosWithProtect'
[30/01/2022 18:48:39] data/actions/scripts/potion.lua:45: in function <data/actions/scripts/potion.lua:43>




info
Grupo: Campones
Registrado: 27/08/12
Posts: 18
Reputação: 0
Alguém tem um script de exp potion funcionando em 8.60 ? Eu testei alguns aqui , mas a maioria deu erro , tipo o player reloga e acaba o bônus , coisa que não deveria acontecer , já o outro que eu testei não tem esse problema , mas quando usa , depois que acaba o tempo , diz que ainda está sob efeito e não da pra usar outra potion '-'.
Esse script , mesmo relogando ele continua funcionando , mas depois que acaba o efeito , não da pra usar novamente:
------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
configs = {
time = 15, ---- TIME IN MINUTES
needpa = TRUE,
needlvl = {TRUE, level = 8},
costmana = {TRUE, mana = 150},
addrate = 100, -- Exp que vai adicionar em %
removeonuse = TRUE
}
function getTime(s)
local n = math.floor(s / 60)
s = s - (60 * n)
return n, s
end
CreatureEventChecker = function(event, ...) -- Colex
if isCreature(arg[1]) then
event(unpack(arg))
end
end
creatureEvent = function(event, delay, ...) -- Colex
addEvent(CreatureEventChecker, delay, event, unpack(arg))
end
function getPlayerExtraExpRate(cid) -- By MatheusMkalo
return (getPlayerRates(cid)[8]-1)*100
end
]]>
domodlib('PotionExpConfigs')
if getPlayerStorageValue(cid, 62164) >= 1 then
return doPlayerSendCancel(cid, "You are already taking effect from this item.")
end
if configs.needpa and not isPremium(cid) then
return doPlayerSendCancel(cid, "You need to be a premmium account to use this item.")
end
if configs.needlvl[1] and getPlayerLevel(cid) < configs.needlvl.level then
return doPlayerSendCancel(cid, "You need to be level " .. configs.needlvl.level .. " to use this item.")
end
if configs.costmana[1] then
if getCreatureMana(cid) < configs.costmana.mana then
return doPlayerSendCancel(cid, "You need " .. configs.costmana.mana .. " mana to use this item.")
else
doCreatureAddMana(cid, -configs.costmana.mana)
end
end
if configs.removeonuse then
doRemoveItem(item.uid, 1)
end
for i = configs.time*60, 1, -1 do
local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
if #a < 4 then
a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
end
if i == configs.time*60 then
creatureEvent(doPlayerSendCancel, configs.time*60*1000, cid, "The effect of the exp potion end.")
end
creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "The effect of the exp potion will end in "..a..".")
end
doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
doPlayerSendTextMessage(cid, 22, "Agora voce ira receber mais exp ao matar os monstros.")
setPlayerStorageValue(cid, 62164, os.time())
creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62164, 0)
return TRUE
]]>
domodlib('PotionExpConfigs')
local time = configs.time
if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then
doPlayerSetExperienceRate(cid, (1+(configs.addrate/100))+(getPlayerExtraExpRate(cid)/100))
creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1+(getPlayerExtraExpRate(cid)/100-(configs.addrate/100)))
creatureEvent(setPlayerStorageValue, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000 , cid, 62164, 0)
for i = (time*60-(os.time()-getPlayerStorageValue(cid, 62164))), 1, -1 do
local a = math.floor(i/60) .. ":" .. i - (60 * math.floor(i/60))
if #a < 4 then
a = string.sub(a,1,2) .. "0" .. string.sub(a, 3)
end
if i == (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) then
creatureEvent(doPlayerSendCancel, (time*60-(os.time()-getPlayerStorageValue(cid, 62164)))*1000, cid, "The effect of the exp potion end.")
end
creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "The effect of the exp potion will end in "..a..".")
end
end
return TRUE
]]>
e esse cancela o bônus se o player reloga :
function onUse(cid, item, frompos, item2, topos)
local pausa = 7200000 -- (1000 = 1 segundos) Tempo que o script durará
local texto = 'You receive double the experience to kill a monster for 120 minutes.' -- Texto que irá receber ao usar a potion.
textofinal = 'Its just minutes.' -- Texto que irá receber quando o efeito da potion acabar.
local exp = 2 -- O quanto que você quer que dobre sua experiencia, por exemplo 2 é 2x as rates do seu server.
expfinal = 1 --Não mude, isso é para a experiencia voltar ao normal.
if item.itemid == 2035 then
doRemoveItem(item.uid,1)
doPlayerSetExperienceRate(cid,exp)
doSendMagicEffect(frompos,13)
doPlayerSendTextMessage(cid,22,texto)
addEvent(potion,pausa,cid)
end
end
Se alguém tiver um script de exp potion que funcione sem bugar ou conseguir arrumar algum desses que postei , ia me ajudar muito .