Ir para conteúdo
  • 0

[Pedido] Exp Por Hit Com Roe E Premium


Pergunta

Bom pessoal. Tenho um server. a XP dele é por HIT. Mas os Roes (Ring of Experience) que tem aqui no XTBIA, são todos por rate normal.

 

Queria um Roe, que desse uma certa XP por hit, ao usa-lo. Ou um Roe que crie seu proprio rate de XP.

Olhem meu script:

rateExp = 30 -- 0 a 50

rateExp1 = 20 -- 50 a 100

rateExp2 = 10 -- 101 a 150

rateExp3 = 6 -- 151 a 200

rateExp4 = 4 -- 201 a 350

rateExp5 = 2 -- 351 a 380

rateExp6 = 0.5 -- 381 a 430

rateExp7 = 0.3 --431 em diante

bonus = 1000 -- Bonus por estar com exp ring

expringid = 148 -- Id do exp ring

 

function CalculeExp(monsterhp, exptotal, hit)

local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0

local x2 = x - 20 + math.random(20)

return x2 > 0 and x2 or 0

end

 

function isSummon(uid)

return uid ~= getCreatureMaster(uid) or false

end

 

function onStatsChange(cid, attacker, type, combat, value)

if type == STATSCHANGE_HEALTHLOSS then

if isMonster(cid) then

if isCreature(attacker) then

local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker

 

if isPlayer(sid) and getPlayerLevel(sid) <= 50 then

local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." exp.")

doPlayerAddExp(sid, expg)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 100 then

local expg1 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp1, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg1.." exp.")

doPlayerAddExp(sid, expg1)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 150 then

local expg2 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp2, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg2.." exp.")

doPlayerAddExp(sid, expg2)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 200 then

local expg3 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp3, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg3.." exp.")

doPlayerAddExp(sid, expg3)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 350 then

local expg4 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp4, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg4.." exp.")

doPlayerAddExp(sid, expg4)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 380 then

local expg5 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp5, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg5.." exp.")

doPlayerAddExp(sid, expg5)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 430 then

local expg6 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp6, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg6.." exp.")

doPlayerAddExp(sid, expg6)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 500 then

local expg7 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp7, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg7.." exp.")

doPlayerAddExp(sid, expg7)

 

elseif isPlayer(sid) and getPlayerItemCount(cid,148) then

local expbonus = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * bonus, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expbonus.." ROE exp.")

doPlayerAddExp(sid, expbonus)

 

end

end

end

elseif type == STATSCHANGE_HEALTHGAIN then

return false

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

 

Queria também que premium time desse mais exp a cada hit.

Pensei em algo como:

 

rateExp = 30 -- 0 a 50

ratePremiumExp = 33 -- 0 a 50

 

if isPlayer(sid) and getPlayerLevel(sid) <= 50 then

local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." exp.")

doPlayerAddExp(sid, expg)

 

if isPlayer(sid) and getPlayerLevel(sid) <= 50 and getPlayerPremiumDays(sid) >= 1 then

local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * ratePremiumExp, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." premium exp.")

doPlayerAddExp(sid, expg)

 

Testei assim mas não funcionou. Se alguém puder me ajudar, eu agradeceria muito.

 

Rep+ pra quem me ajudar!

Editado por VictorTasquin
Link para o comentário
https://xtibia.com/forum/topic/190346-pedido-exp-por-hit-com-roe-e-premium/
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Está no post a cima.

É este:

 

rateExp = 30 -- 0 a 50

rateExp1 = 20 -- 50 a 100

rateExp2 = 10 -- 101 a 150

rateExp3 = 6 -- 151 a 200

rateExp4 = 4 -- 201 a 350

rateExp5 = 2 -- 351 a 380

rateExp6 = 0.5 -- 381 a 430

rateExp7 = 0.3 --431 em diante

bonus = 1000 -- Bonus por estar com exp ring

expringid = 148 -- Id do exp ring

 

function CalculeExp(monsterhp, exptotal, hit)

local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0

local x2 = x - 20 + math.random(20)

return x2 > 0 and x2 or 0

end

 

function isSummon(uid)

return uid ~= getCreatureMaster(uid) or false

end

 

function onStatsChange(cid, attacker, type, combat, value)

if type == STATSCHANGE_HEALTHLOSS then

if isMonster(cid) then

if isCreature(attacker) then

local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker

 

if isPlayer(sid) and getPlayerLevel(sid) <= 50 then

local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." exp.")

doPlayerAddExp(sid, expg)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 100 then

local expg1 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp1, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg1.." exp.")

doPlayerAddExp(sid, expg1)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 150 then

local expg2 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp2, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg2.." exp.")

doPlayerAddExp(sid, expg2)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 200 then

local expg3 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp3, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg3.." exp.")

doPlayerAddExp(sid, expg3)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 350 then

local expg4 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp4, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg4.." exp.")

doPlayerAddExp(sid, expg4)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 380 then

local expg5 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp5, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg5.." exp.")

doPlayerAddExp(sid, expg5)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 430 then

local expg6 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp6, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg6.." exp.")

doPlayerAddExp(sid, expg6)

 

elseif isPlayer(sid) and getPlayerLevel(sid) <= 500 then

local expg7 = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp7, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg7.." exp.")

doPlayerAddExp(sid, expg7)

 

elseif isPlayer(sid) and getPlayerItemCount(cid,148) then

local expbonus = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * bonus, value)

doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expbonus.." ROE exp.")

doPlayerAddExp(sid, expbonus)

 

end

end

end

elseif type == STATSCHANGE_HEALTHGAIN then

return false

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

Link para o comentário
https://xtibia.com/forum/topic/190346-pedido-exp-por-hit-com-roe-e-premium/#findComment-1307306
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...