TFS 0.X Imbuements System to 0.4 (8.60)

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
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
 

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,509
Best answers
9
Reaction score
212
Location
Chile
why don't you pick a 10.x server OR 11.X(i don't remember when imbuement system was added) and run on it 8.6 map?
 

Perun

nems.online
Premium User
Joined
May 1, 2009
Messages
279
Best answers
5
Reaction score
97
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
In tfs 0.* you can't just put random attribute to item like you trying to do here:

Code:
doSetItemAttribute(ibID, "BonusSpeed", os.time() + 60 * 60 * 20)
You need att new attribute in sources, so you acn use it like you want.
You can create custom cpp functions to handle temp attributes or just using lua handle attribute in any attribute currently exist (it's not good idea but it's possible).
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,124
Best answers
164
Reaction score
2,194
In tfs 0.* you can't just put random attribute to item like you trying to do here:

Code:
doSetItemAttribute(ibID, "BonusSpeed", os.time() + 60 * 60 * 20)
You need att new attribute in sources, so you acn use it like you want.
You can create custom cpp functions to handle temp attributes or just using lua handle attribute in any attribute currently exist (it's not good idea but it's possible).
If wanting to do this through Lua, this is mostly correct. However, as long as you can create the buff you are seeking, either through globalEvents/creaturescripts/movements with sufficient checks to keep the buff going.. you can use "special description" field to hold any of the buff information, and extrapolate from there.

It's definitely faster to do in source, but you can do nearly anything using the lua & xml documents.
Lua:
getItemSpecialDescription(uid)
doSetItemSpecialDescription(uid, "text")
 
OP
runsicky

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
If wanting to do this through Lua, this is mostly correct. However, as long as you can create the buff you are seeking, either through globalEvents/creaturescripts/movements with sufficient checks to keep the buff going.. you can use "special description" field to hold any of the buff information, and extrapolate from there.

It's definitely faster to do in source, but you can do nearly anything using the lua & xml documents.
Lua:
getItemSpecialDescription(uid)
doSetItemSpecialDescription(uid, "text")
Oh man finally someone help!
Thaaaaaank you so muuuuuch!!!

Would you help me with more 3 things?

1) This is what u said?
Code:
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 ib_UID = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
                -- HOW TO CHECK IF PLAYER IS USING A BOOTS?
                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('Here you are. May I help you with something else? ', cid)
                        doSetItemSpecialDescription(ib_UID, "swiftness")
                        Topic[cid] = 1
                else
                        npcHandler:say('You do not have the recipients enoght to make the Imbuement! May I help you with something else?', cid)
                        Topic[cid] = 1
                end
        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())
2) How to check if player have an item on feet on type == boots
Code:
                local ib_UID = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
                if(getPlayerSlotItem(cid, CONST_SLOT_FEET).??? == boots)

3) How to add this attribute temporally? After 20 hours it over back to normal
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,124
Best answers
164
Reaction score
2,194
Oh man finally someone help!
Thaaaaaank you so muuuuuch!!!

Would you help me with more 3 things?

1) This is what u said?
Code:
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 ib_UID = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
                -- HOW TO CHECK IF PLAYER IS USING A BOOTS?
                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('Here you are. May I help you with something else? ', cid)
                        doSetItemSpecialDescription(ib_UID, "swiftness")
                        Topic[cid] = 1
                else
                        npcHandler:say('You do not have the recipients enoght to make the Imbuement! May I help you with something else?', cid)
                        Topic[cid] = 1
                end
        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())
2) How to check if player have an item on feet on type == boots
Code:
                local ib_UID = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
                if(getPlayerSlotItem(cid, CONST_SLOT_FEET).??? == boots)

3) How to add this attribute temporally? After 20 hours it over back to normal
items.xml tells the server what you can put into the feet slot.
Since you already know that nothing else can be placed into this socket, there's no reason to check if the item is classified as a boot or a weapon.

But.. if you really need to find that information just grab the item info using the item's itemid
If memory serves me correctly.. boots == 176.
Lua:
local info = getItemInfo(item.itemid).slotPosition
print(info)
XML:
<attribute key="slotType" value="feet"/>
#3, just set the item special description as
Lua:
"swiftness," .. (os.time() + however_many_seconds) .. ""
Then pull the information apart whenever you want to check stuff.
Lua:
local itemString = getItemSpecialDescription(item.uid)
local one, two = itemString:match("([^,]+),([^,]+)")
print(one)
print(two)
 
OP
runsicky

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
items.xml tells the server what you can put into the feet slot.
Since you already know that nothing else can be placed into this socket, there's no reason to check if the item is classified as a boot or a weapon.

