• 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!

Gain the killed player's experience.

bybbzan

mapper
Joined
Aug 4, 2012
Messages
809
Solutions
2
Reaction score
136
Location
Sweden
Hello guys.

I would like to request a script for my OT.
When you kill a player, you will get as much experience as he loses.
So, if a player lost like 1kk exp, the player who killed him will gain 1kk exp.
Is it possible to make this happend?

Thanks in advance.
 
it's in sources.
I'm not 100, but you probably will find where the pvp-enfo exp is hidden by search all sources after "PVP_ENFORCED" and just go through all results until you find something that looks like a line of math codes :)
 
Hello, I made myself a script that gives you a % of the victim's Xp. I tried editing it to fit your needs. The formula in the script is one that I found on tibia.wikia for the death loss rate of Tibia.

go to your creaturescripts folder, then go into the script folder and open the file playerdeath.lua.

Scroll down to the part that says if byPlayer == 1 then and right below it add
local killerLvl = getPlayerLevel(killer)
local victimLvl = getPlayerLevel(cid)
local victimExpLoss = ((victimLvl+50)/100)*(50*(victimLvl^2-((5*victimLvl)+8)))
local killerGain = victimExpLoss
if killerLvl < victimLvl then
doPlayerAddExp(killer,killerGain)
end

Hope this helps, let me know if it does!

Vonuzur

- - - Updated - - -

I also just kind of realized that this script will only work for the person that gets the killing hit(I'm pretty sure).

If this is the case and you figure out how to make it work for multiple killers let me know, I also have a thread created for trying to solve this problem with my script as well.

Sorry I didn't think about that when I gave you the formula, was just trying to help. :p

Hopefully we can get our scripts working!
 
In your source go to Player.cpp, look for:
Code:
double Player::getGainedExperience(Creature* attacker) const
{

and then in that function scroll down to:
Code:
/*
		Formula
		a = attackers level * 0.9
		b = victims level
		c = victims experience

		result = (1 - (a / b)) * 0.05 * c
		Not affected by special multipliers(!)
*/

and before that add:
Code:
return getLostExperience();

Then comment out anything passed this until:
Code:
}
 
Back
Top