Postado Janeiro 19, 2015 10 anos Este é um post popular. Bom, esse script é um agradecimento ao Tibia King(já que eu não pretendia libera-lo). O TK me ensinou a programar em LUA, o que foi a base para o meu interesse em programação, e hoje estou criando um jogo meu do zero(um sonho que eu tenho). Bom, mas vocês só devem querer o script. O script permite que o jogador atire três bolts, gastando três também, e acerte os inimigos próximos do target, por exemplo: T = Target E = Enemy E, E, E E, T, E E, E, E Ele só vai atirar duas flechas adicionais caso tenha inimigos próximos do target. Eu nunca terminei o script, pois ele precisa de configuração manual. O que acontece é que o script tem de ser posto nas flechas, e não no crossbow, então para cada flecha você tem de alterar o efeito do tiro, contudo a storage pode ser a mesma. Imagem: Script: local cfg = { storage = 15001, -- Esse script usa storages, então ponha uma que ainda não esteja sendo usada removeAmmo = true, -- Remove munição das balas extras? TYPE = COMBAT_PHYSICALDAMAGE, -- Que tipo de combat? EFFECT = CONST_ME_DRAWBLOOD, -- Que tipo de efeito? DISTANCEEFFECT = CONST_ANI_VORTEXBOLT, -- Que tipo de efeito de distancia? level = 70, -- Level necessário voc = {3, 7}, -- Vocação(ões) necessária(s) id = 21690, -- ID do triple bolt crossbow } local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, cfg.TYPE) setCombatParam(combat, COMBAT_PARAM_EFFECT, cfg.EFFECT) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, cfg.DISTANCEEFFECT) setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0) function onUseWeapon(cid, var) doCombat(cid, combat, var) if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == cfg.id or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == cfg.id then if getPlayerLevel(cid) >= cfg.level and isInArray(cfg.voc, getPlayerVocation(cid)) or getPlayerGroupId(cid) > 2 then local target = getCreatureTarget(cid) local level = getPlayerLevel(cid) local dlevel = getPlayerSkill(cid, 4) local atkMin = (level/5) local atkMax = (0.09*0.75*dlevel*39+atkMin) local i = getPlayerSlotItem(cid, 10) local boltCount = getPlayerSlotItem(cid, 10).type or 0 local pPos = getCreaturePosition(cid) local tPos = getCreaturePosition(target) local function doMimicsShoot(pos) local hm = getPlayerStorageValue(cid, cfg.storage) local creature = getTopCreature(pos) if creature == getTopCreature(pPos) then return false end if creature.type == THING_TYPE_MONSTER and hm < 2 or creature.type == THING_TYPE_PLAYER and hm < 2 then local percent90 = (math.random(1,10)) if percent90 > 1 and boltCount > 2 then setPlayerStorageValue(cid, cfg.storage, hm+1) doSendDistanceShoot(pPos, pos, cfg.DISTANCEEFFECT) doAreaCombatHealth(cid, cfg.TYPE, pos, area, -atkMin, -atkMax, cfg.EFFECT) if removeAmmo then doRemoveItem(i.uid, 1) end elseif boltCount > 2 then setPlayerStorageValue(cid, cfg.storage, hm+1) doSendDistanceShoot(pPos, pos, cfg.DISTANCEEFFECT) doSendMagicEffect(pos, CONST_ME_POFF) if removeAmmo then doRemoveItem(i.uid, 1) end end end end local tab = { {x=tPos.x-1, y=tPos.y, z=tPos.z}, {x=tPos.x+1, y=tPos.y, z=tPos.z}, {x=tPos.x, y=tPos.y+1, z=tPos.z}, {x=tPos.x, y=tPos.y-1, z=tPos.z}, {x=tPos.x-1, y=tPos.y-1, z=tPos.z}, {x=tPos.x+1, y=tPos.y-1, z=tPos.z}, {x=tPos.x+1, y=tPos.y+1, z=tPos.z}, {x=tPos.x-1, y=tPos.y+1, z=tPos.z}, } setPlayerStorageValue(cid, cfg.storage, 0) for i = 1, #tab do doMimicsShoot(tab) end end end end Em weapons.xml: TFS 1.0: <distance id="15649" unproperly="1" level="40" function="default" script="nomedoarquivo.lua"/> <- é só botar essa tag no bolt desejado Outro TFS: <distance id="15649" unproperly="1" level="40" function="default" event="script" value="nomedoarquivo.lua"/> <- é só botar essa tag no bolt desejado Vou indicar uma lista de efeitos para serem utilizados: http://www.tibiaking.com/forum/topic/32901-lista-completa-de-magic-effects-e-shoot-type/ Esse conteúdo é meu, porém deixo-o para todos do TK, qualquer mudança e redistribuição dentro do TK é permitida, claro, com meus créditos, pelo menos. Conto com a ajuda dos programadores para finalizar e melhorar esse script. Editado Fevereiro 19, 2015 10 anos por mateusak (veja o histórico de edições) Não se esqueça de dar REP+ para quem te ajudou e caso seja a solução marcar como melhor resposta! NÃO CLIQUE AQUI! NEM AQUI! ________________________________________________________________________________________________________________________________________________________________________________________________________________________ “A imaginação é mais importante que o conhecimento.” Albert Einstein
Postado Janeiro 19, 2015 10 anos Agradeço por fornecer tal conteúdo com exclusividade ao TibiaKing. Seu conteúdo foi aprovado e com isso você ganhou um ponto de REP+ da equipe e o tópico foi movido para a área correta. Espero que faça sucesso entre os membros :] The corrupt fear us. The honest support us. The heroic join us.
Postado Fevereiro 2, 2015 10 anos Wooow muito foda gostei muito do script amigo Rep+ Uma dúvida teria como colocar as flechas infinitas? estava pensando em adicionar esse script no meu Otserv de War Abraços
Postado Fevereiro 7, 2015 10 anos Autor Wooow muito foda gostei muito do script amigo Rep+ Uma dúvida teria como colocar as flechas infinitas? estava pensando em adicionar esse script no meu Otserv de War Abraços Desculpe pela demora, fui viajar. local storage = 15001 -- Esse script usa storages, então ponha uma que ainda não esteja sendo usada local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) -- Essa parte aqui. Para cada flecha você setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD) -- Precisa alterar esses valores setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_VORTEXBOLT) -- Para fica igual a flecha original setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0) function onUseWeapon(cid, var) doCombat(cid, combat, var) if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 21690 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 21690 then if getPlayerLevel(cid) >= 70 and getPlayerVocation(cid) == 3 or getPlayerGroupId(cid) > 2 then local vstor = getPlayerStorageValue(cid, storage) or -1 local target = getCreatureTarget(cid) local level = getPlayerLevel(cid) local dlevel = getPlayerSkill(cid, 4) local atkMin = (level/5) local atkMax = (0.09*0.75*dlevel*39+atkMin) local i = getPlayerSlotItem(cid, 10) local boltCount = getPlayerSlotItem(cid, 10).type or 0 local pPos = getCreaturePosition(cid) local tPos = getCreaturePosition(target) -- Função: local function doMimicsShoot(pos) local hm = getPlayerStorageValue(cid, storage) local creature = getTopCreature(pos) if creature.type == THING_TYPE_MONSTER and hm < 2 then local percent90 = (math.random(1,10)) if percent90 > 1 and boltCount > 2 then setPlayerStorageValue(cid, storage, hm+1) doSendDistanceShoot(pPos, pos, 44) doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, pos, area, -atkMin, -atkMax, CONST_ME_DRAWBLOOD) elseif boltCount > 2 then setPlayerStorageValue(cid, storage, hm+1) doSendDistanceShoot(pPos, pos, 44) doSendMagicEffect(pos, CONST_ME_POFF) end end end -- Acaba aqui local tab = { {x=tPos.x-1, y=tPos.y, z=tPos.z}, {x=tPos.x+1, y=tPos.y, z=tPos.z}, {x=tPos.x, y=tPos.y+1, z=tPos.z}, {x=tPos.x, y=tPos.y-1, z=tPos.z}, {x=tPos.x-1, y=tPos.y-1, z=tPos.z}, {x=tPos.x+1, y=tPos.y-1, z=tPos.z}, {x=tPos.x+1, y=tPos.y+1, z=tPos.z}, {x=tPos.x-1, y=tPos.y+1, z=tPos.z}, } setPlayerStorageValue(cid, storage, 0) for i = 1, #tab do doMimicsShoot(tab) end setPlayerStorageValue(cid, storage, vstor) end end end Faz um tempo que não mexo com LUA, então pode estar errado, mas tem de testar... Não se esqueça de dar REP+ para quem te ajudou e caso seja a solução marcar como melhor resposta! NÃO CLIQUE AQUI! NEM AQUI! ________________________________________________________________________________________________________________________________________________________________________________________________________________________ “A imaginação é mais importante que o conhecimento.” Albert Einstein
Postado Fevereiro 12, 2015 10 anos Mestre! O Script foi sem nenhum erro mas na hora de atirar não sai as 3 Bolts, sai somente 1 normal. /\ Print Script \/ local storage = 15009 local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD) setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_PIERCINGBOLT) setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0) function onUseWeapon(cid, var) doCombat(cid, combat, var) if getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 7363 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 7363 then if getPlayerLevel(cid) >= 70 and getPlayerVocation(cid) == 3 or getPlayerGroupId(cid) > 2 then local vstor = getPlayerStorageValue(cid, storage) or -1 local target = getCreatureTarget(cid) local level = getPlayerLevel(cid) local dlevel = getPlayerSkill(cid, 4) local atkMin = (level/5) local atkMax = (0.09*0.75*dlevel*39+atkMin) local i = getPlayerSlotItem(cid, 10) local boltCount = getPlayerSlotItem(cid, 10).type or 0 local pPos = getCreaturePosition(cid) local tPos = getCreaturePosition(target) local function doMimicsShoot(pos) local hm = getPlayerStorageValue(cid, storage) local creature = getTopCreature(pos) if creature.type == THING_TYPE_MONSTER and hm < 2 then local percent90 = (math.random(1,10)) if percent90 > 1 and boltCount > 2 then setPlayerStorageValue(cid, storage, hm+1) doSendDistanceShoot(pPos, pos, 44) doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, pos, area, -atkMin, -atkMax, CONST_ME_DRAWBLOOD) elseif boltCount > 2 then setPlayerStorageValue(cid, storage, hm+1) doSendDistanceShoot(pPos, pos, 44) doSendMagicEffect(pos, CONST_ME_POFF) end end end local tab = { {x=tPos.x-1, y=tPos.y, z=tPos.z}, {x=tPos.x+1, y=tPos.y, z=tPos.z}, {x=tPos.x, y=tPos.y+1, z=tPos.z}, {x=tPos.x, y=tPos.y-1, z=tPos.z}, {x=tPos.x-1, y=tPos.y-1, z=tPos.z}, {x=tPos.x+1, y=tPos.y-1, z=tPos.z}, {x=tPos.x+1, y=tPos.y+1, z=tPos.z}, {x=tPos.x-1, y=tPos.y+1, z=tPos.z}, } setPlayerStorageValue(cid, storage, 0) for i = 1, #tab do doMimicsShoot(tab) end setPlayerStorageValue(cid, storage, vstor) end end end
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.