Pesquisar na Comunidade
Mostrando resultados para as tags ''citizen''.
Encontrado 1 registro
-
Bem, via muita gente procurando por esse NPC na seção de Pedidos, então resolvi criá-lo. O Npc está igual ao global, salvo algumas falas. Assim que o player entregar os 100 minotaur leathers, deverá esperar 2 horas (configurável) para retornar ao npc. Diálogo (igual ao global): 1. Conhecendo a quest do addon. Jogador: Hi Lubo: Welcome to my adventurer shop, <name>! What do you need? Jogador: Addon Lubo: Sorry, the backpack I wear is not for sale. It's handmade from rare minotaur leather. Jogador: Minotaur Leather Lubo: Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this? Jogador: Yes Lubo: Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck! 2. Entregando os minotaur leathers Jogador: Hi Lubo: Welcome to my adventurer shop, <name>! What do you need? Jogador: Backpack Lubo: Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested? Jogador: yes Lubo: Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay? [2 Horas Depois] 3. Pegando o addon da backpack Jogador: Hi Lubo: Welcome to my adventurer shop, <name>! What do you need? Jogador: Addon Lubo: Just in time! Your backpack is finished. Here you go, I hope you like it. Jogador: Bye Lubo: Good bye. ___ Agora vamos ao script: Em data/npcs/scripts crie um arquivo.lua chamado citizen.lua e cole isto dentro: 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 time = 2 -- tempo em horas if msgcontains(msg, 'addon') then if getPlayerStorageValue(cid, 3422) <= 0 then if getPlayerStorageValue(cid, 3491) <= 0 then selfSay('Sorry, the backpack I wear is not for sale. It is handmade from rare {minotaur leather}.', cid) talkState[talkUser] = 0 else if getPlayerStorageValue(cid, 2411) - os.time() <= 0 then if getPlayerSex(cid) == 0 then doPlayerAddOutfit(cid, 136, 1) setPlayerStorageValue(cid, 3422, 1) selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.', cid) else doPlayerAddOutfit(cid, 128, 1) setPlayerStorageValue(cid, 3422, 1) selfSay('Just in time! Your backpack is finished. Here you go, I hope you like it.', cid) end else selfSay('This job requires patient and hability. Wait a little time.', cid) end end else selfSay('You have already taken your backpack.', cid) end elseif msgcontains(msg, 'minotaur leather') then selfSay('Well, if you really like this backpack, I could make one for you, but minotaur leather is hard to come by these days. Are you willing to put some work into this?', cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 and msgcontains(msg, 'yes') then selfSay('Alright then, if you bring me 100 pieces of fine minotaur leather I will see what I can do for you. You probably have to kill really many minotaurs though... so good luck!', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 and msgcontains(msg, 'backpack') then selfSay('Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?', cid) talkState[talkUser] = 3 elseif talkState[talkUser] == 3 and msgcontains(msg, 'yes') then if doPlayerRemoveItem(cid, 5878, 100) then setPlayerStorageValue(cid, 3491, 1) setPlayerStorageValue(cid, 2411, os.time()+time*60*60) selfSay('Great! Alright, I need a while to finish this backpack for you. Come ask me later, okay?', cid) talkState[talkUser] = 4 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Em data/npcs crie um arquivo.xml chamado Lubo.xml e cole isto dentro: <?xml version="1.0" encoding="UTF-8"?> <npc name="Lubo" script="data/npc/scripts/citizen.lua" walkinterval="5000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="38" body="39" legs="96" feet="118" addons="3"/> <parameters> <parameter key="message_greet" value="Welcome to my adventurer shop, |PLAYERNAME|! What do you need?"/> <parameter key="message_farewell" value="Good bye."/> <parameter key="module_keywords" value="1" /> </parameters> </npc> Vlw, espero ter ajudado alguém, abraços.