But.. if you really need to find that information just grab the item info using the item's itemid
If memory serves me correctly.. boots == 176.
Lua:
local info = getItemInfo(item.itemid).slotPosition
print(info)
XML:
<attribute key="slotType" value="feet"/>
#3, just set the item special description as
Lua:
"swiftness," .. (os.time() + however_many_seconds) .. ""
Then pull the information apart whenever you want to check stuff.
Lua:
local itemString = getItemSpecialDescription(item.uid)
local one, two = itemString:match("([^,]+),([^,]+)")
print(one)
print(two)
The check was to attack weapons (like bows, axes, swords...)

What do i doing wrong?
movemments
Code:
    <!-- imbuements -->
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid
   -- bonus speed
   if getItemSpecialDescription(ibID, "swiftness") and getItemSpecialDescription(ibID, "swiftness")  > os.time() then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 100)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 100)
       end
   end
   return true
end
NPC
Code:
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 ib_UID = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
                -- HOW TO CHECK IF PLAYER IS USING A BOOTS?
                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('Here you are. May I help you with something else? ', cid)
                        doSetItemSpecialDescription(ib_UID, "swiftness," .. (os.time() + however_many_seconds) .. "")
                        Topic[cid] = 1
                else
                        npcHandler:say('You do not have the recipients enoght to make the Imbuement! May I help you with something else?', cid)
                        Topic[cid] = 1
                end
        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())
Onlook nothing change
Code:
16:25 You see leather boots (Arm:1). It weighs 9.00 oz.
And the speed don't change either

Do i doing something wrong? Sorry, i'm noob
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,124
Best answers
164
Reaction score
2,194
The check was to attack weapons (like bows, axes, swords...)

What do i doing wrong?
movemments
Code:
    <!-- imbuements -->
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid
   -- bonus speed
   if getItemSpecialDescription(ibID, "swiftness") and getItemSpecialDescription(ibID, "swiftness")  > os.time() then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 100)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 100)
       end
   end
   return true
end
NPC
Code:
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 ib_UID = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
                -- HOW TO CHECK IF PLAYER IS USING A BOOTS?
                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('Here you are. May I help you with something else? ', cid)
                        doSetItemSpecialDescription(ib_UID, "swiftness," .. (os.time() + however_many_seconds) .. "")
                        Topic[cid] = 1
                else
                        npcHandler:say('You do not have the recipients enoght to make the Imbuement! May I help you with something else?', cid)
                        Topic[cid] = 1
                end
        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())
Onlook nothing change
Code:
16:25 You see leather boots (Arm:1). It weighs 9.00 oz.
And the speed don't change either

Do i doing something wrong? Sorry, i'm noob
line 45.. please tell me you're pulling my leg.
Check your console for errors.
I'm surprised the npc even speaks to you.
 
OP
runsicky

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
I'm sorry to this long, i had to do some shits about school, i had to look it calm
I mean, i had to search, and do some shits to help you to help us

That was what u want?
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 ib_UID = getPlayerSlotItem(cid, CONST_SLOT_FEET).uid
                -- HOW TO CHECK IF PLAYER IS USING A BOOTS?
                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('Here you are. May I help you with something else? ', cid)

                        local hours = 60 * 60
                        local time = 20 * hours
                        doSetItemSpecialDescription(ib_UID, "swiftness," .. (os.time() + time) .. "")
                        Topic[cid] = 1
                else
                        npcHandler:say('You do not have the recipients enoght to make the Imbuement! May I help you with something else?', cid)
                        Topic[cid] = 1
                end
        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())

Code:
[16:17:33.736] [Error - NpcScript Interface] 
[16:17:33.736] data/npc/scripts/npc_imbuements.lua:onCreatureSay
[16:17:33.736] Description: 
[16:17:33.736] data/npc/scripts/npc_imbuements.lua:63: attempt to call global 'doSetItemSpecialDescription' (a nil value)
[16:17:33.736] stack traceback:
[16:17:33.736]     data/npc/scripts/npc_imbuements.lua:63: in function 'callback'
[16:17:33.736]     data/npc/lib/npcsystem/npchandler.lua:423: in function 'onCreatureSay'
[16:17:33.736]     data/npc/scripts/npc_imbuements.lua:29: in function <data/npc/scripts/npc_imbuements.lua:29>
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,124
Best answers
164
Reaction score
2,194
Sorry was my fault.
Forgot that it isn't a standard function.
Add this into data/lib/100-shortcut
Lua:
function doSetItemSpecialDescription(uid, str)
    return doItemSetAttribute(uid, "description", str)
end
 
