Ir para conteúdo
  • Cadastre-se

Exp Por Hit v3.0 - Oficial XotservX


Posts Recomendados

@rodox

 

corrigi o erro

 

-- CONFIGURAÇÕES DE EXPERIENCIA --

useStages = true -- 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 --


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 isSummon(cid) then
					return true
			end
			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
local 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)
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
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 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
 

 

@Dry

 

Creio q sim

whatsapp-4in.png (18) 98134-9991

 

icon-skype.png [email protected]

 

Link para o post
Compartilhar em outros sites

@rodox

 

corrigi o erro

 

-- CONFIGURAÇÕES DE EXPERIENCIA --

useStages = true -- 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 --


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 isSummon(cid) then
					return true
			end
			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
local 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)
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
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 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
 

 

@Dry

 

Creio q sim

 

Amigo, utilizo OTX e é um pouco diferente, pois na versão 10.35 não temos mais a function OnstatsChange nem onCombat, poderia adaptá-lo para eu poder utilizar ? Agradeceria muuuito!

xBlackWolf

THX @Storm Night

Best Avatar Ever

 

9p0FoTd.png

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
  • 2 weeks later...
  • 5 months later...
  • 9 months later...

Eu entendo que este tópico já está parado a um tempo e que talvez comentar aqui seja alguma infração das regras, mas...

Como gosto muito desse script eu modifiquei ele e fiz com que funciona-se em TFS 0.4.

 

Quis comentar aqui para ajudar a todos que precisam dele.

Clique no LINK: [TFS 0.4] EXP por HIT

 

Grande abraços. :wink:

Se curtiu, REP+

cms1-pr%C3%AAmio.png

Link para o post
Compartilhar em outros sites
  • 2 years later...

Deu esse erro aqui 

Spoiler


[30/05/2018 16:09:15] [Error - CreatureScript Interface] 
[30/05/2018 16:09:15] data/creaturescripts/scripts/exphit.lua:onStatsChange
[30/05/2018 16:09:15] Description: 
[30/05/2018 16:09:15] data/creaturescripts/scripts/exphit.lua:113: attempt to compare string with number
[30/05/2018 16:09:15] stack traceback:
[30/05/2018 16:09:15]     data/creaturescripts/scripts/exphit.lua:113: in function <data/creaturescripts/scripts/exphit.lua:81>

[30/05/2018 16:09:19] [Error - CreatureScript Interface] 
[30/05/2018 16:09:19] data/creaturescripts/scripts/exphit.lua:onStatsChange
[30/05/2018 16:09:19] Description: 
[30/05/2018 16:09:19] data/creaturescripts/scripts/exphit.lua:113: attempt to compare string with number
[30/05/2018 16:09:19] stack traceback:
[30/05/2018 16:09:19]     data/creaturescripts/scripts/exphit.lua:113: in function <data/creaturescripts/scripts/exphit.lua:81>

[30/05/2018 16:09:21] [Error - CreatureScript Interface] 
[30/05/2018 16:09:21] data/creaturescripts/scripts/exphit.lua:onStatsChange
[30/05/2018 16:09:21] Description: 
[30/05/2018 16:09:21] data/creaturescripts/scripts/exphit.lua:113: attempt to compare string with number
[30/05/2018 16:09:21] stack traceback:
[30/05/2018 16:09:21]     data/creaturescripts/scripts/exphit.lua:113: in function <data/creaturescripts/scripts/exphit.lua:81

 

Link para o post
Compartilhar em outros sites
  • 2 years later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo