meubk 257 Postado Julho 9, 2011 Share Postado Julho 9, 2011 (editado) Script: Exp por Hit v4.0Autor: xOtServx também conhecido como miillerdomingues. Testado: TFS 0.3.6 ( 8.54 ) e nas versões nova como 9.8 Resumo: Em vez de ganhar a exp final, vc ganha por cada hit. Instalação Primeiramente abra a pasta de seu ot, e procure pelo arquivo config.lua e procure por essas 2 linhas : experienceStages = false rateExperience = 50 se o experienceStages tiver ativado mude para false, pois o Stages é configurado no próprio script, e é muito importante o rateExperience tiver como 0, exemplo: experienceStages = false rateExperience = 0 agora entre na pasta creaturescripts/scripts e crie um arquivo lua, chamado exphit.lua e cole o seguinte código: para versões mais antigas como 8.54, 8.6 use : -- CONFIGURAÇÕES DE EXPERIENCIA -- useStages = false -- Usar sistema de Stages , true/false premiumMultipliqueExp = 2 -- Players Premiums terão exp multiplicada, caso não querer deixe 1. rateExp = 25 -- Exp caso não for usar stages. local stages = { -- ["DELEVEL-ATELEVEL"] = EXP, (OBS: NUNCA REPETIR O MSM NUMERO, SEMPRE COLOCAR UM A MAIS.) ["1-50"] = 50, ["51-100"] = 45, ["101-150"] = 40, ["151-200"] = 35, ["201-250"] = 30, ["251-300"] = 25, ["351-400"] = 20, } ultimateExp = 15 -- exp que vai usar caso o level do player não tiver mais na tabela . -- CONFIGURAÇÕES DA PARTY partyPorcent = 40 -- Quantos Porcento da exp vai para os membros da party levelBlockParty = 1000 -- Diferença Maxima de Level permitida para membro da party ganhar exp. expShareRadiusX = 30 -- Distancia maxima permitida no eixo X para membro da party ganhar exp. expShareRadiusY = 30 -- Distancia maxima permitida no eixo Y para membro da party ganhar exp. expShareRadiusZ = 1 -- Distancia maxima permitida no eixo Z para membro da party ganhar exp. -- CONFIGURAÇÕES DE RINGS -- local rings = { -- [ID DO ANEL] = EXP MULTIPLICADA POR X EXP. [3048] = 2, [3049] = 4, [3050] = 6, } -- FIM DAS CONFIGURAÇÕES -- function CalculeExp(monsterhp, exptotal, hit) hit = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0 return hit < 0 and 0 or hit end function isSummon(uid) return uid ~= getCreatureMaster(uid) or false end function onStatsChange(cid, attacker, type, combat, value) if getCreatureStorage(cid, 50001) ~= 1 then doCreatureSetStorage(cid, 50002, getMonsterInfo(getCreatureName(cid)).experience * rateExp) doCreatureSetStorage(cid, 50001, 1) end if type == STATSCHANGE_HEALTHLOSS then if isMonster(cid) then if isCreature(attacker) then local _cid = isSummon(attacker) and getCreatureMaster(attacker) or attacker if isPlayer(_cid) then if useStages then for strstage, experience in pairs(stages) do tabstage = string.explode(strstage, "-") if getPlayerLevel(_cid) >= tonumber(tabstage[1]) and getPlayerLevel(_cid) <= tonumber(tabstage[2]) then ultimateExp = experience end end experienceRate = ultimateExp else experienceRate = rateExp end local expgain = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * experienceRate, value) if getCreatureStorage(cid, 50002) > 0 then if getCreatureStorage(cid, 50002) - expgain < 0 then expgain = getCreatureStorage(cid, 50002) end doCreatureSetStorage(cid, 50002, getCreatureStorage(cid, 50002) - expgain) local ringexp = 1 for idring, expring in pairs(rings) do if getPlayerSlotItem(_cid, 9).itemid == idring then ringexp = expring break end end local premiumMultipliqueExp = isPremium(_cid) and premiumMultipliqueExp or 1 expgain = expgain * ringexp * premiumMultipliqueExp local party = false if isInParty(_cid) then local partyMembers, expParty = getPartyMembers(getPartyLeader(_cid)), expgain / 100 * partyPorcent for indice, partyMember in pairs(partyMembers) do attackerLevel, partyLevel = getPlayerLevel(_cid), getPlayerLevel(partyMember) attackerPos, partyPos = getThingPos(_cid), getThingPos(partyMember) x = false if math.abs(attackerLevel - partyLevel) > levelBlockParty then x = true elseif math.abs(attackerPos.x - partyPos.x) > expShareRadiusX then x = true elseif math.abs(attackerPos.y - partyPos.y) > expShareRadiusY then x = true elseif attackerPos.z ~= partyPos.z then x = true elseif _cid == partyMember then x = true end if x then partyMembers[indice] = nil end end if #partyMembers ~= 0 then expParty = math.ceil(expgain / 100 * partyPorcent) expmember = math.ceil(expParty / #partyMembers) for _, member in pairs(partyMembers) do if member ~= _cid then doPlayerSendTextMessage(member, 12, "You received "..expmember.." party exp.") doPlayerAddExp(member, expmember) end end doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp. (" ..partyPorcent.."% send to party)") doPlayerAddExp(_cid, expgain - expParty) party = true else party = false end end if not party then doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp.") doPlayerAddExp(_cid, expgain) end end end end end end return true end function onCombat(cid, target) if isMonster(target) and not isSummon(target) and not isPlayer(target) then registerCreatureEvent(target, "ExpGain") end return true end para versões mais novas como 9.8 : -- CONFIGURAÇÕES DE EXPERIENCIA -- useStages = false -- Usar sistema de Stages , true/false premiumMultipliqueExp = 2 -- Players Premiums terão exp multiplicada, caso não querer deixe 1. rateExp = 25 -- Exp caso não for usar stages. local stages = { -- ["DELEVEL-ATELEVEL"] = EXP, (OBS: NUNCA REPETIR O MSM NUMERO, SEMPRE COLOCAR UM A MAIS.) ["1-50"] = 50, ["51-100"] = 45, ["101-150"] = 40, ["151-200"] = 35, ["201-250"] = 30, ["251-300"] = 25, ["351-400"] = 20, } ultimateExp = 15 -- exp que vai usar caso o level do player não tiver mais na tabela . -- CONFIGURAÇÕES DA PARTY partyPorcent = 40 -- Quantos Porcento da exp vai para os membros da party levelBlockParty = 1000 -- Diferença Maxima de Level permitida para membro da party ganhar exp. expShareRadiusX = 30 -- Distancia maxima permitida no eixo X para membro da party ganhar exp. expShareRadiusY = 30 -- Distancia maxima permitida no eixo Y para membro da party ganhar exp. expShareRadiusZ = 1 -- Distancia maxima permitida no eixo Z para membro da party ganhar exp. -- CONFIGURAÇÕES DE RINGS -- local rings = { -- [ID DO ANEL] = EXP MULTIPLICADA POR X EXP. [3048] = 2, [3049] = 4, [3050] = 6, } -- FIM DAS CONFIGURAÇÕES -- function CalculeExp(monsterhp, exptotal, hit) hit = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0 return hit < 0 and 0 or hit end function isSummon(uid) return getCreatureMaster(uid) ~= nil end function onStatsChange(cid, attacker, type, combat, value) if getCreatureStorage(cid, 50001) ~= 1 then doCreatureSetStorage(cid, 50002, getMonsterInfo(getCreatureName(cid)).experience * rateExp) doCreatureSetStorage(cid, 50001, 1) end if type == STATSCHANGE_HEALTHLOSS then if isMonster(cid) then if isCreature(attacker) then local _cid = isSummon(attacker) and getCreatureMaster(attacker) or attacker if isPlayer(_cid) then if useStages then for strstage, experience in pairs(stages) do tabstage = string.explode(strstage, "-") if getPlayerLevel(_cid) >= tonumber(tabstage[1]) and getPlayerLevel(_cid) <= tonumber(tabstage[2]) then ultimateExp = experience end end experienceRate = ultimateExp else experienceRate = rateExp end local expgain = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * experienceRate, value) if getCreatureStorage(cid, 50002) > 0 then if getCreatureStorage(cid, 50002) - expgain < 0 then expgain = getCreatureStorage(cid, 50002) end doCreatureSetStorage(cid, 50002, getCreatureStorage(cid, 50002) - expgain) local ringexp = 1 for idring, expring in pairs(rings) do if getPlayerSlotItem(_cid, 9).itemid == idring then ringexp = expring break end end local premiumMultipliqueExp = isPremium(_cid) and premiumMultipliqueExp or 1 expgain = expgain * ringexp * premiumMultipliqueExp local party = false if isInParty(_cid) then local partyMembers, expParty = getPartyMembers(getPartyLeader(_cid)), expgain / 100 * partyPorcent for indice, partyMember in pairs(partyMembers) do attackerLevel, partyLevel = getPlayerLevel(_cid), getPlayerLevel(partyMember) attackerPos, partyPos = getThingPos(_cid), getThingPos(partyMember) x = false if math.abs(attackerLevel - partyLevel) > levelBlockParty then x = true elseif math.abs(attackerPos.x - partyPos.x) > expShareRadiusX then x = true elseif math.abs(attackerPos.y - partyPos.y) > expShareRadiusY then x = true elseif attackerPos.z ~= partyPos.z then x = true elseif _cid == partyMember then x = true end if x then partyMembers[indice] = nil end end if #partyMembers ~= 0 then expParty = math.ceil(expgain / 100 * partyPorcent) expmember = math.ceil(expParty / #partyMembers) for _, member in pairs(partyMembers) do if member ~= _cid then doPlayerSendTextMessage(member, 12, "You received "..expmember.." party exp.") doPlayerAddExp(member, expmember) end end doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp. (" ..partyPorcent.."% send to party)") doPlayerAddExp(_cid, expgain - expParty) party = true else party = false end end if not party then doPlayerSendTextMessage(_cid, 12, "You gain "..expgain.." exp.") doPlayerAddExp(_cid, expgain) end end end end end end return true end function onCombat(cid, target) if isMonster(target) and not isSummon(target) and not isPlayer(target) then registerCreatureEvent(target, "ExpGain") end return true end na mesma pasta procure pelo arquivo login.lua, e em cima de return true, adc a seguinte linha: registerCreatureEvent(cid, "ExpHit") volte na pasta anterior creaturescripts, e procure pelo arquivo creaturescritps.xml e cole as 2 tags: <event type="statschange" name="ExpGain" event="script" value="exphit.lua"/> <event type="combat" name="ExpHit" event="script" value="exphit.lua"/> para configurar a exp, que era configurada no config.lua está no começo do arquivo exphit.lua , e as configurações da party tbem, dos anéis, e até pode ser usado stages agora, segue abaixo o exemplo: -- CONFIGURAÇÕES DE EXPERIENCIA -- useStages = false -- Usar sistema de Stages , true/false premiumMultipliqueExp = 2 -- Players Premiums terão exp multiplicada, caso não querer deixe 1. rateExp = 50 -- Exp caso não for usar stages. local stages = { -- ["DELEVEL-ATELEVEL"] = EXP, (OBS: NUNCA REPETIR O MSM NUMERO, SEMPRE COLOCAR UM A MAIS.) ["1-50"] = 50, ["51-100"] = 45, ["101-150"] = 40, ["151-200"] = 35, ["201-250"] = 30, ["251-300"] = 25, ["351-400"] = 20, } ultimateExp = 15 -- exp que vai usar caso o level do player não tiver mais na tabela . -- CONFIGURAÇÕES DA PARTY partyPorcent = 40 -- Quantos Porcento da exp vai para os membros da party levelBlockParty = 1000 -- Diferença Maxima de Level permitida para membro da party ganhar exp. expShareRadiusX = 30 -- Distancia maxima permitida no eixo X para membro da party ganhar exp. expShareRadiusY = 30 -- Distancia maxima permitida no eixo Y para membro da party ganhar exp. expShareRadiusZ = 1 -- Distancia maxima permitida no eixo Z para membro da party ganhar exp. -- CONFIGURAÇÕES DE RINGS -- local rings = { -- [ID DO ANEL] = EXP MULTIPLICADA POR X EXP. [3048] = 2, [3049] = 4, [3050] = 6, } -- FIM DAS CONFIGURAÇÕES ---- Log V2.0 : - Monstros dão somente a exp usada no monster.xml vezes a rate do server, ele pode healar toda sua vida, porém se ele ja tiver dado a exp, ele não vai dar mais. - Parte da exp que você ganha vai para os membros da party. Log V3.0 ( 03/02/2013 ) : - Sistema de stages, pode ser totalmente configurado no script . - Anéis podem multiplicar a experiencia agora - Premium podem ter beneficios tambem na experiencia - Monstros sumonados por outros monstros, não vão dar mais experiencia. Log V4.0 ( 12/11/2013 ) : - Todos bugs da versão 3.0 corrigidos - Suporte a versões mais novas como á 9.8 Editado Novembro 12, 2013 por xotservx Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/ Compartilhar em outros sites More sharing options...
Eskylo 175 Postado Julho 9, 2011 Share Postado Julho 9, 2011 Realmente muito foda bom! Dá pra fazer muita coisa interessante com creaturescripts. Meu rep de hoje é seu. Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061532 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Julho 9, 2011 Share Postado Julho 9, 2011 Testei aqui, muito maneiro mesmo... havia visto um usuário aqui do nosso forum pedindo esse Script...muito bom. Só faltou, se fosse possível exibir a EXP que o player está ganhando a cada hit...aí ficaria perfeito! Abraços e já sabe neh. REP+ 99,8% Aprovado :button_ok: sempre me ajuda demais Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061546 Compartilhar em outros sites More sharing options...
meubk 257 Postado Julho 9, 2011 Autor Share Postado Julho 9, 2011 pra ir subindo a exp no arquivo exphit.lua abaixo da linha: doPlayerSendTextMessage(sid, 23, "You gain "..expg.." exp.") adc isto: doSendAnimatedText(getThingPos(sid), expg, 215) resultando: doPlayerSendTextMessage(sid, 23, "You gain "..expg.." exp.") doSendAnimatedText(getThingPos(sid), expg, 215) fui ;* Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061554 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Julho 9, 2011 Share Postado Julho 9, 2011 (editado) pra ir subindo a exp no arquivo exphit.lua abaixo da linha: doPlayerSendTextMessage(sid, 23, "You gain "..expg.." exp.") adc isto: doSendAnimatedText(getThingPos(sid), expg, 215) resultando: doPlayerSendTextMessage(sid, 23, "You gain "..expg.." exp.") doSendAnimatedText(getThingPos(sid), expg, 215) fui ;* Como eu já suspeitava... você daria um jeito, e funcionaria! Valeu aeeew.... OBS: Não sei se reparou, mas exemplo com 10x de EXP, o Ghoul daria 850 de EXP, aqui ele não da um número exato...porém fica sempre perto de 850, as vezes chega até a da 850 certinho, porém na maioria das vezes da 833, 822, 842, 845 de exp... mas tah ótimo o SCRIPT. 100% Aprovado :button_ok: Abraços :smile_positivo: Editado Julho 10, 2011 por Gonorreia Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061640 Compartilhar em outros sites More sharing options...
meubk 257 Postado Julho 10, 2011 Autor Share Postado Julho 10, 2011 (editado) sim, eu fiz isso pra não fica tão artificial, fica estranho toda hora 850, ai quis dár uma mudada, se não gostou fala ai, que te ensino mudar... Editado Julho 10, 2011 por xotservx Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061667 Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Julho 10, 2011 Share Postado Julho 10, 2011 Parabéns pelo script, eu tinha feito um parecido ao thalia. Ta randomizando a exp por causa do math.random, brother. Abraços. Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061674 Compartilhar em outros sites More sharing options...
gonorreiaswat 151 Postado Julho 10, 2011 Share Postado Julho 10, 2011 (editado) sim, eu fiz isso pra não fica tão artificial, fica estranho toda hora 850, ai quis dár uma mudada, se não gostou fala ai, que te ensino mudar... Por mim está tudo bem, eu acho dahora inovar! Mas se pah fica até interessante deixar postado aqui como mudar para o caso de alguém que decida deixar "globalizado" o seu server! OBS: Você viu a Msg que te enviei? Me da uma mãozinho com uma dúvida lá! Abraços, e Obrigado novamente. Parabéns pelo script, eu tinha feito um parecido ao thalia. Ta randomizando a exp por causa do math.random, brother. Abraços. Ahh, entendi... Então no caso sei até como arrumar @@@EDIT - OFF TOPIC Seria pedir demais, pedir para alguém de vocês que entendem mais de Tibia, me tirar uma dúvida nesse tópico!? http://www.xtibia.com/forum/topic/161005-duvida-claridade-dianoite/ Abraços...mals ae por algo! Editado Julho 10, 2011 por Gonorreia Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061677 Compartilhar em outros sites More sharing options...
fsg 230 Postado Julho 10, 2011 Share Postado Julho 10, 2011 Cara, quando eu jogava PBOT sempre tive vontade de colocar o sistema no meu OTServ e nunca achava... Simplesmente incrível! Rep + Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061700 Compartilhar em outros sites More sharing options...
Deadlock 11 Postado Julho 10, 2011 Share Postado Julho 10, 2011 REP ++ Muito bom nunca tinha pensado nisso :button_ok: Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1061704 Compartilhar em outros sites More sharing options...
Lordfire 309 Postado Julho 12, 2011 Share Postado Julho 12, 2011 Muito bom! E com um pequeno conhecimento disso também é bem fácil usar stages Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1063407 Compartilhar em outros sites More sharing options...
meubk 257 Postado Julho 12, 2011 Autor Share Postado Julho 12, 2011 sim, sim só criar uma tabelinha ^^, depois eu faço. Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1063440 Compartilhar em outros sites More sharing options...
drakylucas 160 Postado Julho 19, 2011 Share Postado Julho 19, 2011 script excelente, porem tem um erro. elseif type == STATSCHANGE_HEALTHGAIN then return false se eu registrei o monstro, se o monstro tentar se curar ele nao se cura-rá, isso pode ser bom em relação a ninguem fica curando e atacando + pode ser um bug quando usado para outros propositos. Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1068901 Compartilhar em outros sites More sharing options...
Demonbholder 420 Postado Julho 19, 2011 Share Postado Julho 19, 2011 script excelente, porem tem um erro. elseif type == STATSCHANGE_HEALTHGAIN then return false se eu registrei o monstro, se o monstro tentar se curar ele nao se cura-rá, isso pode ser bom em relação a ninguem fica curando e atacando + pode ser um bug quando usado para outros propositos. Na verdade isso é propositar para o script não bugar. Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1068916 Compartilhar em outros sites More sharing options...
drakylucas 160 Postado Julho 19, 2011 Share Postado Julho 19, 2011 script excelente, porem tem um erro. elseif type == STATSCHANGE_HEALTHGAIN then return false se eu registrei o monstro, se o monstro tentar se curar ele nao se cura-rá, isso pode ser bom em relação a ninguem fica curando e atacando + pode ser um bug quando usado para outros propositos. Na verdade isso é propositar para o script não bugar. depende, isso impediria que o monstro se curase e o player ficasse ganhando exp, certo? porém em outros propositos, se vc precisar o doCreatureAddHealth e a criatura estiver registrada o event, ele nao vai funcionar. no meu caso estou fazendo o sistema de level nos pokemons do mapa[como ja t flei no msn leo] e isso foi um bug monstro, pois uso mto o doCreatureAddHealth kkk + para alguns fins isso está otimo! rep+ [eskeci de dar eu achu.. se eu nao tiver dado eu do agora ksapoopkas] Link para o comentário https://xtibia.com/forum/topic/161056-exp-por-hit-v40/#findComment-1068942 Compartilhar em outros sites More sharing options...
Posts Recomendados