OP
runsicky

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
Sorry was my fault.
Forgot that it isn't a standard function.
Add this into data/lib/100-shortcut
Lua:
function doSetItemSpecialDescription(uid, str)
    return doItemSetAttribute(uid, "description", str)
end
I can feel the smell of imbuements system on 8.6 hahaha

Progress:
Code:
15:00 You see leather boots (Arm:3). It weighs 9.00 oz. swiftness,1560607165
How to show the mins on look?

Any idea why it is not adding speed? Not even printing a shit...
Code:
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid
   -- bonus speed
   if getItemSpecialDescription(ibID, "swiftness") and getItemSpecialDescription(ibID, "swiftness")  > os.time() then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 500)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
           print("XIKINI S2")
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 500)
          print("XIKINI -.-")
       end
   end
   return true
end
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,124
Best answers
164
Reaction score
2,194
I can feel the smell of imbuements system on 8.6 hahaha

Progress:
Code:
15:00 You see leather boots (Arm:3). It weighs 9.00 oz. swiftness,1560607165
How to show the mins on look?

Any idea why it is not adding speed? Not even printing a shit...
Code:
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid
   -- bonus speed
   if getItemSpecialDescription(ibID, "swiftness") and getItemSpecialDescription(ibID, "swiftness")  > os.time() then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 500)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
           print("XIKINI S2")
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 500)
          print("XIKINI -.-")
       end
   end
   return true
end
----
Quoting myself from earlier in the thread.

--------------------------------------------- Quote start
#3, just set the item special description as
Lua:
"swiftness," .. (os.time() + however_many_seconds) .. ""
Then pull the information apart whenever you want to check stuff.
Lua:
local itemString = getItemSpecialDescription(item.uid)
local one, two = itemString:match("([^,]+),([^,]+)")
print(one)
print(two)
--------------------------------------------- Quote end

Code:
getItemSpecialDescription(ibID, "swiftness")
This function doesn't have a second parameter so using it like this will either not pass correctly or will simply fail to be useful.
You need to gather the information using this function, and then pull that information apart to check each of the sections individually.
You'd want to do it something like this, after pulling the information apart.
Lua:
if one == "swiftness" and two + 0 > os.time then
Since we already know that the information 'two' is a number, it's faster to use addition (+ 0) to convert the string into a number instead of using the lua function tonumber.

-- edited to construct my sentences more clearly.
 
Last edited:
OP
runsicky

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
----
Quoting myself from earlier in the thread.

--------------------------------------------- Quote start
#3, just set the item special description as
Lua:
"swiftness," .. (os.time() + however_many_seconds) .. ""
Then pull the information apart whenever you want to check stuff.
Lua:
local itemString = getItemSpecialDescription(item.uid)
local one, two = itemString:match("([^,]+),([^,]+)")
print(one)
print(two)
--------------------------------------------- Quote end

Code:
getItemSpecialDescription(ibID, "swiftness")
This function doesn't have a second parameter so using it like this will either not pass correctly or will simply fail to be useful.
You need to gather the information using this function, and then pull that information apart to check each of the sections individually.
You'd want to do it something like this, after pulling the information apart.
Lua:
if one == "swiftness" and two + 0 > os.time then
Since we already know that the information 'two' is a number, it's faster to use addition (+ 0) to convert the string into a number instead of using the lua function tonumber.

-- edited to construct my sentences more clearly.
lol man, thank you so much again
now even me could understand that

but it shouldnt print something when i equip a boots?

Code:
    <!-- imbuements -->
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid

    local itemString = getItemSpecialDescription(item.uid)
    local one, two = itemString:match("([^,]+),([^,]+)")
    print(one)
    print(two)

   -- bonus speed
   if one == "swiftness" and two + 0 > os.time then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 500)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
           print("XIKINI S2")
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 500)
          print("XIKINI -.-")
       end
   end
   return true
end
It always should print one and two, right?
Because it is not printing anything
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,124
Best answers
164
Reaction score
2,194
lol man, thank you so much again
now even me could understand that

but it shouldnt print something when i equip a boots?

Code:
    <!-- imbuements -->
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid

    local itemString = getItemSpecialDescription(item.uid)
    local one, two = itemString:match("([^,]+),([^,]+)")
    print(one)
    print(two)

   -- bonus speed
   if one == "swiftness" and two + 0 > os.time then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 500)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
           print("XIKINI S2")
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 500)
          print("XIKINI -.-")
       end
   end
   return true
end
It always should print one and two, right?
Because it is not printing anything
One and two will only print if they aren't erroring.
If you add a 'print(1)' underneath the function, that will definitely print, if the script is working at all.
If '1' doesn't print, then the boots aren't registered in movements.xml properly, or the script errored.. Probably on start-up
 
