Okey, Another script! 
Im trying to add a script for my 1.0 server that Points people towards right hunting grounds.
This script will give a player some bonus exp if he or she kills a creature within the right lvls.
(I set Bug high as im trying it on the bug)
Creaturescripts.xml
BonusExp.lua
I got no errors in the logg and I tryed to re-check all the "doPlayerAddExp" etc for 1.0.
The Problem right now is that I DONT get any BONUSEXP when killing as for example a Bug.
A text wont appear either.
Here is the original Script:
http://otland.net/threads/bonus-exp-when-killing-difficult-monsters.141638/
Thanks in advance!
Kind Regards,
Eldin.
Im trying to add a script for my 1.0 server that Points people towards right hunting grounds.
This script will give a player some bonus exp if he or she kills a creature within the right lvls.
(I set Bug high as im trying it on the bug)
Creaturescripts.xml
Code:
<event type="kill" name="BonusExp" script="BonusExp.lua"/>
BonusExp.lua
Code:
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 = "Bug", normexp = 18, minlvl = 1, maxlvl = 10, extraexp = 1000},
{name = "Dragon", normexp = 4200, minlvl = 30, maxlvl = 60, extraexp = 500*getPlayerLevel(cid)},
{name = "Rat", normexp = 5, minlvl = 1, extraprcnt = 10}
}
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
I got no errors in the logg and I tryed to re-check all the "doPlayerAddExp" etc for 1.0.
The Problem right now is that I DONT get any BONUSEXP when killing as for example a Bug.
A text wont appear either.
Here is the original Script:
http://otland.net/threads/bonus-exp-when-killing-difficult-monsters.141638/
Thanks in advance!
Kind Regards,
Eldin.