puts nao sei fazer isso,deve ser algo com creatureevents...
vo dar uma pesquisada e vejo se consigo ti ajudar.
info
Grupo: Infante
Registrado: 27/07/09
Posts: 1.5k
Reputação: +405
Char no Tibia: Gean Riot

puts nao sei fazer isso,deve ser algo com creatureevents...
vo dar uma pesquisada e vejo se consigo ti ajudar.
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

Mods
amuletExp.xml
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Exp Amulet" version="1.0" author="vodka" contact="xtibia.com" enabled="yes">
<config name="expamulet"><![CDATA[
info = {
rate = 3, -- 4x More Experience
time = 5, -- Hours of Exp Time
storage = 20012
}
function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, info.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your extra experience time has ended.')
end
end
]]></config>
<event type="login" name="check_rate" event="script"><![CDATA[
domodlib('expamulet')
function onLogin(cid)
local hours = math.floor((getPlayerStorageValue(cid, info.storage) - os.time())/(3600))
if getPlayerStorageValue(cid, info.storage) >= os.time() then
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. hours ..' hours.')
addEvent(endExpRate, hours*3600*1000, cid)
end
return true
end]]></event>
<action itemid="10221" event="script"><![CDATA[
domodlib('expamulet')
function onUse(cid, item, frompos, item2, topos)
if (getPlayerStorageValue(cid, info.storage) <= os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. info.time ..' hours.')
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
setPlayerStorageValue(cid, info.storage, os.time()+info.time*3600)
addEvent(endExpRate, info.time *3600*1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You still have extra experience time left.')
end
return true
end]]></action>
</mod>
Editado Março 23 por Vodkart
info
Grupo: Artesão
Registrado: 13/01/11
Posts: 116
Reputação: +24
Char no Tibia: Não tenho

onde ue mudo o tempo é em:<br><br>
addEvent(endExpRate, info.time *3600*1000, cid)
<br><br>Ai ta mais que 5 hrs né? Pra 5 hrs preciso trocar o 3600*1000 por 300?<br>Vlw<br>
Editado Março 24 por small201
Opa... dei uma olhada e gostei do script!!
Gostaria de entender seu funcionamento melhor!!
Por exemplo eu dou use nele, ele desaparece, como se fose uma potion ?? e Despois disso eu posso por exemplo usar um amulet of loss no lugar dos amulets normalmente ???
E o que que eu tenho que colocar aqui pra que ele aumente a exp em 50% ?? :
rate = 3, -- 4x More Experience
Outra Coisa o que eu adiciono em actions.xml ??
obs: estou usando o mesmo amuleto com o ID : 10221
Aaaah... mais outra coisinha =DD
Como eu devo deixar Esse amulet no Itens.xml ??
Poque no meu está assim :
<item id="10221" article="a" name="shockwave amulet">
<attribute key="description" value="It tickles your neck in a rather pleasant way and absorbs loads of damage." />
<attribute key="weight" value="700" />
<attribute key="slotType" value="necklace" />
<attribute key="showcharges" value="1" />
<attribute key="absorbPercentPhysical" value="60" />
<attribute key="absorbPercentEnergy" value="40" />
Muito Obrigado, Aguardo Resposta!
vlws s2/''
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

@Small
tenta usar assim,para melhor calcular o tempo:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Exp Amulet" version="1.0" author="vodka" contact="xtibia.com" enabled="yes">
<config name="expamulet"><![CDATA[
info = {
rate = 3,
time = 5, -- Hours
storage = 20012
}
function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, info.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your extra experience time has ended.')
end
end
]]></config>
<event type="login" name="check_rate" event="script"><![CDATA[
domodlib('expamulet')
function onLogin(cid)
if getPlayerStorageValue(cid, info.storage) >= os.time() then
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. math.floor((getPlayerStorageValue(cid, info.storage) - os.time())/(3600)) ..' hours.')
addEvent(endExpRate, math.floor(getPlayerStorageValue(cid, info.storage) - os.time())*3600*1000, cid)
end
return true
end]]></event>
<action itemid="10221" event="script"><![CDATA[
domodlib('expamulet')
function onUse(cid, item, frompos, item2, topos)
if (getPlayerStorageValue(cid, info.storage) <= os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. info.time ..' hours.')
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
setPlayerStorageValue(cid, info.storage, os.time()+info.time*3600)
addEvent(endExpRate, info.time *3600*1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You still have extra experience time left.')
end
return true
end]]></action>
</mod>
info
Grupo: Artesão
Registrado: 13/01/11
Posts: 116
Reputação: +24
Char no Tibia: Não tenho

Ta vou usar, mais onde que mudo o tempo?
Quero cololocar pra dar so 5 hrs.
é aqui? :
addEvent(endExpRate, info.time *3600*1000, cid)
Pra 5 hrs ficaria oque?
Opa... dei uma olhada e gostei do script!!
Gostaria de entender seu funcionamento melhor!!
Por exemplo eu dou use nele, ele desaparece, como se fose uma potion ?? e Despois disso eu posso por exemplo usar um amulet of loss no lugar dos amulets normalmente ???
E o que que eu tenho que colocar aqui pra que ele aumente a exp em 50% ?? :
rate = 3, -- 4x More Experience
Outra Coisa o que eu adiciono em actions.xml ??
obs: estou usando o mesmo amuleto com o ID : 10221
Aaaah... mais outra coisinha =DD
Como eu devo deixar Esse amulet no Itens.xml ??
Poque no meu está assim :
<item id="10221" article="a" name="shockwave amulet">
<attribute key="description" value="It tickles your neck in a rather pleasant way and absorbs loads of damage." />
<attribute key="weight" value="700" />
<attribute key="slotType" value="necklace" />
<attribute key="showcharges" value="1" />
<attribute key="absorbPercentPhysical" value="60" />
<attribute key="absorbPercentEnergy" value="40" />
Muito Obrigado, Aguardo Resposta!
vlws s2/''
Cara é o seguinte, Ele é um amuleto que vc nem precisa colocar no local de um amulet.É só dar use nele que ele some e vc continua com seu AOL. Agora sobre a exp dele no script ta 3x mais de exp ex: Se vc mata um rat e ganha 300 de exp, usando o anel vc ganhara 900 ou seja 3x mais do normal de exp.
Vá em items.xml e substitui o teu por esse aqui:
<item id="10221" article="a" name="Exp Amulet"> <attribute key="description" value="Mais experiência para seu char." /> <attribute key="weight" value="700" /> <attribute key="slotType" value="necklace" /> </item>
Vlw, Ajudei? Rep+
Gostaria de Perguntar Algumas coisas :
1º O que eu tenho que colocar em actions.xml ??
2º Se eu mudar o id do amuleto pelo id de algum outro item vai funcionar também ?
3º E outra dúvida igual a do small, pra que que serve isso aqui :
addEvent(endExpRate, info.time *3600*1000, cid)
se eu quiser colocar pra 6 horas como eu faço ??
ficaria assim ??
time = 6, -- Hours
addEvent(endExpRate, info.time *4200*1000, cid)
Me da Uma ajuda ai por favor!!
vlws
REP +
Editado Março 24 por mangous
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

@small
no caso já está configurado para 5 horas,quando ele usar o ring ele fica com a exp 5 horas,ao por exemplo você reloga e tem 4 horas e 58 minutos,só vai aperecer a mensagem dizendo que tem 4 horas,e se tiver só 58 minutos vai dizer que tem 0 horas,depois eu coloco pra checar em minutos tbm,to sem tempo.
flw
@UP
o calculo de horas está certo,é assim mesmo
info.time *3600*1000
se eu quiser colocar pra 6 horas como eu faço ??
ficaria assim ??
time = 6, -- Hours
desse jeito mesmo,
1º O que eu tenho que colocar em actions.xml ??
se você tiver usando na mods,simplismente nada,pois já ta incluindo no mods
2º Se eu mudar o id do amuleto pelo id de algum outro item vai funcionar também ?
exato.
Editado Março 24 por Vodkart
Desculpa mano.. como assim Se ficar em mods ??
Tipow eu pego esse script e salvo na pasta Otserv/mods ??
e Se eu adicionar em actions.xml da no mesmo ??
e eu precizarei usar oque na actions.xml ??
info
Grupo: Artesão
Registrado: 13/01/11
Posts: 116
Reputação: +24
Char no Tibia: Não tenho

Já falei o que é pra colocar em items.xml
<item id="10221" article="a" name="Exp Amulet">
<attribute key="description" value="Mais experiência para seu char." />
<attribute key="weight" value="700" />
<attribute key="slotType" value="necklace" />
</item>
Cara, faz o seguinte e somente isso:
Vá em data/actions/ e crie um arquivo chamado expamulet.lua e coloque isso dentro:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Exp Amulet" version="1.0" author="vodka" contact="xtibia.com" enabled="yes">
<config name="expamulet"><![CDATA[
info = {
rate = 3,
time = 5, -- Hours
storage = 20012
}
function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, info.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your extra experience time has ended.')
end
end
]]></config>
<event type="login" name="check_rate" event="script"><![CDATA[
domodlib('expamulet')
function onLogin(cid)
if getPlayerStorageValue(cid, info.storage) >= os.time() then
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. math.floor((getPlayerStorageValue(cid, info.storage) - os.time())/(3600)) ..' hours.')
addEvent(endExpRate, math.floor(getPlayerStorageValue(cid, info.storage) - os.time())*3600*1000, cid)
end
return true
end]]></event>
<action itemid="10221" event="script"><![CDATA[
domodlib('expamulet')
function onUse(cid, item, frompos, item2, topos)
if (getPlayerStorageValue(cid, info.storage) <= os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. info.time ..' hours.')
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
setPlayerStorageValue(cid, info.storage, os.time()+info.time*3600)
addEvent(endExpRate, info.time *3600*1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You still have extra experience time left.')
end
return true
end]]></action>
</mod>
Depois disso vá em data/action/action.xml e coloque isto:
<action itemid="10221" event="script" value="expamulet.lua"/>
Depois vá em data/items/items.xml e:
Substitua isso:
<item id="10221" article="a" name="shockwave amulet"> <attribute key="description" value="It tickles your neck in a rather pleasant way and absorbs loads of damage." /> <attribute key="weight" value="700" /> <attribute key="slotType" value="necklace" /> <attribute key="charges" value="5" /> <attribute key="showcharges" value="1" /> <attribute key="absorbPercentPhysical" value="60" /> <attribute key="absorbPercentEnergy" value="40" /> </item>
Por isso:
<item id="10221" article="a" name="Exp Amulet">
<attribute key="description" value="Mais experiência para seu char." />
<attribute key="weight" value="700" />
<attribute key="slotType" value="necklace" />
</item>
E pronto, depois disso e só fechar e abrir teu server que vai funfar por 5 hrs! Abraço
Opa manow... vou testar aqui!!
Mas me diz uma coisa!
Depois que o cara der use no item e o item "sumir" e o tempo começar a contar as 5 horas, se ele deslogar, o tempo vai parar de contar ?? ou o tempo vai continuar contando mesmo com ele deslogado ??
vou testar aki com outro item, vou usar o item que tem o id : 5953 e depois eu aviso se deu certo ou não!
info
Grupo: Artesão
Registrado: 13/01/11
Posts: 116
Reputação: +24
Char no Tibia: Não tenho

Sim, vai continuar contando, e quando ele logar denovo, vai aparecer uma msg por ex: Voce ainda tem 4:58 min sobrando.
Se funciona não esqueçe de me ajudar também ![]()
EDIT : Vodkart, cara o script aqui da um erro no script falando que n poder ler o arquivo..
O que pode ser?
Editado Março 25 por small201
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

brother vc ta fazendo a coisa errada,você tem que deleta o script em actions e a sua tag tbm
<action itemid="10221" event="script" value="expamulet.lua"/>
isso vc deleta tudo /\
ai vc vai na pasta mods e só poe isso em arquivo.xml :
expamulet.xml
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Exp Amulet" version="1.0" author="vodka" contact="xtibia.com" enabled="yes">
<config name="expamulet"><![CDATA[
info = {
rate = 3,
time = 5, -- Hours
storage = 20012
}
function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, info.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Your extra experience time has ended.')
end
end
]]></config>
<event type="login" name="check_rate" event="script"><![CDATA[
domodlib('expamulet')
function onLogin(cid)
if getPlayerStorageValue(cid, info.storage) >= os.time() then
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. math.floor((getPlayerStorageValue(cid, info.storage) - os.time())/(3600)) ..' hours.')
addEvent(endExpRate, math.floor(getPlayerStorageValue(cid, info.storage) - os.time())*3600*1000, cid)
end
return true
end]]></event>
<action itemid="10221" event="script"><![CDATA[
domodlib('expamulet')
function onUse(cid, item, frompos, item2, topos)
if (getPlayerStorageValue(cid, info.storage) <= os.time()) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Your extra experience rate is now: ' .. info.rate .. '. It will last for '.. info.time ..' hours.')
doPlayerSetRate(cid, SKILL__LEVEL, info.rate)
setPlayerStorageValue(cid, info.storage, os.time()+info.time*3600)
addEvent(endExpRate, info.time *3600*1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You still have extra experience time left.')
end
return true
end]]></action>
</mod>
OU sejá tudo em MODS,ai dentro do mods tem ACTIOND E CREATURESCRIPT
nao precisa criar nenhum arquivo.lua e vc ta colocando arquivo em lua de vez de ser xml -.-
Vodkart Aqui na Pasta MODS do meu ot Tem os seguintes itens :
Pastas :
Monter/Custom/ Alguns arquivos .xml aqui dentro
Npc
Scripts/customspells/ Alguns arquivos .lua aqui dentro
Arquivos :
buypremium_command.xml
buypremium_command.xml
custommonsters.xml
customspells.xml
firstitems.xml
highscorebook
Onde eu coloco esse amuletexp ?? No caso o meu eu coloquei o nome : itemexp.xml
E eu já deletei os 2 arquivos de actions e actions.xml!
Aguardando e Muito Obrigado Desde Já!
Editado Março 25 por mangous
info
Grupo: Artesão
Registrado: 13/01/11
Posts: 116
Reputação: +24
Char no Tibia: Não tenho
Bom, o script está td certo, funcionou certinho aqui MAS... é o seguindo: Ele não é de usar e sim de clicar. Você clica nele, ae fala: "Your extra experience rate is now: " 3x+". It will last for "5" hours." ta blz..Triplico o normal que eu tava ganhando. Ae se eu morro, ou logo o char a exp volta pro normal, mas se eu tento usar o amuleto denovo fala: "You still have extra experience time left.". O que eu quero? -> "Que toda vez que o player logar ou morrer ele continue com a exp até o perido acaba, e sempre que ele logar aparecer a msg : You still have "15" minuts left of your expirence rate e que o player tenha um comando para saber o quanto ele ainda tem de exp time" O Item usado é Shockwave Amulet ID: 10221.
data/actions/expamulet.lua
local config = { rate = 3, -- 4x More Experience time = 5, -- Hours of Exp Time storage = 20012 } local function endExpRate(cid) if isPlayer(cid) == TRUE then doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate setPlayerStorageValue(cid, config.storage, -1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.") end end function onUse(cid, item, fromPosition, itemEx, toPosition) if(getPlayerStorageValue(cid, config.storage) < 0) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.") doPlayerSetRate(cid, SKILL__LEVEL, config.rate) setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600) addEvent(endExpRate, config.time * 3600 * 1000, cid) doRemoveItem(item.uid, 1) else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.") end return TRUE enddata/actions/actions.xml
Agradeço a ajuda de quem arrumar! Obrigado
Editado Março 23 por small201