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

Feature [PvP] Players recive smaller dmg at higher level, and less damage using physical dmg

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
741
Solutions
5
Reaction score
193
Location
Pr0land
GitHub
Erexo
Hello guyz.
Next feature published by me, (special thanks to Gesior).


Q: Łat dat doin'?
A: So, i wanna fix PvP at my server, but i dont wanna touch mobs, so if i increase armor, players will be OP against the monsters.
But hey, players deals 50% damage against player, and 100% against monsters, so it must be written somewhere, and yes, this is my feature.


combat.cpp

Lets look for that function:
Code:
bool Combat::CombatHealthFunc(Creature* caster, Creature* target, const CombatParams& params, void* data)

and find that:
Code:
	if(change < 0 && caster && caster->getPlayer() && target->getPlayer() && target->getPlayer()->getSkull() != SKULL_BLACK)
	{
		[...]
	}

change = change / 2;
what does it mean? if target is player, then damage is divided by 2. (50% dmg to players).
So, lets change it:

Code:
	if(change < 0 && caster && caster->getPlayer() && target->getPlayer() && target->getPlayer()->getSkull() != SKULL_BLACK)
	{
		if(target->getPlayer()->getLevel() <= 100)
		{
			if(params.combatType == COMBAT_PHYSICALDAMAGE)
				change = change / 100 * 34;
			else
				change = change / 100 * 45;
		}
		if(target->getPlayer()->getLevel() >= 101 && target->getPlayer()->getLevel() <= 300)
		{
			if(params.combatType == COMBAT_PHYSICALDAMAGE)
				change = change / 100 * 28;
			else
				change = change / 100 * 40;
		}
		if(target->getPlayer()->getLevel() >= 301 && target->getPlayer()->getLevel() <= 499)
		{
			if(params.combatType == COMBAT_PHYSICALDAMAGE)
				change = change / 100 * 25;
			else
				change = change / 100 * 38;
		}
		if(target->getPlayer()->getLevel() >= 500)
		{
			if(params.combatType == COMBAT_PHYSICALDAMAGE)
				change = change / 100 * 23;
			else
				change = change / 100 * 36;
		}
	}

Its pretty messed ,but it says, `if target have <= 100 lv, and u deal physical dmg, he recive /100*34 (so, 34%) dmg, if not physical, 45%.
But you must be careful, some spells use physical dmg, so if you dont wanna this, just delete it.


Have fun and enjoy,
Erexo.
 
Last edited:
Thanks this is very nice! But how hard would it to be able to develop a formula so that if u are same level u do full damage, and for the percent of levels lower u are than the person you are attacking thats the percent less damage you do... and if you are same level or higher you do 100% damage....

ex. lvl 75 attacks lvl 100 and normally does 200 damage to monster, but only does 150 damage.... but if he was level 100 he would still do 200 damage... if he was level 50 he would only do 100 ect. ect...

This should be very useful, way I explained and your way too!
 
Back
Top