Olá Galera,
Hoje vou postar um script que da uma Experiencia Bônus, como assim?
Ao matar uma criatura você além de receber o normal ganha um bônus, a seu jeito...
Vamos ao que interessa,
Vá em (data\creaturescripts) e abra o arquivo "creaturescripts.xml" e adicione o seguinte código:
<event type="kill" name="BonusEXP" event="script" value="bonusexp.lua"/>
Depois vá em (data\creaturescripts\scripts) abra o arquivo "login.lua" e adicone o seguinte código:
registerCreatureEvent(cid, "BonusEXP")
Depois crie um arquivo na pasta (data\creaturescripts\script) um arquivo chamado "bonusexp.lua" e adicione o seguinte código:
function isWithinRange(number, minN, maxN)
if maxN == nil then
maxN = math.huge
end
if number >= minN and number <= maxN then
return true
end
return false
end
check = {extraexp, extraprcnt}
function onKill(cid, target)
monsters = {
{name = "Rat", normexp = 5, minlvl = 1, extraprcnt = 10} -- se não houver maxlvl, vai de minlvl ao infinito.
} -- Sinta-se livre para fazer fórmulas, também.
for i, a in pairs(monsters) do
if a.name == getCreatureName(target) then
if isWithinRange(getPlayerLevel(cid), a.minlvl, a.maxlvl) == true then
if a.extraexp then
doPlayerAddExp(cid, a.extraexp)
end
if a.extraprcnt then
doPlayerAddExp(cid, a.normexp/a.extraprcnt)
end
a.extraexp = a.extraexp or 0
a.extraprcnt = a.extraprcnt or 0
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "For killing a monster over your level, you gained " .. a.extraexp + (a.normexp/a.extraprcnt) .. " extra experience points.")
end
end
end
return 1
end
Creditos: Sportacus