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

Looking for advanced amulet of loss system

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
592
Reaction score
64
Hi im looking for amulet system that would be possible to add items in local and adjust exp lost and charges after how many deaths it will disappear, so for example
LUA:
local Amulets = {
    [ITEMID] = {ExpLossProtection = 70%, LoseAfter = 5}
    [ITEMID] = {ExpLossProtection = 100% (means you wont lose exp at all after death), LoseAfter = False (means never lose amulet) },
    [ITEMID] = {ExpLossProtection = 0% (you would lose exp like normal), LoseAfter = 1 }
}

TFS 1.2
 
the only way to probably get it done is if you pay someone unfortunately. I admire your bump commitment though haha.
 
Last edited:
Hi im looking for amulet system that would be possible to add items in local and adjust exp lost and charges after how many deaths it will disappear, so for example
LUA:
local Amulets = {
    [ITEMID] = {ExpLossProtection = 70%, LoseAfter = 5}
    [ITEMID] = {ExpLossProtection = 100% (means you wont lose exp at all after death), LoseAfter = False (means never lose amulet) },
    [ITEMID] = {ExpLossProtection = 0% (you would lose exp like normal), LoseAfter = 1 }
}

TFS 1.2

If you plan on using other amulets than AOL, which Leo pointed you in the right direction where to change you need to edit the following file:
data/events/scripts/player.lua

edit this function:

LUA:
function Player:onLoseExperience(exp)
    return exp
end

Just an example, not tested, the charges you will have to work on your own:

LUA:
function Player:onLoseExperience(exp)
local Amulets = {
    [ITEMID] = {ExpLossProtection = 0.3, LoseAfter = true}
    [ITEMID] = {ExpLossProtection = 0, LoseAfter = false},
    [ITEMID] = {ExpLossProtection = 1, LoseAfter = true }
}
local amulet = self:getSlotItem(CONST_SLOT_NECKLACE)
if Amulets[amulet.itemid] then
    exp = exp * Amulets[amulet.itemid].ExpLossProtection
    if Amulets[amulet.itemid].LoseAfter then
          charges-1
    end
end
    return exp
end
 
Last edited:

Similar threads

Back
Top