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

TFS 0.X Spell that create item and the item decay

Joined
Apr 11, 2015
Messages
102
Reaction score
6
Well, the title is pretty explanatory, I made a spell that, when you use it, its create an item in your ammo slot, and in item.xml, i put the decay and duration, But...
The item does not 'fade away'. My decay is to 0, so it should disappear. When i put the duration, also i put the 'show duration' and the seconds does not decay. I don't know what i am doing wrong
The spell:
C++:
function onCastSpell(cid, var)
    local storage = 17127
    local time = 3
    if(exhaustion.make(cid, storage, time) == true) then

    if getPlayerSlotItem(cid, 10).itemid > 0 then
    doPlayerSendTextMessage(cid, 22, "Nop")
    else
    doPlayerAddItem(cid, 13216, 1, true, 1, SLOT_AMMO)
                end
    else
        doPlayerSendCancel(cid, "Cooldown: "..exhaustion.get(cid, storage)+1)
        return false
    end
end

The item:
C++:
    <attribute key="decayTo" value="0"/>
    <attribute key="duration" value="450"/>
    <attribute key="showduration" value="1"/>
    <attribute key="showattributes" value="1"/>
    <attribute key="weight" value="0"/>

Summing up: I want this item to disappear, but the timer does not start
Also, in the movements, the slot is in "ammo"
 
you actually need to call a function to start the decay counter in recently created items.
Lua:
local item = doPlayerAddItem(cid, 13216, 1, true, 1, SLOT_AMMO)
doItemDecay(item, true)
not sure if the name is correct because it's been a while since I last programmed in tfs 0.x but the idea is correct.
 
Back
Top