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

Lua Need a help in PvP-Enfo system.

Sane Mei

New Member
Joined
Feb 21, 2010
Messages
56
Reaction score
0
Well guys I've got a problem, I am trying to make something like this, for example:
If player with level 80 kills player level like 50 he should get some expierence, not that much as 50 kills 80, but always some and I have no clue how to do, I mean i am trying some combinations in config at those lines:

minLevelThresholdForKilledPlayer = 0
maxLevelThresholdForKilledPlayer = 0

Tried a lot of combinations but still nothing and it just works when 40 level kills higher, but if higher level wants to kill lower level he doesn't get any expierence.

My idea is if it doesn't work in config. so maybe we can do it somehow by scripting it in lua? I mean something like this ( but still this code is probably wrong because it doesnt work )

Code:

Code:
function onKill(cid, target)
local template = 0
local tlvl, plvl = 0, 0
	if(isPlayer(target) == true) then
		tlvl = getPlayerLevel(target)
		plvl = getPlayerLevel(cid)
		if(tlvl < p lvl) then	
			template = ((tlvl / plvl) * 10000)
			doPlayerAddExperience(cid, template)
		end
	end
return true
end

If there isn't any solution in config.lua ( but I really would be happy if there is any ) to set it, then someone could make or tell me how to make a script that give you EVERYTIME on a playerkill like 2k expierence? I mean it doesn't not matter what level do you kill, even if 8 lvl kills 100 level then he gets 2k expierence, and on other hand as well.

+ It would be nice if someone could add things like this as well:
* If player kills a player 10 levels higher than his lvl then he gets 10k expierence ( for example ), if player kills a player 20 lvls higher than his lvl then he gets 20k expierence, etc, etc.

But if player kills another players which is 10 lower than his, then he gets 20k expierence, if 20 lvls lower then 10k expierence, etc, etc.

What you guys think? Is it possible to write in .lua or something if we can't set it config.lua?
Does somebody got expierence to write something like this ?

// Thanks a lot.
 
Well I've found @Cykotitan post in some thread on this forum and he said that we have to delete those lines in player.cpp

double attackerLevel = (double)attackerPlayer->getLevel(), min = g_config.getDouble(
ConfigManager::EFP_MIN_THRESHOLD), max = g_config.getDouble(ConfigManager::EFP_MAX_THRESHOLD);
if((min > 0 && level < (uint32_t)std::floor(attackerLevel * min)) || (max > 0 &&
level > (uint32_t)std::floor(attackerLevel * max)))
return 0;

I've done it, but I had to delete those as well cuz there were some errors in compiling.
uint32_t a = (uint32_t)std::floor(attackerLevel * 0.9), b = level;
and this
* std::max((double)0, ((double)(1 - (((double)a / b))))) * 0.05 * c)) * rate;

After that I've compiled my server but now when I level 30 kills 100 he gets 0 expierence, and when 100 kills 30 lvl then 0 expierence as well.

Does anyone know how to fix it?
 
Thing is did you check for what revision those edits where for?
I would suggest personally contacting cykotitan leaving a pm at his profile site..
 
You shouldn't have removed the other part. But even if you did everything correctly it still wouldnt work.
That's because the formula doesn't "allow" killing lower levels.
 
@Barker, Cykotian
Thanks guys for your reply.

So if I understood it correctly we can't let higher players to get exp from killing lower's levels in TFS 0.3.6 ( Crying Damson )?

We can't change forumla, so it let's higher player lvls to kill lowers?
 
Last edited:
Guys, please...
I really have to know if we can do something with it or not, I am compiling like 10x time in a row changing those things in formula code but it doesn't work I guess or I am doing something wrong.

Just tell me if we can set it somehow or not, so I won't focus on it anymore:(
But really I would like to set it, because I am doing warOTS and it's boring when you get some higher lvl by killing those player which give you exp but later you do not get any exp from killing those who just started playing and got lower levels than you got.
 
@Anco
Thanks again for your reply.


Also, what you got in config. I mean in those lines:

minLevelThresholdForKilledPlayer = 0
maxLevelThresholdForKilledPlayer = 0

Gonna try your method, if it will work, then I am gonna invite you on a beer, I am sponsoring ! XD
 
Last edited:
@Anco
ROTFL! Tell me when you can come to our country so we can drink then, hahaha...
I can't belive, finally I've solved this problem thanks to you! I was searching for a week and nobody knew how to solve it. And you, you just read my topic, told me those things to do, and it's working, without any problems, lol. Can't belive...
Thanks you mate, big thanks, everything is working!
 
Last edited:
0 on both. and exp in config.lua 1 for pvp-e as higher pvp-e exp always results in noobs rooking chars xp
;p
Credits to cyko not me, guess he forgot about it lol
me only 10% as long time ago i had the same problem likeu , and he helped me with the code ;po
 
@Anco
Thanks you a lot, I am so serious^^ And yeah I get it, maybe you're right that he forgot, but good that you haven't forgot it as well... hehe xd and you've helped me :)

Damn, I am so happy that this thing is working as I wanted =)
 
Back
Top