• 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 PvP-Enforced system WITH skull system >Help<

Eraxley

New Member
Joined
Mar 2, 2009
Messages
24
Reaction score
0
Hi!
I am trying to make a script for my OT that gives the killer Exp when he kills a player. Since the servers world type is set to PvP people are getting skulls when tey are PK-ing.
I have taken the formula from TibiaWiki - Quests, Items, Spells, and more but the script is not working:
550244aecf8f5e0f3f9d33f4b009d1.png

a = victim's level * 1,1, rounded down
b = killer's level
c = victim's level
d = total experience of victim * 0,05, rounded down
e = round this number down to get your exp-gain

This is how it looks so far:
PHP:
function onDeath(cid, corpse, lastHitKiller, round)
	local victim = getPlayerLevel(cid)
	local k = getPlayerExperience(cid)
    if(isPlayer(lastHitKiller) == TRUE) then
    local killer = getPlayerLevel(lastHitKiller)
		local a = (round and victim * 1.1)
		local d = (round and k * 0.05)
		local e = ((a - killer) / victim) * d
		local gain = (round and e)
		if gain < 0 then
			doPlayerAddExperience(lastHitKiller, gain)
			doSendMagicEffect(cidpos,12)
			end
    end
    return TRUE
end

I will REP++ if i you help me! :D
 
Code:
local expRate = 2
function onDeath(cid, corpse, deathList)
	local a, b, c, d, e = math.floor(getPlayerLevel(cid) * 1.1), 0, getPlayerLevel(cid), math.floor(getPlayerExperience(cid) * 0.05), 0
	for i = 1, #deathList do
		if isPlayer(deathList[i]) then
			b = getPlayerLevel(deathList[i])
			e = math.floor(((a - b) / c) * d)
			if e > 0 then
				doPlayerAddExp(deathList[i], e * expRate)
				doSendMagicEffect(getThingPos(deathList[i]), CONST_ME_MAGIC_BLUE)
			end
		end
    end
    return true
end
 
Code:
local expRate = 2
function onDeath(cid, corpse, deathList)
	local a, b, c, d, e = math.floor(getPlayerLevel(cid) * 1.1), 0, getPlayerLevel(cid), math.floor(getPlayerExperience(cid) * 0.05), 0
	for i = 1, #deathList do
		if isPlayer(deathList[i]) then
			b = getPlayerLevel(deathList[i])
			e = math.floor(((a - b) / c) * d)
			if e > 0 then
				doPlayerAddExp(deathList[i], e * expRate)
				doSendMagicEffect(getThingPos(deathList[i]), CONST_ME_MAGIC_BLUE)
			end
		end
    end
    return true
end

Thanks! :D
 
does that even work, lol.

if it does, then it'll only work in lvl*0.9 to lvl*1.1 range (TFS default)
 
Back
Top