Postado Maio 20, 2013 12 anos ae pessoal to querendo uma quest assim por exemplo o NPC vai pedir 3 items ae vc vai pegar , ae apos pegar esses 3 items voce entrega para ele, e ele vai deixar voce passar por uma porta tem como fazer pra mim?
Postado Maio 21, 2013 12 anos ae pessoal to querendo uma quest assim por exemplo o NPC vai pedir 3 items ae vc vai pegar , ae apos pegar esses 3 items voce entrega para ele, e ele vai deixar voce passar por uma porta tem como fazer pra mim? Vamos começar pelo NPC Crie um arquivo chamado Fred.lua na pasta data/npc/scripts e cole isso 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 cfg = { item = {1111, 1112, 1113}, -- ID dos itens count = 1 -- Quantidade dos itens } 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, 'task') then if getPlayerStorageValue(cid, 40000) == -1 then selfSay('I need you to catch {'.. cfg.count ..' '.. getItemNameById(cfg.item[1]) ..', '.. cfg.count ..' '.. getItemNameById(cfg.item[2]) ..' and '.. cfg.count ..' '.. getItemNameById(cfg.item[3]) ..'}, you\'d get?', cid) talkState[talkUser] = 1 else selfSay('You have made this task.', cid) end elseif talkState[talkUser] == 1 then if msgcontains(msg, 'yes') then selfSay('Oh! Thank you, come back here when you catch all the {items}.', cid) talkState[talkUser] = 2 elseif msgcontains(msg, 'no') then selfSay('So, GET OUT HERE!', cid) end elseif talkState[talkUser] == 2 then if msgcontains(msg, 'items') then if doPlayerRemoveItem(cid, cfg.item[1], cfg.count) and doPlayerRemoveItem(cid, cfg.item[2], cfg.count) and doPlayerRemoveItem(cid, cfg.item[3], cfg.count) then selfSay('Good! I see you managed, you now have permission to go through the door.', cid) setPlayerStorageValue(cid, 40000, 1) talkState[talkUser] = 0 else selfSay('You didn\'t picked all the items I ordered.', cid) end end end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Configurando local cfg = { item = {1111, 1112, 1113}, -- ID dos itens count = 1 -- Quantidade dos itens } Está tudo comentado então não existe necessidade de explicar Crie um arquivo chamado Fred.xml na pasta data/npc e cole isso <?xml version="1.0" encoding="UTF-8"?> <npc name="Fred" script="Fred.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="128" head="17" body="54" legs="114" feet="0" addons="2"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|, Could do a {task} for me?"/> </parameters> </npc> Agora vamos criar o script da PORTA Actions Crie um arquivo chamado doorstorage.lua na pasta data/actions/scripts e cole isso function onUse(cid, item, frompos, item2, topos) if getPlayerStorageValue(cid, 40000) >= 1 then doTransformItem(item.uid,item.itemid+1) doTeleportThing(cid,topos) else doPlayerSendTextMessage(cid, 22, 'You don\'t have access') return TRUE end end Movements Adicione a seguinte linha no arquivo actions.xml que se encontra na pasta data/actions <action actionid="6587" event="script" value="doorstorage.lua"/> Crie um arquivo chamado doorstorage.lua na pasta data/movements/scripts function onStepOut(cid, item, position, fromPosition) doTransformItem(item.uid, item.itemid-1) end Adicione a seguinte linha no arquivo movements.xml que se encontra na pasta data/movements <movevent type="StepOut" actionid="6587" event="script" value="doorstorage.lua"/> Não testado. Dúvidas? Me avise. 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.