Sportacus
Intermediate OT User
- Joined
- Aug 3, 2008
- Messages
- 718
- Reaction score
- 100
The point of this script is to reward players for hunting monsters that would be difficult for their level, and make it slightly less appealing for higher levels to hunt at low level spawns.
For example, with this script, you can make it so during levels 1-8 rats would give a bonus % of exp, or a set number of bonus exp.
But anyone above level 8 would only receive the normal amount of exp, no bonus.
Furthermore, with this script, you can indirectly make "zones" for certain level ranges to hunt in.
For example, if you want level 10s-20s to hunt amazons, but want to discourage players under that level range, or above it, you would just set a minimum level, and a maximum level for the bonus exp from amazons.
Anyway, on to the script!
Register it in creaturescripts.xml
and add this to login.xml..
and add this to scripts in your creaturescripts folder..
bonusexp.lua
Feel free to post any errors, or suggestions to make the script better.
For example, with this script, you can make it so during levels 1-8 rats would give a bonus % of exp, or a set number of bonus exp.
But anyone above level 8 would only receive the normal amount of exp, no bonus.
Furthermore, with this script, you can indirectly make "zones" for certain level ranges to hunt in.
For example, if you want level 10s-20s to hunt amazons, but want to discourage players under that level range, or above it, you would just set a minimum level, and a maximum level for the bonus exp from amazons.
Anyway, on to the script!
Register it in creaturescripts.xml
Code:
<event type="kill" name="BonusEXP" event="script" value="bonusexp.lua"/>
and add this to login.xml..
Code:
registerCreatureEvent(cid, "BonusEXP")
and add this to scripts in your creaturescripts folder..
bonusexp.lua
Lua:
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 = "Amazon", normexp = 60, minlvl = 10, maxlvl = 20, extraexp = 100} -- player gets 100 bonus exp if in level range
{name = "Dragon", normexp = 4200, minlvl = 30, maxlvl = 60, extraexp = 500*getPlayerLevel(cid)}, -- 500 multiplied by i.e player's level (37)
{name = "Rat", normexp = 5, minlvl = 1, extraprcnt = 10} -- if there is no maxlvl, it'll from minlvl to infinite.
} -- Feel free to make formulas, too.
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
Feel free to post any errors, or suggestions to make the script better.