Postado Dezembro 30, 2014 10 anos Este é um post popular. Bom, postei este tópico nessa área e não em globalevents por que não considero que lá deem muitas visualizações em globalevents, não é por que quero ganhar reputação ou algo do tipo, mas para ajudar quem precisa de tal coisa. Resumindo: Este script é um globalevent que a cada 2 segundos muda o attackspeed de um item conforme o skill fist fighting do player, funcionando como um sistema de attackspeed com source, quanto mais skill, mais rápido ele ataca, mas como este sistema não utiliza sources, eu fiz o melhor que eu pude. Testado em um TFS 0.4 Bugs: Ele só funciona com alguma arma na sua mão, o bow não funciona, spear, wand, rod, etc... Tudo funciona, menos o bow, e tem que ser arma, não adianta por um shield lá, um gold coin, nada, só funciona com armas como espadas. Lag: Não se se irá causar lag, pouco lag, ou muito lag, eu fiz em globalevent por causa do seu intervalo que pode ser configurável para mais ou para menos, não pensei muito em usar o creatureevent por conta que o onThink ou onAttack fica se repetindo a cada meio segundo se não me engano, então, preferi fazer desta forma. Instalação: Na pasta globalevents/scripts crie um arquivo com extensão .lua com nome de playerattackspeed(ficando playerattackspeed.lua) e ponha isso dentro: function onThink(interval) local multi = 20 local skill = 0 for _, pid in ipairs(getPlayersOnline()) do local slotLeft, slotRight = getPlayerSlotItem(pid, CONST_SLOT_LEFT), getPlayerSlotItem(pid, CONST_SLOT_RIGHT) if isCreature(pid) then if slotLeft.uid > 0 then if (multi*getPlayerSkill(pid, skill)) >= 1999 then doItemSetAttribute(slotLeft.uid, "attackspeed", 1) else doItemSetAttribute(slotLeft.uid, "attackspeed", 2000-(multi*getPlayerSkill(pid, skill))) end elseif slotRight.uid > 0 then if (multi*getPlayerSkill(pid, skill)) >= 1999 then doItemSetAttribute(slotRight.uid, "attackspeed", 1) else doItemSetAttribute(slotRight.uid, "attackspeed", 2000-(multi*getPlayerSkill(pid, skill))) end end end end return true end Agora volte uma pasta e vá só para globalevents lá você encontrará um arquivo chamado globalevents com extensão .xml(sendo globalevents.xml) nele adicione a tag antes das duas últimas linhas: <globalevent name="PlayerAttackSpeed" interval="2000" event="script" value="playerattackspeed.lua"/> Bom, o script foi instalado com sucesso. Configuração: No arquivo com extensão final .lua você pode modificar o id do skill em "local skill = 0", 0 significa o skill fist fighting, você pode ir alternando Ainda no arquivo com extensão final .lua pode-se alterar o "local multi = 20", o 20 é a multiplicação do skill, ou seja, skill x 20, quando o skill configurado(eu deixei fist fighting) atingir 100 com o multi em 20, ele chegará ao máximo de attackspeed, após isso mesmo que ele pegue skill 1000 continuará essa mesma velocidade por conta de limitações que o tibia impõe nas suas sources, se quiser que ele ataque ainda mais rápido deverá mudar se não me engano só uma linha nas sources. Agora no arquivo globalevents.xml você pode alterar a tag, mudando interval, 1000 é igual a um segundo, ou seja, no script ta configurado para a cada 2 segundos alterar o attackspeed conforme a configuração, você pode alterar para quanto quiser, lembre-se 1000 é um segundo, ou seja, se colocar 5000 fica 5 segundos de intervalo para o script agir. Espero que gostem! Talvez quando eu estiver mais avançado em lua eu possa criar uma segunda versão que possa atacar mais rápido, mas, no momento nem penso nisso Versão Creaturescripts - Créditos: detoneitormen (Obs: Não testei esta versão, só copiei do modo que ele escreveu.) function onThink(cid, interval) local multi = 200 local skill = 2 local limite = 99 local slotLeft, slotRight = getPlayerSlotItem(cid, CONST_SLOT_LEFT), getPlayerSlotItem(cid, CONST_SLOT_RIGHT) if last_interval == nil then last_interval= os.clock() end if (os.clock() - last_interval) > 1 then if slotLeft.uid > 0 then if (multi*getPlayerSkill(cid, skill)) >= limite then doItemSetAttribute(slotLeft.uid, "attackspeed", 1) else doItemSetAttribute(slotLeft.uid, "attackspeed", 2000-(multi*getPlayerSkill(cid, skill))) end elseif slotRight.uid > 0 then if (multi*getPlayerSkill(cid, skill)) >= limite then doItemSetAttribute(slotRight.uid, "attackspeed", 1) else doItemSetAttribute(slotRight.uid, "attackspeed", 2000-(multi*getPlayerSkill(cid, skill))) end end last_interval= os.clock() return true end return false end A configuração é igual a minha versão, só muda a variável "limite" e "multi", para deixar igual ao meu, basta trocar: Isso: local limite = 99 Por isso: local limite = 1999 E isso: local multi = 200 Por isso: local multi = 20 Obrigado detoneitormen. Editado Fevereiro 2, 2015 10 anos por Snowsz (veja o histórico de edições) _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Dezembro 30, 2014 10 anos Muito bom o Script, com certeza vai ajudar quem não tem as Sources do Servidor em mãos. http://a.tumblr.com/tumblr_loa174BWQy1qi1i1go1_r1.mp3
Postado Dezembro 31, 2014 10 anos Autor Muito bom o Script, com certeza vai ajudar quem não tem as Sources do Servidor em mãos. Obrigado, quando eu não sabia o quanto sei hoje sobre lua, só vinha erro, erro e erro no console rsrs, pelo menos estou no nível que consegui fazer isso sem ficar dando algum erro, estou feliz por isso, pois era um objetivo que eu tinha, "attackspeed sem sources". _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Dezembro 31, 2014 10 anos Muito bom kra, criativo ;] Não testei, mas imagino que funcione kkk, só tem um erro aqui: elseif slotRight.uid > 0 then if (multi*getPlayerSkill(pid, skill)) >= 1999 then doItemSetAttribute(slotLeft.uid, "attackspeed", 1) else doItemSetAttribute(slotLeft.uid, "attackspeed", 2000-(multi*getPlayerSkill(pid, skill))) end No caso, slotRight... Eu escrevi aqui no creaturescripts, deve funcionar também: function onThink(cid, interval) local multi = 200 local skill = 2 local limite = 99 local slotLeft, slotRight = getPlayerSlotItem(cid, CONST_SLOT_LEFT), getPlayerSlotItem(cid, CONST_SLOT_RIGHT) if last_interval == nil then last_interval= os.clock() end if (os.clock() - last_interval) > 1 then if slotLeft.uid > 0 then if (multi*getPlayerSkill(cid, skill)) >= limite then doItemSetAttribute(slotLeft.uid, "attackspeed", 1) else doItemSetAttribute(slotLeft.uid, "attackspeed", 2000-(multi*getPlayerSkill(cid, skill))) end elseif slotRight.uid > 0 then if (multi*getPlayerSkill(cid, skill)) >= limite then doItemSetAttribute(slotRight.uid, "attackspeed", 1) else doItemSetAttribute(slotRight.uid, "attackspeed", 2000-(multi*getPlayerSkill(cid, skill))) end end last_interval= os.clock() return true end return false end Mas imagino que o bug esteja na repetição, então, como o servidor vai ficar sendo carregado o tempo inteiro com o script, o andar automático, por exemplo, será interrompido...isso pelo creaturescripts, mas talvez pelo global também, não sei.
Postado Janeiro 2, 2015 10 anos Autor Muito bom kra, criativo ;] Não testei, mas imagino que funcione kkk, só tem um erro aqui: elseif slotRight.uid > 0 then if (multi*getPlayerSkill(pid, skill)) >= 1999 then doItemSetAttribute(slotLeft.uid, "attackspeed", 1) else doItemSetAttribute(slotLeft.uid, "attackspeed", 2000-(multi*getPlayerSkill(pid, skill))) end No caso, slotRight... Eu escrevi aqui no creaturescripts, deve funcionar também: function onThink(cid, interval) local multi = 200 local skill = 2 local limite = 99 local slotLeft, slotRight = getPlayerSlotItem(cid, CONST_SLOT_LEFT), getPlayerSlotItem(cid, CONST_SLOT_RIGHT) if last_interval == nil then last_interval= os.clock() end if (os.clock() - last_interval) > 1 then if slotLeft.uid > 0 then if (multi*getPlayerSkill(cid, skill)) >= limite then doItemSetAttribute(slotLeft.uid, "attackspeed", 1) else doItemSetAttribute(slotLeft.uid, "attackspeed", 2000-(multi*getPlayerSkill(cid, skill))) end elseif slotRight.uid > 0 then if (multi*getPlayerSkill(cid, skill)) >= limite then doItemSetAttribute(slotRight.uid, "attackspeed", 1) else doItemSetAttribute(slotRight.uid, "attackspeed", 2000-(multi*getPlayerSkill(cid, skill))) end end last_interval= os.clock() return true end return false end Mas imagino que o bug esteja na repetição, então, como o servidor vai ficar sendo carregado o tempo inteiro com o script, o andar automático, por exemplo, será interrompido...isso pelo creaturescripts, mas talvez pelo global também, não sei. Obrigado por avisar, está corrigido, e, por isso mesmo que eu puis no globalevents, intervalo de 2 segundos para poder agir _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
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.