Postado Abril 23, 2013 12 anos Olá Turma estou criando meu server e gostaria de por uma quest onde existisse um NPC, ao falar mission, o npc mandaria você pegar 10 "shards" ao retornar a ele com os 10 shards em mão. ele pegaria o seus Shards. E iria liberar uma storage, para que você pudesse passar por uma porta.. Ou seja você só teria acesso para passar por tal porta apos entregar os 10 shards ao NPC... Obrigado. Espero Ajudas. Meus Trabalhos: *Spell Rajada de Flechas: http://migre.me/eI3aE
Postado Abril 23, 2013 12 anos Este é um post popular. Vamos começar pelo NPC. Crie um arquivo chamado npcquest.lua na pasta data/npc/scripts e cole isso 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 local itemId = 7290 local countItem = 10 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'mission') then if getPlayerStorageValue(cid, 30003) == -1 then npcHandler:say('Good, I need you to pick up some '.. getItemNameById(itemId) ..' for me, to be more exact I need '.. countItem ..', you think you can do this task?', cid) talkState[talkUser] = 1 else npcHandler:say('Have you done this task for me, skirt here and of chance to another.', cid) end elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then npcHandler:say('Excellent! Collect '.. countItem ..' '.. getItemNameById(itemId) ..' and come back talking about {'.. getItemNameById(itemId) ..'}.', cid) talkState[talkUser] = 2 setPlayerStorageValue(cid, 30003, 1) elseif talkState[talkUser] == 2 then if msgcontains(msg, 'shard') then if getPlayerStorageValue(cid, 30003) == 1 then if getPlayerItemCount(cid, itemId) == countItem then doPlayerRemoveItem (cid, itemId, countItem) setPlayerStorageValue(cid, 30003, 2) talkState[talkUser] = 0 npcHandler:say('Thank you! Now you have permission to pass the door.', cid) else npcHandler:say('You did not collected the items I asked, refreshing your memory, I asked to collect '.. countItem ..' '.. getItemNameById(itemId) ..'.', cid) end else npcHandler:say('Not asked you nothing.', cid) end else npcHandler:say('So GET OUT IMMEDIATELY.', cid) end end end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Crie um arquivo chamado Npc Quest.xml na pasta data/npc e cole isso dentro <?xml version="1.0" encoding="UTF-8"?> <npc name="Nome Npc" script="data/npc/scripts/npcquest.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="128" head="97" body="100" legs="115" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Hello, |PLAYERNAME|! Would like to do a {mission} for me?"/> <parameter key="message_walkaway" value="Hey Hey, where you go?"/> <parameter key="message_farewell" value="Goodbye |PLAYERNAME|."/> </parameters> </npc> Configurando <npc name="Nome Npc" script="data/npc/scripts/npcquest.lua" walkinterval="25" floorchange="0" access="5" level="1" maglevel="1"> name="Nome Npc" //Nome do NPC Agora vamos para a porta Actions Crie um arquivo chamado storagedoor.lua na pasta data/action/scripts e cole isso dentro function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, 30003) >= 1 then doTransformItem(item.uid,item.itemid+1) doTeleportThing(cid, topos) else doPlayerSendTextMessage(cid, 22, 'You don\'t have access to area.') end end Adicione a seguinte linha no arquivo actions.xml que esta na pasta data/actions <action actionid="4587" event="script" value="storagedoor.lua" /> Movements Crie um arquivo chamado storagedoor.lua na pasta data/movements/scripts e cole isso function onStepOut(cid, item, position, fromposition) doTransformItem(item.uid,item.itemid-1) end Adicione a seguinte linha no arquivo movements.xml que esta na pasta data/movements <movements type="StepOut" actionid="4587" event="script" value="storagedoor.lua" /> MapEditor No MapEditor coloque a porta com o Action ID 4587 Não testei caso der erro avise. Dúvidas? Me avise. @EDIT Editei o script do NPC pois tinha esquecido de algo. (OBS: Use portas que ela fechada seja um ID antes da aberta, ex: Fechada: 5112 e Aberta: 5113) Att. Giovani Rodrigo Editado Abril 24, 2013 12 anos por GiovaniRodrigo (veja o histórico de edições) Spoiler local config = { delrey = getPlayerCarValue(cid, DELREY), cigarro = getPlayerCancer(cid, DERBY), prostituta = getPlayerAIDS(cid, cracuda), tresOitao = getPlayerRevorvi(cid, 38) } if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS") end
Postado Abril 23, 2013 12 anos Parabéns Giovani, como não estou em casa fico agradecido de disponibilizar para ele esta Script. Já que no momento não estou com ela em meu PC pois não estou com ele agr ! rsrs' Ganhou meu Rep+ Editado Abril 23, 2013 12 anos por principe sharingan (veja o histórico de edições)
Postado Abril 23, 2013 12 anos Obrigado, fico feliz em ajudar o pessoal daqui do fórum. Att. Giovani Rodrigo Spoiler local config = { delrey = getPlayerCarValue(cid, DELREY), cigarro = getPlayerCancer(cid, DERBY), prostituta = getPlayerAIDS(cid, cracuda), tresOitao = getPlayerRevorvi(cid, 38) } if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS") end
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.