• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

problem npc soft boots repair

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
923
Location
Chile
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

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 :(
 
You can try this:
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)) 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())
 
late post.. so try this too.


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 and getPlayerMoney(cid) >= 10000 then
				doPlayerRemoveMoney(cid, 10000)
                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())
 
now i'm getting this error :/
LUA:
[15/08/2013 13:23:00] [Error - Action Interface] 
[15/08/2013 13:23:00] data/actions/scripts/other/softboots.lua:onUse
[15/08/2013 13:23:00] Description: 
[15/08/2013 13:23:00] (luaDoRemoveItem) Item not found


this is the script
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local moneyneed = 50000 -- price to get new soft boots
local playermoney = getPlayerMoney(cid)
if playermoney >= moneyneed then
if doPlayerTakeItem(cid, 10021, 1) then
doRemoveItem(item.uid,1)
doPlayerAddItem(cid, 6132, 1)
doPlayerRemoveMoney(cid, moneyneed)
doSendMagicEffect(fromPosition,12)
else
doPlayerSendTextMessage(cid,20, "Tu No Tienes Unas Soft Boots Hecha Mierda xd.")
end
else
doPlayerSendTextMessage(cid,20, "Disculpa, Tu Necesitas ".. moneyneed .." Gold Coins Para Tener Unas Nuevas Soft Boots.")
end
end

- - - Updated - - -

cyro i believe it worked, but the problem is that now, the soft boots instantly when you use them they get worn ;/ (ID 10021) instantly worn

- - - Updated - - -

no no, the one you gave me aparently works, but i can't see if it's properly working because when the nPC gives you the soft boots it places them in your boots slot, and my soft boots are bugged :S and if you use them, instantly they transform in those worn boots (10021 ID) do you understand? so now i'm asking for help to solve that bug :S

- - - Updated - - -

i made a new thread, thanks guys, rep for both

http://otland.net/f16/soft-boots-instalntly-getting-worn-197713/#post1903675
 
Last edited:
NPC!
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
 
local soft = {
	[1] = {name = 'soft boots', price = 50000, worn = 10021, ID = 6132}}
 
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] = 0
	return true
end
 
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	elseif Topic[cid] ~= 0 then
		if msgcontains(msg, 'yes') then
			local v = soft[Topic[cid]]
			if getPlayerItemCount(cid, v.worn) > 0 then
				if doPlayerRemoveMoney(cid, v.price) then
					doPlayerRemoveItem(cid, v.worn, 1)
					doPlayerAddItem(cid, v.ID, 1)
					npcHandler:say('Here you are.', cid)
				else
					npcHandler:say('Disculpa, Tu Necesitas 50000 Gold Coins Para Tener Unas ' .. v.name .. '.',cid)
				end
			else
				npcHandler:say('Tu No Tienes Unas ' .. v.name .. ' Hecha Mierda xd.',cid)
			end
		else
			npcHandler:say('Trai unas soft boots ala siguiente xd.', cid) -- esto ya editalo tu 
		end
		Topic[cid] = 0
	else
		for i = 1, #soft do
			if msgcontains(msg, soft[i].name) then
				npcHandler:say('Do you want to repair your worn ' .. soft[i].name .. ' for ' .. soft[i].price .. ' gold?',cid)
				Topic[cid] = i
				break
			end
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
----
FOR ONCLICK <- ACTIONS
LUA:
local moneyneed = 50000 -- price to get new soft boots
local playermoney = getPlayerMoney(cid) 
local soft = {
	[10021] = {id = 6132, money = 50000}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if soft[item.itemid] then
		if doPlayerRemoveMoney(cid, soft[item.itemid].money) then
			doTransformItem(item.uid, soft[item.itemid].id)
		doSendMagicEffect(getCreaturePosition(cid),12)
		else
		doPlayerSendCancel(cid, "Tu No Tienes Unas Soft Boots Hecha Mierda xd.")
		else
			doPlayerSendCancel(cid, "Disculpa, Tu Necesitas 50000 Gold Coins Para Tener Unas Nuevas Soft Boots.")
		end
	end
	return true
end

or

LUA:
local moneyneed = 50000 -- price to get new soft boots
local playermoney = getPlayerMoney(cid) 
local soft = {
	[10021] = {id = 6132, money = 50000}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if soft[item.itemid] then
		if doPlayerRemoveMoney(cid, soft[item.itemid].money) then
			doTransformItem(item.uid, soft[item.itemid].id)
		doSendMagicEffect(getCreaturePosition(cid),12)
		else
			doPlayerSendCancel(cid, "Disculpa, Tu Necesitas 50000 Gold Coins Para Tener Unas Nuevas Soft Boots.")
		end
	end
	return true
end
 
Last edited:
Cronox, i tried the first action and the npc, now i can't put the worn soft boots in the boots slot, and when i "repair" them, still changing inmediately into worn soft boots :/
the i tried with the second action and i get this
LUA:
[15/08/2013 16:29:34] [Error - Action Interface] 
[15/08/2013 16:29:34] data/actions/scripts/other/softboots.lua
[15/08/2013 16:29:34] Description: 
[15/08/2013 16:29:34] (luaGetPlayerMoney) Player not found
 
hmmm.. for works second action try this:
LUA:
local moneyneed = 50000 -- price to get new soft boots
local playermoney = getPlayerMoney(cid) 
local soft = {
	[10021] = {id = 6132, money = 50000}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if soft[item.itemid] then
	     	doPlayerRemoveMoney(cid,50000)
			doTransformItem(item.uid, soft[item.itemid].id)
		doSendMagicEffect(getCreaturePosition(cid),12)
		else
			doPlayerSendCancel(cid, "Disculpa, Tu Necesitas 50000 Gold Coins Para Tener Unas Nuevas Soft Boots.")
		end
	end
	return true
end

wanna paste your items.xml
line softboots?
6132
and
10021

and..
movements.xml
 
Back
Top