Postado Outubro 25, 2017 7 anos 3 horas atrás, lucasprimolemos disse: A sim perdão @RobotTurto, então, eu verifiquei inclusive fico mexendo nele para testar os NPC's Quando eu coloco voc 4 e ele vira kina, falo com o npc King Warrior e consigo me promover para berserk ou guardian, mas quando coloco voc 3 de pally e falo com NPC King Archer ou voc 2 de mage e falo com NPC King Wizard não da certo, ele manda a msg "desculpe mas vc está falando com a pessoa errada" que é o ELSEIF quando ele não compreende a voc, ou a voc não é correspondente com a definida no arquivo lua Agora estou no PC vou fazer testes.
Postado Outubro 26, 2017 7 anos Estive com problemas com meus servidores não consegui fazer os devidos testes. Porém os códigos não estão com nenhuma irregularidade ao meu ver.
Postado Outubro 26, 2017 7 anos Autor 1 hora atrás, RobotTurto disse: Estive com problemas com meus servidores não consegui fazer os devidos testes. Porém os códigos não estão com nenhuma irregularidade ao meu ver. Entendo...Obrigado de qualquer maneira!!! Bom fico no aguardo de uma boa alma que possa ajudar rsrs
Postado Outubro 26, 2017 7 anos Fiz esse script para promotion de arqueiro. Teste: local msgHi = "Quer uma {promotion}?" local msgBye = "Ja vai?!" local msgDis = "Tchau!" local vocation = 3 -- ID da vocação local custo1 = 20000 -- Custo da primeira Promotion local vocation2 = 7 -- Primeira Promotion local custo2 = 40000 -- Custo da segunda Promotion local vocation3 = 9 -- Segunda Promotion local focuses = {} local function isFocused(cid) for i, v in pairs(focuses) do if(v == cid) then return true end end return false end local function addFocus(cid) if(not isFocused(cid)) then table.insert(focuses, cid) end end local function removeFocus(cid) for i, v in pairs(focuses) do if(v == cid) then table.remove(focuses, i) break end end end local function lookAtFocus() for i, v in pairs(focuses) do if(isPlayer(v)) then doNpcSetCreatureFocus(v) return end end doNpcSetCreatureFocus(0) end function onCreatureAppear(cid) end function onCreatureDisappear(cid) if(isFocused(cid)) then selfSay("Tchau ".. getPlayerName(cid) ..".") removeFocus(cid) if(isPlayer(cid)) then closeShopWindow(cid) end end end function onCreatureSay(cid, type, msg) if msg == "hi" or msg == "hello" and not isFocused(cid) then selfSay(msgHi, cid) addFocus(cid) elseif isFocused(cid) and msg == "promotion" or msg == "promote" then selfSay("Quer ser promovido? Ira te custar ".. custo1 .." moedas de ouro.", cid) promo = 1 elseif isFocused(cid) and msg == "yes" and promo == 1 then promo = 0 if getPlayerVocation(cid) == vocation then if getPlayerMoney(cid) >= custo1 then doPlayerRemoveMoney(cid, custo1) doPlayerSetVocation(cid, vocation2) selfSay("Parabens! Voce ainda pode receber {mais uma promotion}.", cid) else selfSay("Voce nao tem ".. custo1 ..".", cid) end else selfSay("Apenas arqueiros.", cid) end elseif isFocused(cid) and msg == "no" and promo == 1 then promo = 0 selfSay("Ok!", cid) elseif isFocused(cid) and msg == "mais uma promotion" then selfSay("Quer ser promovido novamente? Ira te custar ".. custo2 .." moedas de ouro.", cid) promo = 2 elseif isFocused(cid) and msg == "yes" and promo == 2 then promo = 0 if getPlayerVocation(cid) == vocation2 then if getPlayerMoney(cid) >= custo2 then doPlayerRemoveMoney(cid, custo2) doPlayerSetVocation(cid, vocation3) selfSay("Parabens!", cid) else selfSay("Voce nao tem ".. custo1 ..".", cid) end else selfSay("Apenas arqueiros.", cid) end elseif isFocused(cid) and msg == "no" and promo == 2 then promo = 0 selfSay("Ok!", cid) elseif((isFocused(cid)) and (msg == "bye" or msg == "tchau" or msg == "xau")) then selfSay(msgBye) closeShopWindow(cid) removeFocus(cid) end end function onPlayerCloseChannel(cid) if(isFocused(cid)) then selfSay("Humm.") closeShopWindow(cid) removeFocus(cid) end end function onThink() for i, focus in pairs(focuses) do if(not isCreature(focus)) then removeFocus(focus) else local distance = getDistanceTo(focus) or -1 if((distance > 4) or (distance == -1)) then doCreatureSay(getNpcCid(), msgDis, TALKTYPE_YELL) closeShopWindow(focus) removeFocus(focus) end end end lookAtFocus() end Editado Outubro 26, 2017 7 anos por anderkrox (veja o histórico de edições) Eternera Tibia Server - RPG
Postado Outubro 26, 2017 7 anos Autor 50 minutos atrás, anderkrox disse: Fiz esse script para promotion de arqueiro. Teste: local msgHi = "Quer uma {promotion}?" local msgBye = "Ja vai?!" local msgDis = "Tchau!" local vocation = 3 -- ID da vocação local custo1 = 20000 -- Custo da primeira Promotion local vocation2 = 7 -- Primeira Promotion local custo2 = 40000 -- Custo da segunda Promotion local vocation3 = 9 -- Segunda Promotion local focuses = {} local function isFocused(cid) for i, v in pairs(focuses) do if(v == cid) then return true end end return false end local function addFocus(cid) if(not isFocused(cid)) then table.insert(focuses, cid) end end local function removeFocus(cid) for i, v in pairs(focuses) do if(v == cid) then table.remove(focuses, i) break end end end local function lookAtFocus() for i, v in pairs(focuses) do if(isPlayer(v)) then doNpcSetCreatureFocus(v) return end end doNpcSetCreatureFocus(0) end function onCreatureAppear(cid) end function onCreatureDisappear(cid) if(isFocused(cid)) then selfSay("Tchau ".. getPlayerName(cid) ..".") removeFocus(cid) if(isPlayer(cid)) then --Be sure he's online closeShopWindow(cid) end end end function onCreatureSay(cid, type, msg) if msg == "hi" or msg == "hello" and not isFocused(cid) then selfSay(msgHi, cid) addFocus(cid) elseif isFocused(cid) and msg == "promotion" or msg == "promote" then selfSay("Quer ser promovido? Ira te custar ".. custo1 .." moedas de ouro.", cid) promo = 1 elseif isFocused(cid) and msg == "yes" and promo == 1 then promo = 0 if getPlayerVocation(cid) == vocation then if getPlayerMoney(cid) >= custo1 then doPlayerRemoveMoney(cid, custo1) doPlayerSetVocation(cid, vocation2) selfSay("Parabens! Voce ainda pode receber {mais uma promotion}.", cid) else selfSay("Voce nao tem ".. custo1 ..".", cid) end else selfSay("Apenas arqueiros.", cid) end elseif isFocused(cid) and msg == "no" and promo == 1 then promo = 0 selfSay("Ok!", cid) elseif isFocused(cid) and msg == "mais uma promotion" then selfSay("Quer ser promovido novamente? Ira te custar ".. custo2 .." moedas de ouro.", cid) promo = 2 elseif isFocused(cid) and msg == "yes" and promo == 2 then promo = 0 if getPlayerVocation(cid) == vocation2 then if getPlayerMoney(cid) >= custo2 then doPlayerRemoveMoney(cid, custo2) doPlayerSetVocation(cid, vocation3) selfSay("Parabens!", cid) else selfSay("Voce nao tem ".. custo1 ..".", cid) end else selfSay("Apenas arqueiros.", cid) end elseif isFocused(cid) and msg == "no" and promo == 2 then promo = 0 selfSay("Ok!", cid) elseif((isFocused(cid)) and (msg == "bye" or msg == "tchau" or msg == "xau")) then selfSay(msgBye) closeShopWindow(cid) removeFocus(cid) end end function onPlayerCloseChannel(cid) if(isFocused(cid)) then selfSay("Humm.") closeShopWindow(cid) removeFocus(cid) end end function onThink() for i, focus in pairs(focuses) do if(not isCreature(focus)) then removeFocus(focus) else local distance = getDistanceTo(focus) or -1 if((distance > 4) or (distance == -1)) then doCreatureSay(getNpcCid(), msgDis, TALKTYPE_YELL) closeShopWindow(focus) removeFocus(focus) end end end lookAtFocus() end Opa! fiz o teste e deu um errinho, creio que referente ao Focus e Distance do personagem e NPC, vc deve entender melhor, veja
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.