Postado Setembro 12, 2017 7 anos Fala galera! Eu estou com um script aqui, mas ele não está completo... Gostaria que dps de ganhar a promote, ele voltar ao level 8 e voltar para o templo alguem ajuda? Spoiler 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 local price = 50000 local vocations = {5,6,7,8} if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then selfSay('Você quer virar valan por '..price..' gps? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if isInArray(vocations, getPlayerVocation(cid)) then if doPlayerRemoveMoney(cid,price) == TRUE then setPlayerPromotionLevel(cid, 2) selfSay('Parabens,você foi promovido para a Semi Deus!', cid) talkState[talkUser] = 0 else selfSay('Você não tem ' .. price .. ' gps para virar valan', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, mas voce nao e promote.', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) @Dwarfer @KotZletY @up
Postado Setembro 12, 2017 7 anos @Yamborghini Spoiler 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 c = { price = 50000, vocations = {1,6,7,8}, newlevel = 5, -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido. pos = {x=1026, y=920, z=7}, -- Pos do templo tmp = 3 -- apos esses segundos ele desloga automaticamente. } function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local playerid = getPlayerGUID(cid) local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local xp = getExperienceForLevel(c.newlevel) if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then selfSay('Você quer virar valan por '..c.price..' gps? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if isInArray(c.vocations, getPlayerVocation(cid)) then if doPlayerRemoveMoney(cid,c.price) == TRUE then db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") doPlayerSetPromotionLevel(cid, 2) doTeleportThing(cid, c.pos) doRemoveCreature(cid) db.query("UPDATE `players` SET `level`="..c.newlevel..",`experience`="..xp.." WHERE `players`.`id`= ".. playerid .."") talkState[talkUser] = 0 else selfSay('Você não tem ' .. c.price .. ' gps para virar valan', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, mas voce nao e promote.', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Setembro 12, 2017 7 anos Autor 31 minutos atrás, KotZletY disse: @Yamborghini Ocultar conteúdo 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 local price = 50000 local vocations = {5,6,7,8} local newlevel = 1 -- novo level, deixe 1, afinal o exp novo é 0, caso contrário vai ter que colocar o exp exato do level escolhido. local playerid = getPlayerGUID(cid) local pos = {x=000, y=000, z=0} -- Pos do templo if(msgcontains(msg, 'valan') or msgcontains(msg, 'semi deus')) then selfSay('Você quer virar valan por '..price..' gps? {yes} ', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if isInArray(vocations, getPlayerVocation(cid)) then if doPlayerRemoveMoney(cid,price) == TRUE then setPlayerPromotionLevel(cid, 2) db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."") doTeleportThing(cid, pos) selfSay('Parabens,você foi promovido para a Semi Deus!', cid) talkState[talkUser] = 0 else selfSay('Você não tem ' .. price .. ' gps para virar valan', cid) talkState[talkUser] = 0 end else selfSay('Desculpe, mas voce nao e promote.', cid) talkState[talkUser] = 0 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Mas assim o player ao matar qualquer monstro, vai do level 1 ao level que fez a promote (no caso 200)
Postado Setembro 12, 2017 7 anos 4 horas atrás, Yamborghini disse: ele voltar ao level 8 Atualizei o script acima, agora bote o level que desejar.
Postado Setembro 12, 2017 7 anos Autor 12 minutos atrás, KotZletY disse: Atualizei o script acima, agora bote o level que desejar. não funcionou o player não foi teleportado e nem mudou de nivel, porém, o promote deu certo EDIT: deu o seguinte erro> Spoiler [19:31:53.568] [Error - NpcScript Interface] [19:31:53.568] data/npc/scripts/Zeus.lua:onCreatureSay [19:31:53.584] Description: [19:31:53.584] data/npc/scripts/Zeus.lua:31: attempt to call field 'executeQuery' (a nil value) [19:31:53.599] stack traceback: [19:31:53.615] data/npc/scripts/Zeus.lua:31: in function 'callback' [19:31:53.615] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay' [19:31:53.630] data/npc/scripts/Zeus.lua:8: in function <data/npc/scripts/Zeus.lua:8> Editado Setembro 12, 2017 7 anos por Yamborghini (veja o histórico de edições)
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.