OP
runsicky

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
One and two will only print if they aren't erroring.
If you add a 'print(1)' underneath the function, that will definitely print, if the script is working at all.
If '1' doesn't print, then the boots aren't registered in movements.xml properly, or the script errored.. Probably on start-up
I think the problem is on register item on movemments
Code:
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   print("player equip an item") 
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid

    local itemString = getItemSpecialDescription(item.uid)
    local one, two = itemString:match("([^,]+),([^,]+)")
    print(one)
    print(two)

   -- bonus speed
   if one == "swiftness" and two + 0 > os.time then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 500)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
           print("XIKINI S2")
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 500)
          print("XIKINI -.-")
       end
   end
   return true
end
don't print "player equip an item" or anything...
there is other way to declare all items in movemment?
i can't declare one by one, cause others items have others attributes, vocation options...
 

Xikini

I whore myself out for likes
Premium User
Joined
Nov 17, 2010
Messages
4,124
Best answers
164
Reaction score
2,194
I think the problem is on register item on movemments
Code:
    <movevent type="Equip" event="script" value="movemment_imbuements.lua"/>
    <movevent type="DeEquip" event="script" value="movemment_imbuements.lua"/>
Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   print("player equip an item")
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid

    local itemString = getItemSpecialDescription(item.uid)
    local one, two = itemString:match("([^,]+),([^,]+)")
    print(one)
    print(two)

   -- bonus speed
   if one == "swiftness" and two + 0 > os.time then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 500)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
           print("XIKINI S2")
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 500)
          print("XIKINI -.-")
       end
   end
   return true
end
don't print "player equip an item" or anything...
there is other way to declare all items in movemment?
i can't declare one by one, cause others items have others attributes, vocation options...
Someone can correct me if I'm wrong, but I think it's on a per itemid basis. There isn't a way to do all items in 1 line in XML.

You'll basically need to incorporate those other items into one script
 
OP
runsicky

runsicky

Member
Joined
Apr 19, 2018
Messages
46
Best answers
0
Reaction score
11
what are u mean?
i'll have to define one by one like this:
Code:
    <movevent type="Equip" itemid="2645" slot="feet" event="script" value="movemment_imbuements.lua">
        <vocation id="4"/>
        <vocation id="8" showInDescription="0"/>
        <vocation id="12" showInDescription="0"/>
    </movevent>
    <movevent type="DeEquip" itemid="2645" slot="feet" event="script" value="movemment_imbuements.lua"/>
It would not broke the defaul atributes, right?
I mean <attribute key="speed" value="40" />
from boh
Code:
    <item id="2195" name="boots of haste">
        <attribute key="weight" value="750" />
        <attribute key="slotType" value="feet" />
        <attribute key="speed" value="40" />
        <attribute key="showattributes" value="1" />
        <attribute key="armor" value="1" />
    </item>
---

Code:
local feet_IB_storage = 700
local legs_IB_storage = 701
local armour_IB_storage = 702
local head_IB_storage = 703
local boots_IB_storage = 704
local atkweapon_IB_storage = 705
local defweapon_IB_storage = 706

function onEquip(cid, item, slot)
   print("player equip an item") 
   local ibID = getPlayerSlotItem(cid, CONST_SLOT_FEET).itemid

    local itemString = getItemSpecialDescription(item.uid)
    local one, two = itemString:match("([^,]+),([^,]+)")
    print(one)
    print(two)

   -- bonus speed
   if one == "swiftness" and two + 0 > os.time then
       if getPlayerStorageValue(cid, feet_IB_storage) < 1 then
           doChangeSpeed(cid, getCreatureSpeed(cid) + 500)
           setPlayerStorageValue(cid, feet_IB_storage, 1)
           print("XIKINI S2")
       end
   --elseif others
   end
   return true
end

function onDeEquip(cid, item, slot)
   if slot == CONST_SLOT_FEET then
       if getPlayerStorageValue(cid, feet_IB_storage) > 0 then
          doChangeSpeed(cid, getCreatureSpeed(cid) - 500)
          print("XIKINI -.-")
       end
   end
   return true
end
Is giving error:
Code:
player equip an item
swiftness
1561206837

[11:49:42.487] [Error - MoveEvents Interface] 
[11:49:42.487] data/movements/scripts/movemment_imbuements.lua:onEquip
[11:49:42.487] Description: 
[11:49:42.487] data/movements/scripts/movemment_imbuements.lua:19: attempt to compare function with number
[11:49:42.487] stack traceback:
[11:49:42.487]     data/movements/scripts/movemment_imbuements.lua:19: in function <data/movements/scripts/movemment_imbuements.lua:9>
 
Top