Thorn
Spriting since 2013
hii, i'm having a problem wich when a player comes to the npb boots repair and says soft boot, yes, (having the worn soft boots 10021 ID) the npc don't take this boots, don't give you a new pair and it does gets your money, but i can't find the error, everything seem fine to me :/, here is the script
and here are the soft boots in items.xml, just in case
plzz help
LUA:
local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'soft') or msgcontains(msg, 'boots')) then
selfSay('Do you want to repair your worn soft boots for 10000 gold coins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 10021) >= 1) then
if(doPlayerRemoveMoney(cid, 10000) == TRUE) then
doPlayerRemoveItem(cid, 10021, 1)
doPlayerAddItem(cid, 6132)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
elseif(msgcontains(msg, 'firewalker') or msgcontains(msg, 'boots')) then
selfSay('Do you want to repair your worn firewalker boots for 10000 gold coins?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
if(getPlayerItemCount(cid, 10022) >= 1) then
if(doPlayerRemoveMoney(cid, 10000) == TRUE) then
doPlayerRemoveItem(cid, 10022, 1)
doPlayerAddItem(cid, 9933)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough gold.', cid)
end
else
selfSay('Sorry, you don\'t have the item.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
and here are the soft boots in items.xml, just in case
LUA:
<item id="2640" name="soft boots">
<attribute key="weight" value="800"/>
<attribute key="slotType" value="feet"/>
<attribute key="decayTo" value="10021"/>
<attribute key="transformDeEquipTo" value="6132"/>
<attribute key="duration" value="14400"/>
<attribute key="healthGain" value="1"/>
<attribute key="healthTicks" value="2000"/>
<attribute key="manaGain" value="2"/>
<attribute key="manaTicks" value="1000"/>
<attribute key="showduration" value="1"/>
</item>
LUA:
<item id="6132" article="a" name="pair of soft boots">
<attribute key="weight" value="800" />
<attribute key="slotType" value="feet" />
<attribute key="transformEquipTo" value="10021" />
<attribute key="stopduration" value="1" />
<attribute key="showduration" value="1" />
</item>
plzz help