• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Bonus EXP when killing difficult monsters

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

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.
 
So, I played a server that had something sort of like this, it was Elite OTs 7.72 server, If you were in a party and you killed something you had the normal exp split, and then you had 1/2 of the original monsters exp. So Hydras 2100x3=6300, + 1050 party bonus, any chance you could figure out a way to do this without adding EVERY monster to the list?
 
So, I played a server that had something sort of like this, it was Elite OTs 7.72 server, If you were in a party and you killed something you had the normal exp split, and then you had 1/2 of the original monsters exp. So Hydras 2100x3=6300, + 1050 party bonus, any chance you could figure out a way to do this without adding EVERY monster to the list?

Would not be needed if you ain't starting "another real map" and if you are hosting another real map then just throw that shit in your Recycle bin cause the world definitely doesn't need more shitty real maps! :)
If you are hosting an custom RPG map or custom TP ot with many tps and need it therefor then contact me and i will definitely fix this script for you.
 
So, I played a server that had something sort of like this, it was Elite OTs 7.72 server, If you were in a party and you killed something you had the normal exp split, and then you had 1/2 of the original monsters exp. So Hydras 2100x3=6300, + 1050 party bonus, any chance you could figure out a way to do this without adding EVERY monster to the list?

thats how the current party system works in CIPbia. i havent look at TFS recently but i believe its already included i think its somewhere in the config
 
I am very interested this script. As I can make the experience gained is only for one person, because when one person takes away a point of life experience also gives that person.
 
Back
Top