vyctor17 35 #1 Postado 4 Setembro, 2011 (editado) Exori Eletrical Nome: Exori Eletrical Autor: vyctor17 Versão Testada: TFS 0.3.6PL1 (8.54) Lib: by ramza um obrigado especial ao eskk por me dar uma base .-. O que a magia faiz? Simples e como um exori normal mais quando lançada sem target ela core uma linha reta ate bater em um objeto/criatura e quando é usada com target tem uma chance de dar uma descarga elétrica batendo em todas as criaturas por perto -- RamzaLIB - Electrical Discharge Functions --- Created by Ramza(Ricardo Ianelli) for Zodiac Legacy ATS. ---- For more informations, visit: http://forums.otserv.com.br/forumdisplay.php?493-Zodiac-Legacy 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 = 4 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,100) < 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 Foto: Editado 5 Setembro, 2011 por vyctor17 Compartilhar este post Link para o post
Lwkass 1 #2 Postado 4 Setembro, 2011 (editado) Agora sim, beem melhor ! Script bem feito e a indentação foi respeitada, Obrigado pela contribuição ! Editado 5 Setembro, 2011 por Lwkass Compartilhar este post Link para o post
luigilc 0 #3 Postado 6 Setembro, 2011 Inspirado na runa do Ramza né? Parabéns cara, mto bom o script Compartilhar este post Link para o post
vyctor17 35 #4 Postado 6 Setembro, 2011 na verdade n eu e os cara do chat de programaçao aj tahva fazendo asim mais dai tava bem feio o feito e n tava dando certo com a lib do ramza ajudo muito '-' Compartilhar este post Link para o post
luigilc 0 #5 Postado 8 Setembro, 2011 (editado) ta dando esse erro: [08/09/2011 12:36:50] [Error - Spell Interface] [08/09/2011 12:36:50] data/spells/scripts/eletrical.lua:onCastSpell [08/09/2011 12:36:50] Description: [08/09/2011 12:36:50] (luaGetThingPosition) Thing not found [08/09/2011 12:36:50] [Error - Spell Interface] [08/09/2011 12:36:50] data/spells/scripts/eletrical.lua:onCastSpell [08/09/2011 12:36:50] Description: [08/09/2011 12:36:50] data/201-discharge.lua:23: attempt to get length of local 'targets' (a nil value) [08/09/2011 12:36:50] stack traceback: [08/09/2011 12:36:50] data/201-discharge.lua:23: in function 'chainRoute' [08/09/2011 12:36:50] data/spells/scripts/eletrical.lua:38: in function <data/spells/scripts/eletrical.lua:2> Editado 8 Setembro, 2011 por luigilc Compartilhar este post Link para o post
iuniX 4 #6 Postado 8 Setembro, 2011 ta dando esse erro: [08/09/2011 12:27:13] [Error - Spell Interface] [08/09/2011 12:27:13] data/spells/scripts/eletrical.lua:onCastSpell [08/09/2011 12:27:13] Description: [08/09/2011 12:27:13] data/spells/scripts/eletrical.lua:25: attempt to call global 'getPositionByDirection' (a nil value) [08/09/2011 12:27:13] stack traceback: [08/09/2011 12:27:13] data/spells/scripts/eletrical.lua:25: in function <data/spells/scripts/eletrical.lua:2> Está usando qual distro? Compartilhar este post Link para o post
luigilc 0 #7 Postado 10 Setembro, 2011 0.3.6pl1, uma função similar a essa q eu tenho aki é a getPosByDir mas eu usei ela e da erro otro erro Compartilhar este post Link para o post