Postado Fevereiro 5, 2015 10 anos Autor Solução O problema é que a vocação volta ao relogar, certo? Irei adaptar o script com uma storage, assim ao relogar o player que tiver a storage, ganha a voc supreme... Tudo bem? não manim esse script que tu me passou não ta conseguindo compra a vocação!! qual tfs tu testou? o meu é 0.4 DEV se o teu for o mesmo tem alguma coisa errada pois aqui só ta dando "você não tem supreme vocations suficientes" mais mesmo assim o npc consome o item e não da a vocação!! Se Ajudei Clique no ao Lado, Não Custa nada !!
Postado Fevereiro 5, 2015 10 anos Testei no TFS 0.3.7, mas o seu "antigo" funciona certo? Porem ao relogar, ele some a vocação? Irei modificar para nao sumir. EDIT: substitua seu vocationsupreme.lua por esse 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, 'voc suprem') or msgcontains(msg, 'voc suprem')) then selfSay('Deseja virar {Voc suprem} ?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, 142) >= 1) then doPlayerRemoveItem(cid, 142, 1) doPlayerSetVocation(cid, getPlayerVocation(cid) > 4 and getPlayerVocation(cid) + 4 or getPlayerVocation(cid) + 8) setPlayerStorageValue(cid, 35125, 1) -- Storage que vai checar se tem a 3° promotion ou nao. selfSay('Parabéns você acaba de completar Asgard.', cid) else selfSay('Você não tem {suprem vocation} suficientes.', cid) end talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) e depois vá em creaturescript/script e crie um arquivo chamado promote.lua e coloque isso dentro function onLogin(cid) if getPlayerStorageValue(cid,35125) >= 1 then if(isInArray({5, 6, 7, 8}, getPlayerVocation(cid))) then doPlayerSetVocation(cid, getPlayerVocation(cid) + 4) end end return TRUE end e em login.lua adicione isso registerCreatureEvent(cid, "Promotion") e em creatures.xml adicione. <event type="login" name="Promotion" event="script" value="promote.lua"/> Editado Fevereiro 5, 2015 10 anos por joadson (veja o histórico de edições) Te ajudei? Se você achar que eu mereço, me dê uma "rep+" e selecione meu post como "melhor resposta" Skype: JoadsonAion
Postado Fevereiro 5, 2015 10 anos Autor aeee manim agora foi 100% muito obrigado mesmo reputado ae pela força ! Editado Fevereiro 5, 2015 10 anos por hempz (veja o histórico de edições) Se Ajudei Clique no ao Lado, Não Custa nada !!
Postado Fevereiro 5, 2015 10 anos local vocations = {5, 6, 7, 8} -- Não modifique... local stg = 98749 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:lower(), 'voc suprem') then selfSay('Deseja virar {Voc suprem} ?', cid) talkState[talkUser] = 1 elseif msgcontains(msg:lower(), 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, stg) < 1 then if isInArray(vocations, getPlayerVocation(cid)) > 4 then if getPlayerItemCount(cid, 142) >= 1 then doPlayerRemoveItem(cid, 142, 1) doPlayerSetVocation(cid, getPlayerVocation(cid) + 4) selfSay('Parabéns você acaba de completar Asgard.', cid) setPlayerStorageValue(cid, stg, 1) talkState[talkUser] = 0 else selfSay('Você não tem {suprem vocation} suficientes.', cid) talkState[talkUser] = 0 end else selfSay('Você não tem a primeira promotion', cid) talkState[talkUser] = 0 end else selfSay('Você já tem vocation suprema', cid) talkState[talkUser] = 0 end elseif msgcontains(msg:lower(), 'no') or msgcontains(msg:lower(), 'bye') then selfSay('Bye!', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Fevereiro 5, 2015 10 anos por fywell (veja o histórico de edições)
Postado Fevereiro 5, 2015 10 anos Autor local vocations = {5, 6, 7, 8} -- Não modifique... local stg = 98749 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:lower(), 'voc suprem') then selfSay('Deseja virar {Voc suprem} ?', cid) talkState[talkUser] = 1 elseif msgcontains(msg:lower(), 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, stg) < 1 then if isInArray(vocations, getPlayerVocation(cid)) > 4 then if getPlayerItemCount(cid, 142) >= 1 then doPlayerRemoveItem(cid, 142, 1) doPlayerSetVocation(cid, getPlayerVocation(cid) + 4) selfSay('Parabéns você acaba de completar Asgard.', cid) setPlayerStorageValue(cid, stg, 1) talkState[talkUser] = 0 else selfSay('Você não tem {suprem vocation} suficientes.', cid) talkState[talkUser] = 0 end else selfSay('Você não tem a primeira promotion', cid) talkState[talkUser] = 0 end else selfSay('Você já tem vocation suprema', cid) talkState[talkUser] = 0 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) local vocations = {5, 6, 7, 8} -- Não modifique... local stg = 98749 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:lower(), 'voc suprem') then selfSay('Deseja virar {Voc suprem} ?', cid) talkState[talkUser] = 1 elseif msgcontains(msg:lower(), 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, stg) < 1 then if isInArray(vocations, getPlayerVocation(cid)) > 4 then if getPlayerItemCount(cid, 142) >= 1 then doPlayerRemoveItem(cid, 142, 1) doPlayerSetVocation(cid, getPlayerVocation(cid) + 4) selfSay('Parabéns você acaba de completar Asgard.', cid) setPlayerStorageValue(cid, stg, 1) talkState[talkUser] = 0 else selfSay('Você não tem {suprem vocation} suficientes.', cid) talkState[talkUser] = 0 end else selfSay('Você não tem a primeira promotion', cid) talkState[talkUser] = 0 end else selfSay('Você já tem vocation suprema', cid) talkState[talkUser] = 0 end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ja deu certo aqui mano obrigado ai mais ja resolvi com a ajuda do joadson!! Se Ajudei Clique no ao Lado, Não Custa nada !!
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.