muito bom Demonbholder vo usa em meu ot
- Fórum
- OTServ
- Recursos
- Scripting
- Globalevents e Spells
- Prêmio Por Monster Kill
6
2k
info
Grupo: Campones
Registrado: 24/06/11
Posts: 71
Reputação: -1

26 de junho de 2011 às 16:34
info
Grupo: Conde
Registrado: 16/06/08
Posts: 998
Reputação: +185
Gênero: Masculino

26 de junho de 2011 às 16:53
ta massa d+
deu até uma ideia, fazer os kills tipo cs, first kill, double kill, multi kill e talz ![]()
so não dou rep porque ja atingi o limite
26 de junho de 2011 às 20:12
Legal cara. Vou usar isso no meu ot.
info
Grupo: Artesão
Registrado: 30/12/07
Posts: 132
Reputação: +5
Gênero: Masculino
Char no Tibia: Hannibol

27 de junho de 2011 às 00:29
ta de parabens, se vc fizer uma pagina para mostra em tempo real quanto ta a % de cada vocação, e quais mostro ta disponivel.




info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder
E ai pessoal, beleza? Hoje vim mostrar um script simples, mas bem entusiasmante para os jogadores. Foi um amigo meu que me fez chegar nessa ideia, vamos a ela.
Como funciona: É o seguinte, você escolhe os monstros, e quando um jogador matar algum destes, ele concorre a um prêmio (instantâneo). As chances dele ganhar esse premio vai depender se outros jogadores da mesma vocação que ele já tiverem matado aquele monstro. Se ele não conseguir o prêmio, as chances são aumentadas para a próxima vez. Se ele conseguir, as chances voltam a 0.
Simples e divertido, não concordam?
Lib
Vá na pasta data/lib, abra o arquivo functions.lua e cole isto no final dele:
function getPlayerVocationNome(uid) if string.find(getPlayerVocationName(uid), "Knight") then return "Knight" elseif string.find(getPlayerVocationName(uid), "Sorcerer") then return "Sorcerer" elseif string.find(getPlayerVocationName(uid), "Druid") then return "Druid" elseif string.find(getPlayerVocationName(uid), "Paladin") then return "Paladin" end return erro("Vocation name not found.") endCreatureScripts
Vá na pasta data/creaturescripts/scripts, crie um arquivo .lua e cole isto nele:
function onKill(cid, target) local monsters = { ['rat'] = {item = 2160, quantidade = 1}, ['dragon'] = {item = 2421, quantidade = 1}, } local value = 1/2 local max = 100 if monsters[string.lower(getCreatureName(target))] then if getGlobalStorageValue(50000) == -1 then setGlobalStorageValue(50000, getPlayerVocationNome(cid) .. value) elseif string.find(getGlobalStorageValue(50000), getPlayerVocationNome(cid)) == nil then setGlobalStorageValue(50000, getGlobalStorageValue(50000) .. " " .. getPlayerVocationNome(cid) .. value) elseif string.find(getGlobalStorageValue(50000), getPlayerVocationNome(cid)) then string = getGlobalStorageValue(50000) rate = string.match(string, ".+", string.find(string, getPlayerVocationNome(cid)) + #getPlayerVocationNome(cid)) sto = string.gsub(string, getPlayerVocationNome(cid) .. rate, getPlayerVocationNome(cid) .. tonumber(rate) + value) setGlobalStorageValue(50000, sto) end if tonumber(string.match(getGlobalStorageValue(50000), "%d+", string.find(getGlobalStorageValue(50000), getPlayerVocationNome(cid))) + value) >= math.random(max) then rate = string.match(getGlobalStorageValue(50000), ".+", string.find(getGlobalStorageValue(50000), getPlayerVocationNome(cid)) + #getPlayerVocationNome(cid)) sub = string.gsub(getGlobalStorageValue(50000), getPlayerVocationNome(cid) .. rate, getPlayerVocationNome(cid) .. 0) doPlayerAddItem(cid, monsters[string.lower(getCreatureName(target))].item, monsters[string.lower(getCreatureName(target))].quantidade) setGlobalStorageValue(50000, sub) end end return TRUE endDepois vá em data/creaturescripts/scripts, abra o arquivo login.lua, ache as tags que registram eventos e cole isto entre elas:
Por último, vá em data/creaturescripts, abra o arquivo creaturescripts.xml e cole esta tag nele:
No lugar de NomeDoArquivo coloque o nome do arquivo .lua que você criou para colocar o script acima.
Como editar as opções:
local monsters = { ['rat'] = {item = 2160, quantidade = 1}, ['dragon'] = {item = 2421, quantidade = 1}, }Ai você pode adicionar mais monstros. Siga o padrão:
[nomeDoMonstro] = {item = idDoItem, quantidade = quantidadeDoItem},--
Em value você coloca de quanto em quanto vai adicionar as chances (caso o jogador não consiga o prêmio).
Já em max você coloca o máximo que o número sorteado pode alcançar (quanto maior, mais difícil).
Talkaction (opcional)
Esta talk é para o jogador checar em quanto estão as chances da vocação dele. Lá vai:
Vá em data/talkactions/scripts, crie um arquivo .lua e cole isso nele:
Depois vá em data/talkactions, abra o arquivo talkactions.xml e cole esta tag nele:
Em NomeDoArquivo você coloca o nome do arquivo .lua que você criou para colar o script acima.
--
Então é isso galera, abraços.
Editado Junho 26 por Demonbholder