Ir para conteúdo

Featured Replies

Postado

Tenho esse script de spell. Que funciona assim: ao mirar no target e usar a spell, além de pegar no monstro da target se tiver outros monstros por perto vai pegando em um por um.

(como se fosse passando carga de choque). O script fica dando erro quando você usa a spell sem estar clicando em algum monstro.

O que eu realmente quero nesse script é usar sem target e colocar uma distancia a minha volta, ou seja quem tiver a minha volta vai passando carga um por um até o ultimo.

Tentei editar esse script para tal finalidade porém, parece muito complexo para mim ainda. Se alguém puder ajudar (+REP).

 

Script Abaixo:

function isInArray3(array, array2) -- Function by Ramza (Ricardo Ianelli)
	local x = array2[1]
	local y = array2[2]
	  for _,v in pairs(array) do
	     if (v[1] == x and v[2] == array2[2]) or (v[2] == x and v[1] == y)  then
	       return true    
	     end
	  end
	return false
	end                 
	function chainRoute(init, r) -- Function by Ramza (Ricardo Ianelli)
	local route, targets, tam = {{init, init}}, {}, 0
	 for i = 1,#route do
	    repeat
	    tam = #route 
	       targets = getSpectators(getCreaturePosition(init), r, r, false)      
	    if #targets > 1 then
	       for _,v in pairs(targets) do
	          if not isInArray3(route, {init, v}) and (init ~= v) then
	             table.insert(route, {init,v})
	          end 
	       end
	    end
	    init = route[#route][2]
	   until tam == #route
	 end
	return route 
	end
	-----------------------------------------------------------------------------
	-- spell by vyctor17 function by ramza
	function onCastSpell(cid, var)
	    local level = getPlayerLevel(cid)
	    local mg = getPlayerMagLevel(cid)
	    local min = -(level *0.28 + mg * 2.34 * 1.0)
	    local max = -(level * 0.34 + mg * 2.34 * 1.0)
	    local tempo = 4 -- tempo do cd ( em segundos )
	    local storage = 5632 -- storage
	    local disteffect = 1
	    local magiceffect = 11
	        
	        if exhaustion.check(cid, storage) then
	         doPlayerSendCancel(cid, "you are exhausted.")
	         return FALSE
	        end
	    if isCreature(getCreatureTarget(cid)) then
	        local creaturePos = getCreaturePosition(getCreatureTarget(cid))
	         creaturePos.stackpos = 255
	         addEvent (function() if getCreatureTarget(cid) ~= nil then doTargetCombatHealth (cid, getCreatureTarget(cid), 1, min, max, magiceffect)
	         doSendDistanceShoot(getCreaturePosition(cid), creaturePos, disteffect)
	                 doSendMagicEffect(creaturePos, magiceffect) return TRUE end end, 17)
	    else
	local n = 6
	for i = 1, n do
	local newPos =  getPositionByDirection(getCreaturePosition(cid), getCreatureLookDirection(cid), i)
	newPos.stackpos = 255
	
	if not isWalkable(newPos, false, true, true) or isCreature(getThingfromPos(newPos).uid) or i == n then
	doSendDistanceShoot(getCreaturePosition(cid), newPos, disteffect)
	addEvent(function() if isCreature(getThingfromPos(newPos).uid) then doTargetCombatHealth(cid,getThingfromPos(newPos).uid, 1, min, max, magiceffect)
	doSendMagicEffect(newPos, magiceffect) return TRUE else doSendMagicEffect(newPos, magiceffect)  end end, 140)
	break
	end
	end
	end
	    
	    if math.random(1,1) < 10 then
	       local inicio = getCreatureTarget(cid)
	       local targets = chainRoute(inicio, 2)
	       local i = 0
	         for _,v in pairs(targets) do 
	            i = i+1
	             addEvent(doSendDistanceShoot, i*100, getCreaturePosition(v[1]), getCreaturePosition(v[2]), 32)
	             addEvent(doAreaCombatHealth, i*100, cid, 1, getCreaturePosition(v[2]), 0, min, max, CONST_ME_HITAREA)
	         end
	    end            
	        exhaustion.set(cid, storage, tempo)
	    
	return true
	end
	

  • 1 month later...
Postado

Sobre o erro ao usar a spell sem target, você colocou que precisa de target? geralmente é assim: "target= yes" ou "target=on" 

é Spell de poketibia? 

Por exemplo, minha tabela de spells é assim:

 

['Sceptile'] = {
        [1] = {spell = "Quick Attack", minLv = 1, min = 10, max = 20, target = "yes",dista = 1 , cd = 5},

        [2] = {spell = "Razor Leaf", minLv = 1, min = 10, max = 20, target = "yes",dista = 7 , cd = 7},

        [3] = {spell = "Leaf Storm", minLv = 1, min = 10, max = 20, target = "no",dista = 1 , cd = 20},

        [4] = {spell = "Frenzy Plant", minLv = 1, min = 10, max = 20, target = "no",dista = 1 , cd = 28},
    },

 

 

 

Postado
function onCastSpell(cid, var)
	    local level = getPlayerLevel(cid)
	    local mg = getPlayerMagLevel(cid)
	    local min = -(level *0.28 + mg * 2.34 * 1.0)
	    local max = -(level * 0.34 + mg * 2.34 * 1.0)
	    local tempo = 4 -- tempo do cd ( em segundos )
	    local storage = 5632 -- storage
	    local disteffect = 1
	    local magiceffect = 11

local target = getCreatureTarget(cid)


	        
	        if exhaustion.check(cid, storage) and if isCreature(target) == TRUE then
	         doPlayerSendCancel(cid, "you are exhausted.")
	         return FALSE
	        end
	    if isCreature(getCreatureTarget(cid)) then
	        local creaturePos = getCreaturePosition(getCreatureTarget(cid))
	         creaturePos.stackpos = 255
	         addEvent (function() if getCreatureTarget(cid) ~= nil then doTargetCombatHealth (cid, getCreatureTarget(cid), 1, min, max, magiceffect)
	         doSendDistanceShoot(getCreaturePosition(cid), creaturePos, disteffect)
	                 doSendMagicEffect(creaturePos, magiceffect) return TRUE end end, 17)
	    else
	local n = 6
	for i = 1, n do
	local newPos =  getPositionByDirection(getCreaturePosition(cid), getCreatureLookDirection(cid), i)
	newPos.stackpos = 255
	
	if not isWalkable(newPos, false, true, true) or isCreature(getThingfromPos(newPos).uid) or i == n then
	doSendDistanceShoot(getCreaturePosition(cid), newPos, disteffect)
	addEvent(function() if isCreature(getThingfromPos(newPos).uid) then doTargetCombatHealth(cid,getThingfromPos(newPos).uid, 1, min, max, magiceffect)
	doSendMagicEffect(newPos, magiceffect) return TRUE else doSendMagicEffect(newPos, magiceffect)  end end, 140)
	break
	end
	end
	end
	    
	    if math.random(1,1) < 10 then
	       local inicio = getCreatureTarget(cid)
	       local targets = chainRoute(inicio, 2)
	       local i = 0
	         for _,v in pairs(targets) do 
	            i = i+1
	             addEvent(doSendDistanceShoot, i*100, getCreaturePosition(v[1]), getCreaturePosition(v[2]), 32)
	             addEvent(doAreaCombatHealth, i*100, cid, 1, getCreaturePosition(v[2]), 0, min, max, CONST_ME_HITAREA)
	         end
	    end            
	        exhaustion.set(cid, storage, tempo)
	    
	return true
	end

 

 

A partir do cast spell troca o codigo por esse

Toda terça-feira um tópico novo:

Descanso para curar mana (Spell): https://tibiaking.com/forums/topic/94615-spell-descanso-para-curar-mana/

Peça sua spell (Suporte):                https://tibiaking.com/forums/topic/84162-peça-sua-spell/                        

Chuva de flechas (Spell):                https://tibiaking.com/forums/topic/72232-chuva-de-flechas-spell/

Doom (Spell):                                https://tibiaking.com/forums/topic/51622-doom-spell/

Utilização do VS Code (Infra)       https://tibiaking.com/forums/topic/94463-utilizando-o-visual-studio-code-notepad-nunca-mais/

SD com Combo (Spell):                 https://tibiaking.com/forums/topic/94520-sd-modificada/

Alteração attack speed (C++):        https://tibiaking.com/forums/topic/94714-c-attack-speed-spells-itens-e-onde-você-quiser/  

Bônus de Speed (NPC)                  https://tibiaking.com/forums/topic/94809-npc-concede-bônus-aos-players/
 

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo