• 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!

Editing Npc.

Lucenzo

The Way You Move :)
Joined
Jan 29, 2011
Messages
363
Reaction score
14
Location
UK
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
--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},
                                [19] = {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},
                                [20] = {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},
                                [21] = {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},
                                [22] = {wypowiedz = 'bast skirt', odpowiedz = 'Lil\' one bring three bast skirts?', talk_give = yes, talk_jaki = 9},
                                -- Forge --
                                [23] = {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 talkState[talkUser] == 9 and getPlayerStorageValue(cid, questStg) < 1 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] == 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())


If someone could remove that you don't need storage for Koshei's ancient Amulet.
I still want to keep the missions for other items but not for the amulet.


Thanks in Advance x x
 
Last edited:
Well thank you for that information.
I like it, once i learn lua properly and be a "pro" like you i'll stop asking for help and solve my own problems, but untill then :P
 
Back
Top