Postado Julho 28, 2019 5 anos olá, eu precisava que o npc ao saber que o player tem o storage ele fale ao jogador que ele ja possui o outfit, evitando q a pessoa faça mais de 1x local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 outfit(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if getPlayerItemCount(cid,5922) >= 50 and getPlayerItemCount(cid,2492) == 1 and getPlayerItemCount(cid,2488) == 1 and getPlayerItemCount(cid,2536) == 1 and getPlayerItemCount(cid,2123) == 1 then doPlayerRemoveItem(cid,5922,50) doPlayerRemoveItem(cid,2492,1) doPlayerRemoveItem(cid,2488,1) doPlayerRemoveItem(cid,2536,1) doPlayerRemoveItem(cid,2123,1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) npcHandler:say('Get your outfit!', cid) setPlayerStorageValue(cid, 65535, 1) else npcHandler:say('Sorry, you dont have itens!', cid) end end local node1 = keywordHandler:addKeyword({'outfit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I need the items, {50 holy orchids, ring of the sky, crown legs, dragon scale mail and medusa shield}. Do you have?.'}) node1:addChildKeyword({'yes'}, outfit, {npcHandler = npcHandler, onlyFocus = true, reset = true}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Stop being rude!!!', reset = true}) npcHandler:addModule(FocusModule:new())
Postado Julho 28, 2019 5 anos local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) 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 items_needed = {{5922,50},{2492,1},{2488,1},{2536,1},{2123,1}} local outfit_storage = 65535 function outfit(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if getPlayerStorageValue(cid, outfit_storage) ~= -1 then npcHandler:say('You have already received this outfit.', cid) else local total_count, check = #items_needed, true for i = 1, total_count do local itemId, itemCount = items_needed[i][1], items_needed[i][2] if getPlayerItemCount(cid, itemId) < itemCount then check = false break end end if not check then npcHandler:say('You do not have all the items I need to make this outfit.', cid) else for i = 1, total_count do local itemId, itemCount = items_needed[i][1], items_needed[i][2] doPlayerRemoveItem(cid, itemId, itemCount) end doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) setPlayerStorageValue(cid, outfit_storage, 1) end end end local node1 = keywordHandler:addKeyword({'outfit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I need the items, {50 holy orchids, ring of the sky, crown legs, dragon scale mail and medusa shield}. Do you have?.'}) node1:addChildKeyword({'yes'}, outfit, {npcHandler = npcHandler, onlyFocus = true, reset = true}) node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Stop being rude!!!', reset = true}) npcHandler:addModule(FocusModule:new()) Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Julho 28, 2019 5 anos Autor @Dwarfer moço tu tem um fã vlw manim, porém nao está puxando os itens xD npc ta dando d graça hehe @Dwarfer eu tentei por algo como verificar o storage tal e falar tal coisa após o else do meu script mas n deu certo. function outfit(cid, message, keywords, parameters, node) if(not npcHandler:isFocused(cid)) then return false end if getPlayerItemCount(cid,5922) >= 50 and getPlayerItemCount(cid,2492) == 1 and getPlayerItemCount(cid,2488) == 1 and getPlayerItemCount(cid,2536) == 1 and getPlayerItemCount(cid,2123) == 1 then doPlayerRemoveItem(cid,5922,50) doPlayerRemoveItem(cid,2492,1) doPlayerRemoveItem(cid,2488,1) doPlayerRemoveItem(cid,2536,1) doPlayerRemoveItem(cid,2123,1) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN) npcHandler:say('Get your outfit!', cid) setPlayerStorageValue(cid, 65535, 1) else npcHandler:say('Sorry, you dont have itens!', cid) end end Editado Julho 28, 2019 5 anos por bpm91 (veja o histórico de edições)
Postado Julho 28, 2019 5 anos Solução 5 horas atrás, bpm91 disse: @Dwarfer moço tu tem um fã vlw manim, porém nao está puxando os itens xD npc ta dando d graça hehe verdade, acabei esquecendo de copiar as linhas de remover. Já editei lá. Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Julho 28, 2019 5 anos Autor @Dwarfer deu certo agora, muito obrigado, vc poderia me explicar porq ele pede o item [1] e o [2]? só pra entender msm a leitura do script no caso seria [1] o id item e [2] a quantidade? local itemId, itemCount = items_needed[1], items_needed[2]
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.