TFS 0.X Imbuements System to 0.4 (8.60)

runsicky

Member
Joined
Apr 19, 2018
Messages
48
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,433
Reaction score
202
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

Premium User
Premium User
Joined
May 1, 2009
Messages
246
Reaction score
66
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,090
Reaction score
2,153
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
48
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,090
Reaction score
2,153
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
48
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,090
Reaction score
2,153
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
48
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>
 
Top