• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

NPC A Sweaty Cyclops working 99% (Missing only quests scripts).

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="A Sweaty Cyclops" script="data/npc/scripts/Sweaty Cyclops.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="22" head="0" body="0" legs="0" feet="0"/>
<parameters>
        <parameter key="message_greet" value="Hum Humm! Welcume lil' |PLAYERNAME|.."/>
        <parameter key="message_farewell" value="Good bye lil' one."/>
    </parameters>
</npc>
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
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
 
-- XVX FORGER START --
 
function amulet(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if doPlayerRemoveItem(cid,8262, 1) and doPlayerRemoveItem(cid,8263,1) and doPlayerRemoveItem(cid,8264,1) and doPlayerRemoveItem(cid,8265, 1) and doPlayerRemoveMoney(cid) >= 5000 then
 
doPlayerRemoveItem(cid, 8262, 1) 
doPlayerRemoveItem(cid, 8263, 1) 
doPlayerRemoveItem(cid, 8264, 1)
doPlayerRemoveItem(cid, 8265, 1) 
doPlayerRemoveMoney(cid,5000)
doPlayerAddItem(cid, 8266, 1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have all items or cash!', cid)
    end
end
 
function obsidian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
 
doPlayerRemoveItem(cid, 2516, 1)
doPlayerRemoveItem(cid, 2425, 1)
doPlayerAddItem(cid, 5908, 1)
            selfSay('Here is your item!', cid)
        else
            selfSay('You don\'t have these items!', cid)
    end
end	
 
function crude(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2393) >= 1 then
 
doPlayerRemoveItem(cid,2393,1)
            doPlayerAddItem(cid,5892,1)
            selfSay('Here is your item!', cid)
 
 
        else
            selfSay('You don\'t have these items!', cid)
    end
end
 
function draconian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 then
 
doPlayerRemoveItem(cid,2516,1)
            doPlayerAddItem(cid,5889,1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have these items!', cid)
   end   
end
 
 
function royal(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2487) >= 1 then
 
doPlayerRemoveItem(cid,2487,1)
            doPlayerAddItem(cid,5887,1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have these items!', cid)
   end   
end
 
 
function hells(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2462) >= 1 then
 
doPlayerRemoveItem(cid,2462,1)
            doPlayerAddItem(cid,5888,1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have these items!', cid)
   end 
end 
-- XVX FORGER END --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can forge Amulet, Obsidian Knife, Huge Chunk of Crude Iron and Piece of Draconian Steel!"})
 
local node1 = keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hum Humm! Welcume lil. Me can do unbroken but Big Ben want gold 5000 and Big Ben need a lil time to make it unbroken. Yes or no??'})
    node1:addChildKeyword({'yes'}, amulet, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node2 = keywordHandler:addKeyword({'knife'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield and an Obsidian Lance for a Obsidian Knife?'})
    node2:addChildKeyword({'yes'}, obsidian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node3 = keywordHandler:addKeyword({'uth\'prta'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Giant Sword for a Huge Chunk of Crude Iron?'})
    node3:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node4 = keywordHandler:addKeyword({'uth\'lokr'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield for a Piece of Draconian Steel?'})
    node4:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node5 = keywordHandler:addKeyword({'uth\'kean'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Crown Armor for a Piece of Royal Steel?'})
    node5:addChildKeyword({'yes'}, royal, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node6 = keywordHandler:addKeyword({'za\'ralator'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Devil Helmet for a Piece of Hell Steel?'})
    node6:addChildKeyword({'yes'}, hells, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
npcHandler:addModule(FocusModule:new())


Edit: Better Code

--------------------
Repp++
 
Last edited:
if getPlayerItemCount(cid,8262) >= 1 and getPlayerItemCount(cid,8263) >= 1 and getPlayerItemCount(cid,8264) >= 1 and getPlayerItemCount(cid,8265) >= 1 and getPlayerMoney(cid) >= 5000 then

doPlayerRemoveItem(cid, 8262, 1)
doPlayerRemoveItem(cid, 8263, 1)
doPlayerRemoveItem(cid, 8264, 1)
doPlayerRemoveItem(cid, 8265, 1)
If player remove all itens from backpack(bag or someting) and say 'yes' your npc dont check if this item did removed from player, make if(doplayerremove.. == true).
 
Lua:
if doPlayerRemoveItem(cid,8262, 1) and doPlayerRemoveItem(cid,8263,1) and doPlayerRemoveItem(cid,8264,1) and doPlayerRemoveItem(cid,8265, 1) and doPlayerRemoveMoney(cid) >= 5000 then

doPlayerAddItem(cid, 8266, 1)
 
NPC:

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 = 'Lil\' one no have that thing!'
        local deny      = 'Lil\' one is no sure? Okay'
        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('Me can make {royal steel}, {draconian steel}, {hell steel}, {crude iron}, {magic sulphur}, {warrior sweet}, {spider silk yarn}, {enchanted chicken wing}, {elanes crossbow}, {parchment}. Me also make lil\' {infernal bolt}.', cid)
 
        elseif msgcontains(msg, 'royal steel') then
        selfSay('Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil\' one want to trade?', cid)
        talkState[talkUser] = 1
 
    elseif msgcontains(msg, 'draconian steel') then
        selfSay('Firy steel it is. Need green ones\' breath to melt. Or red even better. Me can make from shield. Lil\' one want to trade?', cid)
                talkState[talkUser] = 2
 
    elseif msgcontains(msg, 'hell steel') then
        selfSay('Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil\' one want to trade?', cid)
                talkState[talkUser] = 3
 
    elseif msgcontains(msg, 'crude iron') then
        selfSay('Good iron is. Me friends use it much for fight. Me can make from weapon. Lil\' one want to trade?', cid)
                talkState[talkUser] = 4
 
        elseif msgcontains(msg, 'infernal bolt') then
                selfSay('Uh. Me can make some nasty lil\' bolt from soul orbs. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 5
 
        elseif msgcontains(msg, 'spider silk yarn') then
                selfSay('Uh. Me can make some nasty lil\' bolt from 10 giant spider silk. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 6
 
        elseif msgcontains(msg, 'warrior sweet') then
                selfSay('Uh. Me can make some nasty lil\' bolt from warrior helmet. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 7
 
        elseif msgcontains(msg, 'magic sulphur') then
                selfSay('Uh. Me can make some nasty lil\' bolt from 4 fire sword. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 8
 
        elseif msgcontains(msg, 'enchanted chicken wing') then
                selfSay('Uh. Me can make some nasty lil\' bolt from boots of haste. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 9
 
 
        elseif msgcontains(msg, 'elanes crossbow') then
                selfSay('Uh. Me can make some nasty lil\' bolt from boots of haste. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 10
 
 
        elseif msgcontains(msg, 'parchment') then
                selfSay('Uh. Me can make some nasty lil\' bolt from 10 bp of empty small potion. Lil\' one want to trade all?', cid)
                talkState[talkUser] = 11
 
-------------GETTING METALS FROM HIM-------------------
 
        -- Royal Steel
        elseif talkState[talkUser] == 1 then
                if msgcontains(msg, 'yes') then
                        if doPlayerTakeItem(cid, 2487, 1) == true then
                                doPlayerAddItem(cid, 5887, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay(deny, cid)
                        talkState[talkUser] = 0
                end
        -- Draconian Steel
        elseif talkState[talkUser] == 2 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 2516, 1) == true then
                                doPlayerAddItem(cid, 5889, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay(deny, cid)
                        talkState[talkUser] = 0
                end
        -- Hell Steel
        elseif talkState[talkUser] == 3 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 2462, 1) == true then
                                doPlayerAddItem(cid, 5888, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay(deny, cid)
                        talkState[talkUser] = 0
                end             
        -- Crude Iron
        elseif talkState[talkUser] == 4 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 2393, 1) == true then
                                doPlayerAddItem(cid, 5892, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay(deny, cid)
                        talkState[talkUser] = 0
                end   
        elseif talkState[talkUser] == 5 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 5944, 1) == true then
                                doPlayerAddItem(cid, 6529, infbolt)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay(deny, cid)
                        talkState[talkUser] = 0
                end
        -- Parchment
        elseif talkState[talkUser] == 11 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 7636, 200) == true then
                                doPlayerAddItem(cid, 1953, 1)
                                selfSay(cycmsg, cid)
                                talkState[talkUser] = 0
                        else
                                selfSay(noimsg, cid)
                                talkState[talkUser] = 0
                        end
                else
                        selfSay(deny, cid)
                        talkState[talkUser] = 0
                end
        -- Elanes Crossbow
        elseif talkState[talkUser] == 10 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 5954, 15) == true then
                                doPlayerAddItem(cid, 5947, 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] == 9 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] == 8 then
                if msgcontains (msg, 'yes') then
                        if doPlayerTakeItem(cid, 2392, 4) == 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] == 7 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] == 6 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())
 
By my:

Code:
 -- A Sweaty Cyclops [100% real version] --
      -- ~~~~~~~~ By Seminari ~~~~~~ --
      --          //// | \\\\        --
      --         / __     __ \       --
      --         |[*]  |  [*]|       --
      --         |     ^     |       --
      --          \ \_____/ /        --
      --           --\___/--         --
      --           \______/          --
      -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --


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
--returns how many msgs he have said already
function cancelNPCTalk(events)
  local ret=1
  for aux=1,table.getn(events) do
     if events[aux].done==FALSE then
        stopEvent(events[aux].event)
     else
        ret=ret+1
     end
  end
  events=nil
  return(ret)
end
 
function doCreatureSayWithDelay(cid,text,type,delay,e)
   if delay<=0 then
      doCreatureSay(cid,text,type)
   else
      local func=function(pars)
                    doCreatureSay(pars.cid,pars.text,pars.type)
                    pars.e.done=TRUE
                 end
      e.done=FALSE
      e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e})
   end
end
 
function doNPCTalkALot(msgs,interval)
  local e={}
  local ret={}
  if interval==nil then interval=3000 end --3 seconds is default time between messages
  for aux=1,table.getn(msgs) do
      e[aux]={}
      doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux])
      table.insert(ret,e[aux])
  end
  return(ret)
end
--end shit :P
 
 
 
 
 
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end      
-- zmienne lokalne
   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local namee = getPlayerName(cid)
local tabelka = {
                [1] = {wypowiedz = 'job', odpowiedz = 'I am smith.'},
                [2] = {wypowiedz = 'smith', odpowiedz = 'Working steel is my profession.'},
                [3] = {wypowiedz = 'steel', odpowiedz = 'Manny kinds of. Like {Mesh Kaha Rogh}, {Za\'Kalortith}, {Uth\'Byth}, {Uth\'Morc}, {Uth\'Amon}, {Uth\'Maer}, {Uth\'Doon}, and {Zatragil}.'},
                [4] = {wypowiedz = 'zatragil', odpowiedz = 'Most ancients use dream silver for different stuff. Now ancients most gone. Most not know about.'},
                [5] = {wypowiedz = 'uth\'doon', odpowiedz = 'It\'s high steel called. Only lil\' lil\' ones know how make.'},
                [6] = {wypowiedz = 'za\'kalortith', odpowiedz = 'It\'s evil. Demon iron is. No good cyclops goes where you can find and need evil flame to melt.'},
                [7] = {wypowiedz = 'mesh kaha rogh', odpowiedz = 'Steel that is singing when forged. No one knows where find today.'},
                [8] = {wypowiedz = 'ab\'dendriel', odpowiedz = 'Me parents live here before town was. Me not care about lil\' ones.'},
                [9] = {wypowiedz = 'lil\i lil\'', odpowiedz = 'Lil\' lil\' ones are so fun. We often chat. '},
                [10] = {wypowiedz = 'tibia', odpowiedz = 'One day I\'ll go and look. '},
                [11] = {wypowiedz = 'teshial', odpowiedz = 'Is one of elven family or such thing. Me not understand lil\' ones and their busisness.'},
                [12] = {wypowiedz = 'cenath', odpowiedz = 'Is one of elven family or such thing. Me not understand lil\' ones and their busisness.'},
                [13] = {wypowiedz = 'name', odpowiedz = 'I called Bencthyclthrtrprr by me people. Lil\' ones me call Big Ben.'},
                [14] = {wypowiedz = 'god', odpowiedz = 'You shut up. Me not want to hear.'},
				-- Wymiana items 1 --
                [15] = {wypowiedz = 'uth\'lokr', odpowiedz = 'Firy steel it is. Need green ones\' breath to melt. Or red even better. Me can make from shield. Lil\' one want to trade?', storage_wym = no, talk_give = yes, talk_jaki = 1},
				[16] = {wypowiedz = 'uth\'kean', odpowiedz = 'Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil\' one want to trade?', talk_give = yes, talk_jaki = 2},
				[17] = {wypowiedz = 'za\'ralator', odpowiedz = 'Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil\' one want to trade?', talk_give = yes, talk_jaki = 3},
				[18] = {wypowiedz = 'uth\'prta', odpowiedz = 'Good iron is. Me friends use it much for fight. Me can make from weapon. Lil\' one want to trade?', talk_give = yes, talk_jaki = 4},
				[18] = {wypowiedz = 'soul orb', odpowiedz = 'Uh. Me can make some nasty lil\' bolt from soul orbs. Lil\' one want to trade all?', talk_give = yes, talk_jaki = 5},
				[19] = {wypowiedz = 'amulet', odpowiedz = 'Hum Humm! Welcume lil. Me can do unbroken but Big Ben want gold 5000 and Big Ben need a lil time to make it unbroken. Yes or no??', talk_give = yes, talk_jaki = 6},
				[20] = {wypowiedz = 'gear wheel', odpowiedz ='Hmmm you want to change your iron ore to gear wheel?', odpowiedzZla = 'Only for persons whose start the quest of beregar city..', storage_wym = yes, storage_jaki = 72182, storage_nr = 2, talk_give = yes, talk_jaki = 7},
				[21] = {wypowiedz = 'bast skirt', odpowiedz = 'Lil\' one bring three bast skirts?', talk_give = yes, talk_jaki = 9},
				-- Forge --
				[22] = {wypowiedz = 'forge', odpowiedz = 'Me can forge equipment back to steel. Like {Za\'Ralator}, {Uth\'Kean}, {Uth\'Lokr}, {Uth\'Prta}'},
				-- Wymiana items 2 --
				}
local tabela2 = {
                [1] = {wypowiedz = 'yes', talk_wym = yes, talk_jaki = 1, item1 = 2516, item2 = 5889, item1_count = 1, item2_count = 1},
				[2] = {wypowiedz = 'yes', talk_wym = yes, talk_jaki = 2, item1 = 2487, item2 = 5887, item1_count = 1, item2_count = 1},
				[3] = {wypowiedz = 'yes', talk_wym = yes, talk_jaki = 3, item1 = 2462, item2 = 5888, item1_count = 1, item2_count = 1},
				[4] = {wypowiedz = 'yes', talk_wym = yes, talk_jaki = 4, item1 = 2393, item2 = 5892, item1_count = 1, item2_count = 1},
				[5] = {wypowiedz = 'yes', talk_wym = yes, talk_jaki = 5, item1 = 5944, item2 = 6529, item1_count = 1, item2_count = 2},
                [6] = {wypowiedz = 'yes', talk_wym = yes, talk_jaki = 7, item1 = 5880, item2 = 9690, item1_count = 1, item2_count = 1, storage_wym = yes, storage_jaki = 72182, storage_nr = 2},
				[7] = {wypowiedz = 'yes', talk_wym = yes, talk_jaki = 6, item_wiele = yes, item_1 = 8262, item_2 = 8263, item_3 = 8264, item_4 = 8265, item2 = 8266, item1_count = 1, item2_count = 1},
				}
			local questStg = 8239
			local questStg_nr = 2
			local questLog = 98203
for i=1, #tabelka do
    if msgcontains(msg, tabelka[i].wypowiedz) then
          selfSay(tabelka[i].odpowiedz, cid)
	    if tabelka[i].talk_give == yes then
		  talkState[talkUser] = tabelka[i].talk_jaki
		end
		
    end
	
end
for i=1, #tabela2 do	
    if msgcontains(msg, tabela2[i].wypowiedz) then
	   if getPlayerStorageValue(cid, questStg) >= questStg_nr then
	      if talkState[talkUser] == tabela2[i].talk_jaki and tabela2[i].item_wiele == yes and doPlayerTakeItem(cid, tabela2[i].item_1, tabela2[i].item1_count) == TRUE  and doPlayerTakeItem(cid, tabela2[i].item_2, tabela2[i].item1_count) == TRUE  and doPlayerTakeItem(cid, tabela2[i].item_3, tabela2[i].item1_count) == TRUE and doPlayerTakeItem(cid, tabela2[i].item_4, tabela2[i].item1_count)  == TRUE and doPlayerRemoveMoney(cid, 5000) == TRUE then                            
		  doPlayerAddItem(cid, tabela2[i].item2, tabela2[i].item2_count)
          selfSay('Cling Clang', cid)
		  elseif talkState[talkUser] == tabela2[i].talk_jaki and doPlayerTakeItem(cid, tabela2[i].item1, tabela2[i].item1_count) then
	      doPlayerAddItem(cid, tabela2[i].item2, tabela2[i].item2_count)
          selfSay('Cling Clang', cid)
	      elseif getPlayerStorageValue(cid, questStg) >= questStg_nr and talkState[talkUser] == tabela2[i].talk_jaki and doPlayerTakeItem(cid, tabela2[i].item1, tabela2[i].item1_count) == FALSE then
	      selfSay('You haven\'t got enough items for trade.', cid)
		  elseif getPlayerStorageValue(cid, questStg) == 1 and talkState[talkUser] == tabela2[i].talk_jaki then
	      selfSay('Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.', cid)
	      end
	   end
	   if talkState[talkUser] == 9 and getPlayerStorageValue(cid, questStg) == 1 and doPlayerTakeItem(cid, 3983, 3) == TRUE then
	   selfSay('Good good! Woman happy will be. Now me happy too and help you.', cid)
	   setPlayerStorageValue(cid, questStg, 2)
	   elseif talkState[talkUser] == 9 and getPlayerStorageValue(cid, questStg) == 1 and doPlayerTakeItem(cid, 3983, 3) == FALSE then
	   selfSay('You haven\'t got 3 bast skirts :(', cid)
       elseif getPlayerStorageValue(cid, questStg) < 1 and talkState[talkUser] == tabela2[i].talk_jaki then	   
	   selfSay('Wait. Me work no cheap is. Do favour for me first, yes?', cid)
	   talkState[talkUser] = 8
       
	   elseif getPlayerStorageValue(cid, questStg) < 1 and talkState[talkUser] == 8 then
	   selfSay('Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.', cid)
	   setPlayerStorageValue(cid, questStg, 1)
	   setPlayerStorageValue(cid, questLog, 1)
       end
    end
	
end 
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Version 2.0
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
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
 
-- XVX FORGER START --
 
function amulet(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if doPlayerRemoveItem(cid,8262, 1) and doPlayerRemoveItem(cid,8263,1) and doPlayerRemoveItem(cid,8264,1) and doPlayerRemoveItem(cid,8265, 1) and doPlayerRemoveMoney(cid) >= 5000 then
 
doPlayerRemoveItem(cid, 8262, 1) 
doPlayerRemoveItem(cid, 8263, 1) 
doPlayerRemoveItem(cid, 8264, 1)
doPlayerRemoveItem(cid, 8265, 1) 
doPlayerRemoveMoney(cid,5000)
doPlayerAddItem(cid, 8266, 1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have all items or cash!', cid)
    end
end
 
function obsidian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 and getPlayerItemCount(cid,2425) >= 1 then
 
doPlayerRemoveItem(cid, 2516, 1)
doPlayerRemoveItem(cid, 2425, 1)
doPlayerAddItem(cid, 5908, 1)
            selfSay('Here is your item!', cid)
        else
            selfSay('You don\'t have these items!', cid)
    end
end	
 
function crude(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2393) >= 1 then
 
doPlayerRemoveItem(cid,2393,1)
            doPlayerAddItem(cid,5892,1)
            selfSay('Here is your item!', cid)
 
 
        else
            selfSay('You don\'t have these items!', cid)
    end
end
 
function draconian(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2516) >= 1 then
 
doPlayerRemoveItem(cid,2516,1)
            doPlayerAddItem(cid,5889,1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have these items!', cid)
   end   
end
 
 
function royal(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2487) >= 1 then
 
doPlayerRemoveItem(cid,2487,1)
            doPlayerAddItem(cid,5887,1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have these items!', cid)
   end   
end
 
 
function hells(cid, message, keywords, parameters, node)
    if(not npcHandler:isFocused(cid)) then
        return false
    end
        if getPlayerItemCount(cid,2462) >= 1 then
 
doPlayerRemoveItem(cid,2462,1)
            doPlayerAddItem(cid,5888,1)
            selfSay('Here is your item!', cid)
 
        else
            selfSay('You don\'t have these items!', cid)
   end 
end 
-- XVX FORGER END --
 
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can forge Amulet, Obsidian Knife, Huge Chunk of Crude Iron and Piece of Draconian Steel!"})
 
local node1 = keywordHandler:addKeyword({'amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hum Humm! Welcume lil. Me can do unbroken but Big Ben want gold 5000 and Big Ben need a lil time to make it unbroken. Yes or no??'})
    node1:addChildKeyword({'yes'}, amulet, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node2 = keywordHandler:addKeyword({'knife'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield and an Obsidian Lance for a Obsidian Knife?'})
    node2:addChildKeyword({'yes'}, obsidian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node3 = keywordHandler:addKeyword({'uth\'prta'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Giant Sword for a Huge Chunk of Crude Iron?'})
    node3:addChildKeyword({'yes'}, crude, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node4 = keywordHandler:addKeyword({'uth\'lokr'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Dragon Shield for a Piece of Draconian Steel?'})
    node4:addChildKeyword({'yes'}, draconian, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node5 = keywordHandler:addKeyword({'uth\'kean'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Crown Armor for a Piece of Royal Steel?'})
    node5:addChildKeyword({'yes'}, royal, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
local node6 = keywordHandler:addKeyword({'za\'ralator'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Devil Helmet for a Piece of Hell Steel?'})
    node6:addChildKeyword({'yes'}, hells, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
 
npcHandler:addModule(FocusModule:new())
 
if doPlayerRemoveItem(cid,8262, 1) and doPlayerRemoveItem(cid,8263,1) and doPlayerRemoveItem(cid,8264,1) and doPlayerRemoveItem(cid,8265, 1)
if you have one or more items, but not all, you'll still lose them.
and doPlayerRemoveMoney(cid) >= 5000 then
this is completely wrong
doPlayerRemoveItem(cid, 8262, 1)
doPlayerRemoveItem(cid, 8263, 1)
doPlayerRemoveItem(cid, 8264, 1)
doPlayerRemoveItem(cid, 8265, 1)
doPlayerRemoveMoney(cid,5000)
if you have 2 of each items or 10k, you'll lose them too
 
Okey:

Code:
 -- A Sweaty Cyclops [100% real version] --
      -- ~~~~~~~~ By Seminari ~~~~~~ --
      --          //// | \\\\        --
      --         / __     __ \       --
      --         |[*]  |[*]|       --
      --         |     ^     |       --
      --          \ \_____/ /        --
      --           --\___/--         --
      --           \______/          --
      -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~ --


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
--returns how many msgs he have said already
function cancelNPCTalk(events)
  local ret=1
  for aux=1,table.getn(events) do
     if events[aux].done==FALSE then
        stopEvent(events[aux].event)
     else
        ret=ret+1
     end
  end
  events=nil
  return(ret)
end
 
function doCreatureSayWithDelay(cid,text,type,delay,e)
   if delay<=0 then
      doCreatureSay(cid,text,type)
   else
      local func=function(pars)
                    doCreatureSay(pars.cid,pars.text,pars.type)
                    pars.e.done=TRUE
                 end
      e.done=FALSE
      e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e})
   end
end
 
function doNPCTalkALot(msgs,interval)
  local e={}
  local ret={}
  if interval==nil then interval=3000 end --3 seconds is default time between messages
  for aux=1,table.getn(msgs) do
      e[aux]={}
      doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux])
      table.insert(ret,e[aux])
  end
  return(ret)
end
--end shit :P
 
 
 
 
 
function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
        return false
    end      
-- zmienne lokalne
   local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local namee = getPlayerName(cid)
local tabelka = {
                [1] = {question = 'job', answer = 'I am smith.'},
                [2] = {question = 'smith', answer = 'Working steel is my profession.'},
                [3] = {question = 'steel', answer = 'Manny kinds of. Like {Mesh Kaha Rogh}, {Za\'Kalortith}, {Uth\'Byth}, {Uth\'Morc}, {Uth\'Amon}, {Uth\'Maer}, {Uth\'Doon}, and {Zatragil}.'},
                [4] = {question = 'zatragil', answer = 'Most ancients use dream silver for different stuff. Now ancients most gone. Most not know about.'},
                [5] = {question = 'uth\'doon', answer = 'It\'s high steel called. Only lil\' lil\' ones know how make.'},
                [6] = {question = 'za\'kalortith', answer = 'It\'s evil. Demon iron is. No good cyclops goes where you can find and need evil flame to melt.'},
                [7] = {question = 'mesh kaha rogh', answer = 'Steel that is singing when forged. No one knows where find today.'},
                [8] = {question = 'ab\'dendriel', answer = 'Me parents live here before town was. Me not care about lil\' ones.'},
                [9] = {question = 'lil\i lil\'', answer = 'Lil\' lil\' ones are so fun. We often chat. '},
                [10] = {question = 'tibia', answer = 'One day I\'ll go and look. '},
                [11] = {question = 'teshial', answer = 'Is one of elven family or such thing. Me not understand lil\' ones and their busisness.'},
                [12] = {question = 'cenath', answer = 'Is one of elven family or such thing. Me not understand lil\' ones and their busisness.'},
                [13] = {question = 'name', answer = 'I called Bencthyclthrtrprr by me people. Lil\' ones me call Big Ben.'},
                [14] = {question = 'god', answer = 'You shut up. Me not want to hear.'},
				-- Wymiana items 1 --
                [15] = {question = 'uth\'lokr', answer = 'Firy steel it is. Need green ones\' breath to melt. Or red even better. Me can make from shield. Lil\' one want to trade?', storage_wym = no, talk_give = yes, talk_jaki = 1},
				[16] = {question = 'uth\'kean', answer = 'Very noble. Shiny. Me like. But breaks so fast. Me can make from shiny armour. Lil\' one want to trade?', talk_give = yes, talk_jaki = 2},
				[17] = {question = 'za\'ralator', answer = 'Hellsteel is. Cursed and evil. Dangerous to work with. Me can make from evil helmet. Lil\' one want to trade?', talk_give = yes, talk_jaki = 3},
				[18] = {question = 'uth\'prta', answer = 'Good iron is. Me friends use it much for fight. Me can make from weapon. Lil\' one want to trade?', talk_give = yes, talk_jaki = 4},
				[18] = {question = 'soul orb', answer = 'Uh. Me can make some nasty lil\' bolt from soul orbs. Lil\' one want to trade all?', talk_give = yes, talk_jaki = 5},
				[19] = {question = 'amulet', answer = 'Hum Humm! Welcume lil. Me can do unbroken but Big Ben want gold 5000 and Big Ben need a lil time to make it unbroken. Yes or no??', talk_give = yes, talk_jaki = 6},
				[20] = {question = 'gear wheel', answer ='Hmmm you want to change your iron ore to gear wheel?', answerZla = 'Only for persons whose start the quest of beregar city..', storage_wym = yes, storage_jaki = 72182, storage_nr = 2, talk_give = yes, talk_jaki = 7},
				[21] = {question = 'bast skirt', answer = 'Lil\' one bring three bast skirts?', talk_give = yes, talk_jaki = 9},
				-- Forge --
				[22] = {question = 'forge', answer = 'Me can forge equipment back to steel. Like {Za\'Ralator}, {Uth\'Kean}, {Uth\'Lokr}, {Uth\'Prta}'},
				-- Wymiana items 2 --
				}
local tabela2 = {
                [1] = {question = 'yes', talk_wym = yes, talk_jaki = 1, item1 = 2516, item2 = 5889, item1_count = 1, item2_count = 1},
				[2] = {question = 'yes', talk_wym = yes, talk_jaki = 2, item1 = 2487, item2 = 5887, item1_count = 1, item2_count = 1},
				[3] = {question = 'yes', talk_wym = yes, talk_jaki = 3, item1 = 2462, item2 = 5888, item1_count = 1, item2_count = 1},
				[4] = {question = 'yes', talk_wym = yes, talk_jaki = 4, item1 = 2393, item2 = 5892, item1_count = 1, item2_count = 1},
				[5] = {question = 'yes', talk_wym = yes, talk_jaki = 5, item1 = 5944, item2 = 6529, item1_count = 1, item2_count = 2},
                [6] = {question = 'yes', talk_wym = yes, talk_jaki = 7, item1 = 5880, item2 = 9690, item1_count = 1, item2_count = 1, storage_wym = yes, storage_jaki = 72182, storage_nr = 2},
				[7] = {question = 'yes', talk_wym = yes, talk_jaki = 6, item_wiele = yes, item_1 = 8262, item_2 = 8263, item_3 = 8264, item_4 = 8265, item2 = 8266, item1_count = 1, item2_count = 1},
				}
			local questStg = 8239
			local questStg_nr = 2
			local questLog = 98203
for i=1, #tabelka do
    if msgcontains(msg, tabelka[i].question) then
          selfSay(tabelka[i].answer, cid)
	    if tabelka[i].talk_give == yes then
		  talkState[talkUser] = tabelka[i].talk_jaki
		end
		
    end
	
end
for i=1, #tabela2 do	
    if msgcontains(msg, tabela2[i].question) then
	   if getPlayerStorageValue(cid, questStg) >= questStg_nr then
	   
	   
	      if talkState[talkUser] == tabela2[i].talk_jaki and 
tabela2[i].item_wiele == yes and 

getPlayerItemCount(cid, tabela2[i].item_1, tabela2[i].item1_count) >= 1 and 
getPlayerItemCount(cid, tabela2[i].item_2, tabela2[i].item1_count) >= 1 and 
getPlayerItemCount(cid, tabela2[i].item_3, tabela2[i].item1_count) >= 1 and 
getPlayerItemCount(cid, tabela2[i].item_4, tabela2[i].item1_count) >= 1 and 
getPlayerMoney(cid) >= 5000 then

          if doPlayerTakeItem(cid, tabela2[i].item_1, tabela2[i].item1_count) == TRUE  and doPlayerTakeItem(cid, tabela2[i].item_2, tabela2[i].item1_count) == TRUE  and doPlayerTakeItem(cid, tabela2[i].item_3, tabela2[i].item1_count) == TRUE and doPlayerTakeItem(cid, tabela2[i].item_4, tabela2[i].item1_count)  == TRUE and doPlayerRemoveMoney(cid, 5000) == TRUE then                            
		  doPlayerAddItem(cid, tabela2[i].item2, tabela2[i].item2_count)
          selfSay('Cling Clang', cid)
		  end
		  elseif talkState[talkUser] == tabela2[i].talk_jaki and doPlayerTakeItem(cid, tabela2[i].item1, tabela2[i].item1_count) then
	      doPlayerAddItem(cid, tabela2[i].item2, tabela2[i].item2_count)
          selfSay('Cling Clang', cid)
	      elseif getPlayerStorageValue(cid, questStg) >= questStg_nr and talkState[talkUser] == tabela2[i].talk_jaki and doPlayerTakeItem(cid, tabela2[i].item1, tabela2[i].item1_count) == FALSE then
	      selfSay('You haven\'t got enough items for trade.', cid)
		  elseif getPlayerStorageValue(cid, questStg) == 1 and talkState[talkUser] == tabela2[i].talk_jaki then
	      selfSay('Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.', cid)
	      end
	   end
	   if talkState[talkUser] == 9 and getPlayerStorageValue(cid, questStg) == 1 and doPlayerTakeItem(cid, 3983, 3) == TRUE then
	   selfSay('Good good! Woman happy will be. Now me happy too and help you.', cid)
	   setPlayerStorageValue(cid, questStg, 2)
	   elseif talkState[talkUser] == 9 and getPlayerStorageValue(cid, questStg) == 1 and doPlayerTakeItem(cid, 3983, 3) == FALSE then
	   selfSay('You haven\'t got 3 bast skirts :(', cid)
       elseif getPlayerStorageValue(cid, questStg) < 1 and talkState[talkUser] == tabela2[i].talk_jaki then	   
	   selfSay('Wait. Me work no cheap is. Do favour for me first, yes?', cid)
	   talkState[talkUser] = 8
       
	   elseif getPlayerStorageValue(cid, questStg) < 1 and talkState[talkUser] == 8 then
	   selfSay('Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.', cid)
	   setPlayerStorageValue(cid, questStg, 1)
	   setPlayerStorageValue(cid, questLog, 1)
       end
    end
	
end 
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top