nbb147 8 Postado Julho 14, 2012 Share Postado Julho 14, 2012 gente eu queria pedir para alguem adaptar esse spell para acertar dano no oponente, quando acertar o alvo, abaixo o script: local quantSqm = 3 -- quantidade de sqms function teleportPlayer(cid, position) if (isPlayer(cid)) then local o = 1 local positions = {} for i=1, quantSqm do if getPlayerLookDir(cid) == 0 then position = {x=position.x, y=position.y-1, z=position.z} elseif getPlayerLookDir(cid) == 1 then position = {x=position.x+1, y=position.y, z=position.z} elseif getPlayerLookDir(cid) == 2 then position = {x=position.x, y=position.y+1, z=position.z} elseif getPlayerLookDir(cid) == 3 then position = {x=position.x-1, y=position.y, z=position.z} end if isWalkable(position) then o = o+1 end positions[#positions+1] = position end if o > quantSqm then doTeleportThing(cid, position) for i=1, #positions do doSendMagicEffect(positions, CONST_ME_TELEPORT) end return true else doPlayerSendCancel(cid, "Você não pode atravesar isso!") return false end end end function isWalkable(pos, creature, pz, proj) -- nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end local creature = getTopCreature(pos) if creature.type > 0 then return false end if getTilePzInfo(pos) and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function onCastSpell(cid, var) if teleportPlayer(cid, getPlayerPosition(cid)) then return true end end Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/ Compartilhar em outros sites More sharing options...
0 lfelipebsilva05 14 Postado Julho 15, 2012 Share Postado Julho 15, 2012 tenta isso. vai em data>spells>spells.xml crie um arquivo com nome ninja.lua e cole isso : local config = { efeitoTele = 10, -- efeito q ira aparacer a cada teleport. efeitoDamage = 1, -- efeito q ira aparecer ao hitar no alvo hits = 5, -- quantos hits vai dar delay = 200, -- intervalo de tempo a cada hit min = 10000, -- dano minimo max = 15000, -- dano maximo damage = COMBAT_PHYSICALDAMAGE -- tipo do dano } function isWalkable(pos, creature, pz, proj) -- nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end if getTopCreature(pos).uid > 0 and creature then return false end if getTileInfo(pos).protection and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end function getPosDirs(p, dir) -- mkalo return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z} end function validPos(pos) tb = {} for i = 1, 8 do newpos = getPosDirs(pos, i) if isWalkable(newpos) then table.insert(tb, newpos) end end table.insert(tb, pos) return tb end spell = { start = function (cid, target, markpos, hits) if not isCreature(cid) then return true end if not isCreature(target) or hits < 1 then doTeleportThing(cid, markpos) doSendMagicEffect(getThingPos(cid), config.efeitoTele) return true end posAv = validPos(getThingPos(target)) rand = #posAv == 1 and 1 or #posAv - 1 doSendMagicEffect(getThingPos(cid), config.efeitoTele) doTeleportThing(cid, posAv[math.random(1, rand)]) doAreaCombatHealth(cid, config.damage, getThingPos(target), 0, -config.min, -config.max, config.efeitoDamage) addEvent(spell.start, config.delay, cid, target, markpos, hits - 1) end } function onCastSpell(cid) target = getCreatureTarget(cid) if target then spell.start(cid, target, getThingPos(cid), config.hits) end return true end agora vai em spells.xml e cole isso : <instant name="ninja" words="ninja" lvl="9" mana="20" aggressive="0" selftarget="1" exhaustion="1000" needlearn="0" event="script" value="ninja.lua"> <vocation id="1"/> <vocation id="2"/> <vocation id="3"/> <vocation id="4"/> <vocation id="5"/> <vocation id="6"/> <vocation id="7"/> <vocation id="8"/> </instant> AJUDEI?REP+ Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1293165 Compartilhar em outros sites More sharing options...
0 nbb147 8 Postado Agosto 5, 2012 Autor Share Postado Agosto 5, 2012 muito massa essa spell mais ainda nao é isso que eu quero eu quero que o personagem teleporte no sqm do oponente e tire o dano apenas um teleport Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1309735 Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Agosto 5, 2012 Share Postado Agosto 5, 2012 (editado) Script function onCastSpell(cid, var) local player = getCreaturePosition(cid) local target = getCreatureTarget(cid) local enemypos = getCreaturePosition(target) if target == isMonster or isCreature then doTeleportThing(cid, enemypos) doSendMagicEffect(enemypos, 2) end end Arquivo xml: <instant name="ninja" words="ninja" lvl="9" mana="20" prem="0" range="8" casterTargetOrDirection="1" blockwalls="1" exhaustion="1000" needlearn="0" event="script" value="ninja.lua"> <vocation id="1"/> <vocation id="2"/> <vocation id="3"/> <vocation id="4"/> <vocation id="5"/> <vocation id="6"/> <vocation id="7"/> <vocation id="8"/> </instant> Editado Agosto 5, 2012 por Newtonnotwen Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1309776 Compartilhar em outros sites More sharing options...
0 nbb147 8 Postado Agosto 6, 2012 Autor Share Postado Agosto 6, 2012 nao, funcionou Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310911 Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Agosto 6, 2012 Share Postado Agosto 6, 2012 Da algum erro? Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310922 Compartilhar em outros sites More sharing options...
0 nbb147 8 Postado Agosto 6, 2012 Autor Share Postado Agosto 6, 2012 (editado) sim, olhai: [06/08/2012 00:24:58] [Error - Spell Interface] [06/08/2012 00:24:58] data/spells/scripts/test.lua:onCastSpell [06/08/2012 00:24:58] Description: [06/08/2012 00:24:58] (luaGetThingPosition) Thing not found Editado Agosto 6, 2012 por nbb147 Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310935 Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Agosto 6, 2012 Share Postado Agosto 6, 2012 Qual? Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310941 Compartilhar em outros sites More sharing options...
0 nbb147 8 Postado Agosto 6, 2012 Autor Share Postado Agosto 6, 2012 o erro es no post anterior Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310945 Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Agosto 6, 2012 Share Postado Agosto 6, 2012 (editado) Script by: Jhon992 local distanceCombat = createCombatObject() setCombatParam(distanceCombat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) setCombatParam(distanceCombat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SPEAR) function getSpellDamage(cid, lv) damage_min = lv * 2 damage_max = lv * 1 if(damage_max < damage_min) then local tmp = damage_max damage_max = damage_min damage_min = tmp end return -damage_min, -damage_max end setCombatCallback(distanceCombat, CALLBACK_PARAM_SKILLVALUE, "getSpellDamage") function onCastSpell(cid, var) local target = getCreatureTarget(cid) local enemypos = getCreaturePosition(target) if isMonster(target) or isCreature(target) then if verificaPos(cid, enemypos, var) == false then doPlayerSendCancel(cid, "Position not valid.") return false else return true end else doPlayerSendCancel(cid, "You need a taget.") return false end end function verificaPos(cid, enemypos, var) local positions = {} local player = getCreaturePosition(cid) for i=-1, 1 do for j=-1, 1 do local position = {x=enemypos.x+i,y=enemypos.y+j,z=enemypos.z} if isWalkable(position) then positions[#positions+1] = position end end end if #positions > 0 then doTeleportThing(cid, positions[math.random(1,#positions)]) doSendMagicEffect(player, 61) return doCombat(cid, distanceCombat, var) else return false end end function isWalkable(pos, creature, pz, proj) -- nord if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end local creature = getTopCreature(pos) if creature.type > 0 then return false end if getTilePzInfo(pos) and not pz then return false end local n = not proj and 3 or 2 for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then return false end end end return true end ---------------------------------------Editado Estou indo dormir, testa ae o script e me fala se funcionou amanhã vejo. Editado Agosto 6, 2012 por Newtonnotwen Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310953 Compartilhar em outros sites More sharing options...
0 nbb147 8 Postado Agosto 6, 2012 Autor Share Postado Agosto 6, 2012 ta quase do jeito que eu quero so ta faltando duas coisas o player aparecer no msm sqm do oponente, e ta faltando o efeito de quando ele player acerta o dano no oponente Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310970 Compartilhar em outros sites More sharing options...
0 Newtonnotwen 80 Postado Agosto 6, 2012 Share Postado Agosto 6, 2012 Amanhã faço pra você, to indo dormir. Flws! Link para o comentário https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/#findComment-1310973 Compartilhar em outros sites More sharing options...
Pergunta
nbb147 8
gente eu queria pedir para alguem adaptar esse spell para acertar dano no oponente, quando acertar o alvo, abaixo o script:
Link para o comentário
https://xtibia.com/forum/topic/189741-spell-de-teleporta-e-acerta-dano/Compartilhar em outros sites
11 respostass a esta questão
Posts Recomendados