TFS 0.X Imbuements System to 0.4 (8.60)

runsicky

Member
Joined
Apr 19, 2018
Messages
35
Reaction score
10
Hey guys!
I was looking for a help to bring this new amazing system of Tibia 11 to 8.60, Imbuements System or something like that...

How to add a temporary atribute to an item?
For example:
local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid
How to add +10 speed for the item ibID for 20 hours?

What do i have so far?
This scripts, not working, no errors on console, just not working (it was just an idea, idk how to do the system, just coppy scripts trying to edit to get something or an ideia to someone else pro help me to do)

NPC
Code:
--[[
        CONST_SLOT_FIRST = 1
        CONST_SLOT_HEAD = CONST_SLOT_FIRST
        CONST_SLOT_NECKLACE = 2
        CONST_SLOT_BACKPACK = 3
        CONST_SLOT_ARMOR = 4
        CONST_SLOT_RIGHT = 5
        CONST_SLOT_LEFT = 6
        CONST_SLOT_LEGS = 7
        CONST_SLOT_FEET = 8
        CONST_SLOT_RING = 9
        CONST_SLOT_AMMO = 10
        CONST_SLOT_LAST = CONST_SLOT_AMMO
]]

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic, Description = {}, {}
local thinkMsg = {
        "I can personalise your items, come to me!",
        "Want to upgrade your items temporarily? Come to me!"
}

function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)  npcHandler:onCreatureSay(cid, type, msg) end
function onThink()                      npcHandler:onThink() end

function greetCallback(cid)
        Topic[cid], Description[cid] = 1, nil
        return true
end
function creatureSayCallback(cid, type, msg)
        if not npcHandler:isFocused(cid) then
                return false
        elseif (Topic[cid] == 1) and (msgcontains(msg, 'yes') or msgcontains(msg, 'imbuement') or msgcontains(msg, 'imbuements')) then
                npcHandler:say('Choose the imbuements type: {swiftness}', cid)
                Topic[cid] = 2
       


        elseif Topic[cid] == 2 and msgcontains(msg, 'swiftness') then
                npcHandler:say('What kinda of weapon you want to upgrade? {boots}', cid)
                Topic[cid] = 17


        -- swiftness
        elseif Topic[cid] == 17 and msgcontains(msg, 'boots') then
                local slot = getPlayerSlotItem(cid, CONST_SLOT_FEET)
                print(slot)
                if slot then
                        npcHandler:say('You do not have the equipament in the slot you select.')   
                        return true
                end
                local ibID = slot.uid
                local recipient_itemid = 11219 -- compasses
                local recipient_neededammount = 25


                if(getPlayerItemCount(cid,recipient_itemid,recipient_neededammount)) then
                        doPlayerRemoveItem(cid,recipient_itemid,recipient_neededammount)
                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
                        npcHandler:say('Your item was imbuemented successfully', cid)                       
                        doSetItemAttribute(ibID, "BonusSpeed", os.time() + 60 * 60 * 20)
                end
                else
                        npcHandler:say('You do not have items enoght to make a Imbuement', cid)
                end



        return true
end
npcHandler:setMessage(MESSAGE_FAREWELL, 'I hope you made the right choice, have a wonderful day.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Okay well, I guess you don\'t care if someone steals your stuff... You will have no idea if it\'s yours...')
npcHandler:setMessage(MESSAGE_GREET, 'Hello, |PLAYERNAME|! I am a brander. I can personalize any of your items for a price, would you like to continue to the next step?')
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Movemments.xml
Code:
    <!-- imbuements -->
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
movemment_imbuements.lua
Code:
function onEquip(cid, item, slot)
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid
   -- bonus speed
   if getItemAttribute(ibID, "BonusSpeed") and getItemAttribute(ibID, "BonusSpeed")  > os.time() then
       if getPlayerStorageValue(cid, speed_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 10)
           setPlayerStorageValue(cid, speed_IB_storage, 1)
       end
   -- bonus axe
   elseif getItemAttribute(ibID, "BonusAxe") and getItemAttribute(ibID, "BonusAxe")  > os.time() then
   
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, speed_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 10)
       end
   end
   return true
end
 
Top