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

When player get killed by a higher lvl, loses 50% less exp, items etc

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
There's a system in Tibia that isn't present in otservers, and is really good

When a player got pked by a higher lvl, like a lvl 20 get killed by a lvl 80 etc, it's considerate an unfair fight, and the player loses like 50% of exp he would lose if he die by another lvl 20 or by a monster, etc..

I'll keep tryin' here, but if someones wants to give it a shot, would be glad :rolleyes:

PS: When player logs in it pops up a message, saying it was an unfair fight etc
 
Last edited:
Ok, here's my shot:

LUA:
local t = {
	SKULL_WHITE,
	SKULL_RED,
	SKULL_BLACK
}

local default_loss_items = getPlayerLossPercent(cid, PLAYERLOSS_ITEMS)
local default_loss_exp = getPlayerLossPercent(cid, PLAYERLOSS_EXPERIENCE)
local default_loss_skills = getPlayerLossPercent(cid, PLAYERLOSS_SKILLS)
local default_loss_containers = getPlayerLossPercent(cid, PLAYERLOSS_CONTAINER)
local default_loss_mana = getPlayerLossPercent(cid, PLAYERLOSS_MANA)

function onDeath(cid, mostDamageKiller)
	if isPlayer(mostDamageKiller) == TRUE then
	if isInArray(t, getCreatureSkullType(cid)) == FALSE then
		lvl = getPlayerLevel(cid)
		lvl_killer = getPlayerLevel(mostDamageKiller)
		
		if lvl >= (lvl_killer*0.2) then
			doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, default_loss_exp * 0.4)
			doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, default_loss_mana * 0.4)
			doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, default_loss_skills * 0.4)
			doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINER, default_loss_containers * 0.4)
			doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, default_loss_items * 0.4)
			setPlayerStorageValue(cid, 58401, 1)
		elseif lvl >= (lvl_killer*0.4) then
			doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, default_loss_exp * 0.6)
			doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, default_loss_mana * 0.6)
			doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, default_loss_skills * 0.6)
			doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINER, default_loss_containers * 0.6)
			doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, default_loss_items * 0.6)
			setPlayerStorageValue(cid, 58402, 1)
		elseif lvl >= (lvl_killer*0.6) then
			doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, default_loss_exp * 0.8)
			doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, default_loss_mana * 0.8)
			doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, default_loss_skills * 0.8)
			doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINER, default_loss_containers * 0.8)
			doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, default_loss_items * 0.8)
			setPlayerStorageValue(cid, 58403, 1)
		else
			return TRUE
		end
		end
	end
	end

LUA:
function onLogin(cid)
	if getPlayerStorageValue(cid, 58401) == 1 then
	doPlayerPopupFYI(cid, "Unfair fight" .."\n\nThe fight was unfair and your loses are reduced by 60%.")
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINER, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 1)
	setPlayerStorageValue(cid, 58401, -1)
	end
			
	if getPlayerStorageValue(cid, 58402) == 1 then
	doPlayerPopupFYI(cid, "Unfair fight" .."\n\nThe fight was unfair and your loses are reduced by 40%.")
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINER, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 1)
	setPlayerStorageValue(cid, 58402, -1)
	end
	
	if getPlayerStorageValue(cid, 58403) == 1 then
	doPlayerPopupFYI(cid, "Unfair fight" .."\n\nThe fight was unfair and your loses are reduced by 20%.")
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_SKILLS, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_CONTAINER, 1)
		doPlayerSetLossPercent(cid, PLAYERLOSS_ITEMS, 1)
	setPlayerStorageValue(cid, 58403, -1)
	end
 	return TRUE
end

Didn't work '-'

luaGetPlayerLossPercent - Player not found (when reloading creaturescripts, nothing happens when player dies)
 
Back
Top