Edling
Member
- Joined
- Mar 1, 2009
- Messages
- 246
- Reaction score
- 11
Can't get this to work... Spool yarn works, fire sword works and chicken wing works. But not warrior sweat and fighting spirit
Problem solved, updated the script here which will only exchange magic sulphur, fighting spirit, enchanted chicken wing, warrior sweat, and spool of yarns!
Problem solved, updated the script here which will only exchange magic sulphur, fighting spirit, enchanted chicken wing, warrior sweat, and spool of yarns!
Code:
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
local cycmsg = 'Cling Clang!'
local noimsg = 'Dont try to fool me!'
local deny = 'Not sure eh?'
local infbolt = 4 -- change this to adjust the number of infernal bolts you want to give to the players for 1 soul orb.
--------------------MESSAGES------------------------------------------------------------------------------
if msgcontains(msg, 'help') or msgcontains(msg, 'trade') then
selfSay('I can exchange some equipment for other specialties...}.', cid)
elseif msgcontains(msg, 'spool of yarn') then
selfSay('You sure you want to make this exchange?', cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'warrior sweat') then
selfSay('You sure you want to make this exchange?', cid)
talkState[talkUser] = 2
elseif msgcontains(msg, 'magic sulphur') then
selfSay('You sure you want to make this exchange?', cid) 2195
talkState[talkUser] = 3
elseif msgcontains(msg, 'enchanted chicken wing') then
selfSay('You sure you want to make this exchange?', cid)
talkState[talkUser] = 4
elseif msgcontains(msg, 'fighting spirit') then
selfSay('You sure you want to make this exchange?', cid)
talkState[talkUser] = 5
-------------GETTING METALS FROM HIM-------------------
-- Fighting Spirit
elseif talkState[talkUser] == 5 then
if msgcontains(msg, 'yes') then
if doPlayerTakeItem(cid, 2498, 2) == true then
doPlayerAddItem(cid, 5884, 1)
selfSay(cycmsg, cid)
talkState[talkUser] = 0
else
selfSay(noimsg, cid)
talkState[talkUser] = 0
end
else
selfSay(deny, cid)
talkState[talkUser] = 0
end
-- Chicken Wing
elseif talkState[talkUser] == 4 then
if msgcontains (msg, 'yes') then
if doPlayerTakeItem(cid, 2195, 1) == true then
doPlayerAddItem(cid, 5891, 1)
selfSay(cycmsg, cid)
talkState[talkUser] = 0
else
selfSay(noimsg, cid)
talkState[talkUser] = 0
end
else
selfSay(deny, cid)
talkState[talkUser] = 0
end
-- Magic Sulphur
elseif talkState[talkUser] == 3 then
if msgcontains (msg, 'yes') then
if doPlayerTakeItem(cid, 2392, 3) == true then
doPlayerAddItem(cid, 5904, 1)
selfSay(cycmsg, cid)
talkState[talkUser] = 0
else
selfSay(noimsg, cid)
talkState[talkUser] = 0
end
else
selfSay(deny, cid)
talkState[talkUser] = 0
end
-- Warrior Sweat
elseif talkState[talkUser] == 2 then
if msgcontains (msg, 'yes') then
if doPlayerTakeItem(cid, 2475, 4) == true then
doPlayerAddItem(cid, 5885, 1)
selfSay(cycmsg, cid)
talkState[talkUser] = 0
else
selfSay(noimsg, cid)
talkState[talkUser] = 0
end
else
selfSay(deny, cid)
talkState[talkUser] = 0
end
-- Spool Yarn
elseif talkState[talkUser] == 1 then
if msgcontains (msg, 'yes') then
if doPlayerTakeItem(cid, 5879, 10) == true then
doPlayerAddItem(cid, 5886, 1)
selfSay(cycmsg, cid)
talkState[talkUser] = 0
else
selfSay(noimsg, cid)
talkState[talkUser] = 0
end
else
selfSay(deny, cid)
talkState[talkUser] = 0
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Last edited: