data/actions/scripts/exppotion.lua
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 onUse(cid,item,frompos,item2,topos)
------ CONFIGURE SEU SCRIPT ------ TRUE ou FALSE
configs = {
time = 1, ---- TIME IN MINUTES
needpa = FALSE,
needlvl = {FALSE, level = 50},
costmana = {FALSE, mana = 300},
removeonuse = TRUE
}
----------------------------------
--------- Nao Mude --------------
if getPlayerStorageValue(cid, 62165) >= 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 double experience potion ended.")
end
creatureEvent(doPlayerSendCancel, (configs.time*60-i)*1000, cid, "The effect of the double experience will end in "..a..".")
end
doPlayerSetExperienceRate(cid, 2)
creatureEvent(doPlayerSetExperienceRate, configs.time *60*1000, cid, 1)
doPlayerSendTextMessage(cid, 22, "Now you will receive double experience from killing monsters.")
setPlayerStorageValue(cid, 62163, os.time())
creatureEvent(setPlayerStorageValue, configs.time *60*1000, cid, 62163, 0)
return TRUE
end
-------------------------------------
data/actions/actions.xml
<action itemid="7443" event="script" value="exppotion.lua"/>
data/creaturescripts/scripts/potionevent.lua
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 onLogin(cid)
time = 1 ------ TIME IN MINUTES
if os.time()-getPlayerStorageValue(cid, 62164) < time *60 then
doPlayerSetExperienceRate(cid, 2)
creatureEvent(doPlayerSetExperienceRate, (time*60-(os.time()-getPlayerStorageValue(cid, 62164))) * 1000, cid, 1)
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 double experience potion ended.")
end
creatureEvent(doPlayerSendCancel, ((time*60-(os.time()-getPlayerStorageValue(cid, 62164)))-i)*1000, cid, "The effect of the double experience will end in "..a..".")
end
end
return TRUE
end
data/creaturescripts/creaturescripts.xml
<event type="login" name="ExpPotion" event="script" value="potionevent.lua"/>
Créditos: MatheusMkalo
REP+?



info
Grupo: Banidos
Registrado: 06/01/11
Posts: 8
Reputação: +2
TIBIA
alguem poderia me mandar um script, que vc usa uma certa potion durante um certo periodo ela lhe dara 2x mais xp..
o id da potion é 7443, verção do servidor 8.60..
rep+ pra quem responder
Editado Março 23 por LuanHelp