Ir para conteúdo

[Npc] A Sweaty Cyclops


kwovan

Posts Recomendados

Em data/npc crie um arquivo chamado A Sweaty Cyclops.xml:

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="A Sweaty Cyclops" script="data/npc/scripts/A Sweaty Cyclops.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="22" head="0" body="0" legs="0" feet="0" addons="0"/>
<parameters>
       <parameter key="message_greet" value="Hum Humm! Welcume lil' Player.."/>
       <parameter key="message_farewell" value="Good bye lil' one."/>
   </parameters>
</npc>

 

Em data/npc/scripts crie um arquivo chamado A Sweaty Cyclops.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 





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},
			}
		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 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)
      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())

 

Em data/xml/quests.xml adicione isto:

 

<quests>
   <quest name="Friends and Traders" startstorageid="98203" startstoragevalue="0">
    <mission name="The Sweaty Cyclops" storageid="8239" startvalue="0" endvalue="2">
	   <missionstate id="1" description="Bring to Sweaty Cyclops 3 bast skirts, for his girlfriend."/>
	   <missionstate id="2" description="Big Ben, the cyclops in Ab'Dendriel will help you to forge different steel now. Just ask him if you need something."/>
	</mission>
   </quest>
</quests>

 

Créditos: Seminari

Link para o comentário
Compartilhar em outros sites

  • 3 months later...
×
×
  • Criar Novo...