LucasFerraz
Systems Analyst
I have this script:
I've found a problem, NPC is not givin' gingerbread.
Is possible to make it 100% real?
Gingerbreadman for 1 Christmas Token
Gingerbread Recipe for 10 Christmas Tokens
Jewel Case for 25 Christmas Tokens
Santa Hat for 50 Christmas Tokens
Santa Backpack for 75 Christmas Tokens
Santa Doll for 100 Christmas Tokens
Snowman Doll for 150 Christmas Tokens
Santa Teddy for 500 Christmas Tokens
Quick fix:
Code:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local Topic = {} 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 elseif msgcontains(msg, "item") or msgcontains(msg, "offer") then npcHandler:say("I accept presents that were stolen from Santa by those little pest Grynch Goblins in exchange for christmas tokens.", cid) elseif msgcontains(msg, "token") then npcHandler:say("I will trade a gingerbread man for 1 token, the gingerbread recipe for 10, a jewel case for 25, a santa hat for 50 and a santa doll for 100 tokens.", cid) elseif msgcontains(msg, "present") or msgcontains(msg, "bag") then npcHandler:say("Do you want trade some present bags for christmas tokens?", cid) Topic[cid] = 1 elseif (msgcontains(msg, "gingerbread") and msgcontains(msg, "man")) or msgcontains(msg, "gingerbreadman") then npcHandler:say("Do you want trade a christmas token for a gingerbread man?", cid) Topic[cid] = 2 elseif msgcontains(msg, "recipe") then npcHandler:say("Do you want trade 10 christmas tokens for a gingerbread man recipe?", cid) Topic[cid] = 3 elseif msgcontains(msg, "jewel") or msgcontains(msg, "case") then npcHandler:say("Do you want trade 25 christmas tokens for a jewel case?", cid) Topic[cid] = 4 elseif msgcontains(msg, "hat") then npcHandler:say("Do you want trade 50 christmas tokens for a santa hat?", cid) Topic[cid] = 5 elseif msgcontains(msg, "doll") then npcHandler:say("Do you want trade 100 christmas tokens for a santa doll?", cid) Topic[cid] = 6 elseif msgcontains(msg, "yes") and Topic[cid] == 1 then local tmp = getPlayerItemCount(cid, 6497) if 0 < tmp and doPlayerRemoveItem(cid,6497,tmp) == TRUE then npcHandler:say("Here you are.", cid) doPlayerAddItem(cid,6527,tmp) else npcHandler:say("I only want present bags.", cid) end Topic[cid] = 0 elseif msgcontains(msg, "yes") and Topic[cid] == 2 then if doPlayerRemoveItem(cid,6527,1) == TRUE then npcHandler:say("Here you are.", cid) doPlayerAddItem(cid,6501,1) else npcHandler:say("I only want present bags.", cid) end Topic[cid] = 0 elseif msgcontains(msg, "yes") and Topic[cid] == 3 then if doPlayerRemoveItem(cid,6527,10) == TRUE then npcHandler:say("Here you are.", cid) doPlayerAddItem(cid,6523,1) else npcHandler:say("I only want present bags.", cid) end Topic[cid] = 0 elseif msgcontains(msg, "yes") and Topic[cid] == 4 then if doPlayerRemoveItem(cid,6527,25) == TRUE then npcHandler:say("Here you are.", cid) doPlayerAddItem(cid,6104,1) else npcHandler:say("I only want present bags.", cid) end Topic[cid] = 0 elseif msgcontains(msg, "yes") and Topic[cid] == 5 then if doPlayerRemoveItem(cid,6527,50) == TRUE then npcHandler:say("Here you are.", cid) doPlayerAddItem(cid,6531,1) else npcHandler:say("I only want present bags.", cid) end Topic[cid] = 0 elseif msgcontains(msg, "yes") and Topic[cid] == 6 then if doPlayerRemoveItem(cid,6527,100) == TRUE then npcHandler:say("Here you are.", cid) doPlayerAddItem(cid,6512,1) else npcHandler:say("I only want present bags.", cid) end Topic[cid] = 0 elseif Topic[cid] > 0 then npcHandler:say("I'll be here when you're ready.", cid) Topic[cid] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
I've found a problem, NPC is not givin' gingerbread.
Is possible to make it 100% real?
Gingerbreadman for 1 Christmas Token
Gingerbread Recipe for 10 Christmas Tokens
Jewel Case for 25 Christmas Tokens
Santa Hat for 50 Christmas Tokens
Santa Backpack for 75 Christmas Tokens
Santa Doll for 100 Christmas Tokens
Snowman Doll for 150 Christmas Tokens
Santa Teddy for 500 Christmas Tokens