• 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 TFS 1.2 Looking for Amulet of Loss with charges

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
993
Solutions
5
Reaction score
55
Does anyone have amulet of loss with charges? Lets say Amulet id is 3333 and it has 5 charges so what it means is only 5th death will remove the amulet and lets say amulet 3334 have 10 charges so only 10th death will remove this amulet so basically it same like amulet of loss only with charges
 
Solution
ah oops.

Try
Lua:
local amuletOfLosses = {2173, 13805}

function onDeath(player, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    if getPlayerFlagValue(player, PlayerFlag_NotGenerateLoot) or player:getVocation():getId() == VOCATION_NONE then
        return true
    end
    
    local amulet = player:getSlotItem(CONST_SLOT_NECKLACE)
    local hasSkull = isInArray({SKULL_RED, SKULL_BLACK}, player:getSkull())
    if amulet and isInArray(amuletOfLosses, amulet.itemid) and not hasSkull then
        local isPlayer = false
        if killer then
            if killer:isPlayer() then
                isPlayer = true...
change
<attribute key="showcharges" value="5" />
to
<attribute key="showcharges" value="1" />
Last question to make sure even in traders i need to do something like this right?

shopModule:addBuyableItem({'god amulet'}, 13805, 1000000, 5, 'god amulet')
it cant be 1? because it will sell with one charge right?
 
Last question to make sure even in traders i need to do something like this right?

shopModule:addBuyableItem({'god amulet'}, 13805, 1000000, 5, 'god amulet')
it cant be 1? because it will sell with one charge right?
You'd have to test, but that sounds correct.

If you wanted to do it via Lua, you'd want to do something like this.. to get the items.xml charge value
So, this is how you'd want to do it from a quest chest, for instance.
Lua:
local itemID = 10218
local charges = ItemType(itemID):getCharges()
player:addItem(itemID, charges)
 
Back
Top