Postado Agosto 8, 2016 8 anos Ola a todos, gostaria de fazer um pedido de um npc de promotion 1 pouco diferente... É um npc, onde o player escolheria entre 2 vocaçoes... Arkond id=5 vai para Elementalist ID=9 ou Lifebringuer ID=10 Precized id=6 vai para assassin ID=11 ou Sharpshooter ID=12 Worker id=7 vai para warmaster ID=13 ou forjemaster ID=14 Soldier ID=8 vai para Beserker ID=15 ou guardian ID=16 a storage, pode ser algo entre 33767 e 33770 , funcionaria assim, o player ja tem a primeira promotion(arkond,precised,worker,soldier) que deriva da (magican,archer,minner,warrior) nao precisa colocar essa primeira promo, ela pega no npc normal... o player com a promo1, fala com o npc e se for lv 75+ (e se possivel se ele tiver o item 12414, se nao tiver como colocar para precisar do item, nao tem problema. a promotion, custaria 300k, (e o item se possivel) alem do lv75.. acredito que seja isso. Se alguem conseguir fazer para min, ficaria muiito grato!! xD repp++
Postado Agosto 9, 2016 8 anos Solução Spoiler NPC.lua local tab = { item = {12414, 1}, -- {itemID, count} price = 3 -- preco } 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 if (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 5 ) then talkState[talkUser] = 1 selfSay('Qual vocation voce escolhe, Lifebringuer ou Elementalist?', cid) elseif (msgcontains(msg, 'Lifebringuer') and talkState[talkUser] == 1) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 9) selfSay('Parabens, agora voce e um Lifebringuer!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Elementalist') and talkState[talkUser] == 1) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 10) selfSay('Parabens, agora voce e um Elementalist!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 6 ) then talkState[talkUser] = 2 selfSay('Qual vocation voce escolhe, Assassin ou Sharpshooter?', cid) elseif (msgcontains(msg, 'Sharpshooter') and talkState[talkUser] == 2) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 11) selfSay('Parabens, agora voce e um Sharpshooter!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Assassin') and talkState[talkUser] == 2) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 12) selfSay('Parabens, agora voce e um Assassin!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 7 ) then talkState[talkUser] = 3 selfSay('Qual vocation voce escolhe, Warmaster ou Forjemaster?', cid) elseif (msgcontains(msg, 'Warmaster') and talkState[talkUser] == 3) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 13) selfSay('Parabens, agora voce e um Warmaster!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Forjemaster') and talkState[talkUser] == 3) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 14) selfSay('Parabens, agora voce e um Forjemaster!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 8 ) then talkState[talkUser] = 4 selfSay('Qual vocation voce escolhe, Beserker ou Guardian?', cid) elseif (msgcontains(msg, 'Beserker') and talkState[talkUser] == 4) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 15) selfSay('Parabens, agora voce e um Beserker!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Guardian') and talkState[talkUser] == 4) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 16) selfSay('Parabens, agora voce e um Guardian!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) > 8 ) then selfSay('Voce ja comprou sua promote!', cid) elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) < 5 ) then selfSay('Voce precisa comprar a primeira promotion primeiro!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Spoiler NPC.XML <npc name="Alpha Set" script="data/npc/scripts/NPC.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="54" head="45" body="67" legs="79" feet="10" addons="1"/> <parameters> <parameter key="message_greet" value="Ola, |PLAYERNAME|. Se voce ja tiver a primeira promotion dia {promotion} para adquirir a proxima!" /> </parameters> </npc> Editado Agosto 9, 2016 8 anos por Kemmlly (veja o histórico de edições)
Postado Agosto 10, 2016 8 anos Autor 100% !! obrigado Em 09/08/2016 ás 11:19, Kemmlly disse: Mostrar conteúdo oculto NPC.lua local tab = { item = {12414, 1}, -- {itemID, count} price = 3 -- preco } 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 if (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 5 ) then talkState[talkUser] = 1 selfSay('Qual vocation voce escolhe, Lifebringuer ou Elementalist?', cid) elseif (msgcontains(msg, 'Lifebringuer') and talkState[talkUser] == 1) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 9) selfSay('Parabens, agora voce e um Lifebringuer!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Elementalist') and talkState[talkUser] == 1) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 10) selfSay('Parabens, agora voce e um Elementalist!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 6 ) then talkState[talkUser] = 2 selfSay('Qual vocation voce escolhe, Assassin ou Sharpshooter?', cid) elseif (msgcontains(msg, 'Sharpshooter') and talkState[talkUser] == 2) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 11) selfSay('Parabens, agora voce e um Sharpshooter!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Assassin') and talkState[talkUser] == 2) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 12) selfSay('Parabens, agora voce e um Assassin!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 7 ) then talkState[talkUser] = 3 selfSay('Qual vocation voce escolhe, Warmaster ou Forjemaster?', cid) elseif (msgcontains(msg, 'Warmaster') and talkState[talkUser] == 3) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 13) selfSay('Parabens, agora voce e um Warmaster!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Forjemaster') and talkState[talkUser] == 3) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 14) selfSay('Parabens, agora voce e um Forjemaster!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) == 8 ) then talkState[talkUser] = 4 selfSay('Qual vocation voce escolhe, Beserker ou Guardian?', cid) elseif (msgcontains(msg, 'Beserker') and talkState[talkUser] == 4) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 15) selfSay('Parabens, agora voce e um Beserker!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'Guardian') and talkState[talkUser] == 4) then if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 100000)) then doPlayerRemoveItem(cid, tab.item[1], tab.item[2]) doPlayerSetVocation(cid, 16) selfSay('Parabens, agora voce e um Guardian!', cid) else talkState[talkUser] = 0 selfSay('Perdao, mas voce nao tem o item necessario ou dinheiro suficiente.', cid) end elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) > 8 ) then selfSay('Voce ja comprou sua promote!', cid) elseif (msgcontains(msg, 'promotion') and getPlayerVocation(cid) < 5 ) then selfSay('Voce precisa comprar a primeira promotion primeiro!', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Mostrar conteúdo oculto NPC.XML <npc name="Alpha Set" script="data/npc/scripts/NPC.lua" access="5" lookdir="1"> <health now="1000" max="1000"/> <look type="54" head="45" body="67" legs="79" feet="10" addons="1"/> <parameters> <parameter key="message_greet" value="Ola, |PLAYERNAME|. Se voce ja tiver a primeira promotion dia {promotion} para adquirir a proxima!" /> </parameters> </npc> para dizer a verdade, nao funcionou nao.. quando o player loga, ele perde essa promotion e volta para a segunda =x
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.