Furabio 257 Postado Abril 11, 2015 Share Postado Abril 11, 2015 (editado) AREA1 = { {0, 0, 0}, {0, 3, 0}, {0, 0, 0} } local function sendHealingEffect(cid, position, loopCount) local player = Player(cid) if not player then return end position:sendDistanceEffect(player:getPosition(), CONST_ANI_SMALLHOLY) player:addHealth(math.max(100, 150)) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) if loopCount == 0 then player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA) end end function onCastSpell(creature, var) local playerPos = creature:getPosition() local loopCount = 12 creature:say('Heal me my brothers!', TALKTYPE_MONSTER_SAY) for i = 1, loopCount do local position = Position(playerPos.x + math.random(-4, 3), playerPos.y + math.random(-3, 2), playerPos.z) addEvent(doAreaCombatHealth, i * 75, creature:getId(), COMBAT_PHYSICALDAMAGE, position, createCombatArea(AREA1), 0, 0, CONST_ME_ASSASSIN) addEvent(sendHealingEffect, i * 75, creature:getId(), position, loopCount - i) end return false end local function targetEffect(cid) local player = Player(cid) if not player then return end local effect = CONST_ANI_REDSTAR local orig = player:getPosition() local d1, d2 = {z = orig.z}, {z = orig.z} d1.x = orig.x - 5 d2.x = orig.x + 5 for i = -2, 2 do d1.y = orig.y + i d2.y = d1.y orig:sendDistanceEffect(d1, effect) orig:sendDistanceEffect(d2, effect) end d1.y = orig.y - 3 d2.y = orig.y + 3 for i = -4, 4 do d1.x = orig.x + i d2.x = d1.x orig:sendDistanceEffect(d1, effect) orig:sendDistanceEffect(d2, effect) end end local function backOldPosition(cid, oldPosition) local player = Player(cid) if not player then return end player:teleportTo(oldPosition) player:setGhostMode(false) end local function jumpEffect(cid, target) local player = Player(cid) if not player then return end local target = Creature(target) if target then player:getPosition():sendDistanceEffect(target:getPosition(), CONST_ANI_EXPLOSION) end end local function jumpOnTarget(cid, target, targetCount, oldPosition) local player = Player(cid) if not player then return end local target = Creature(target) if target then addEvent(targetEffect, 100, cid) player:teleportTo(target:getPosition()) player:setGhostMode(true) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_ASSASSIN) if targetCount == 0 then addEvent(backOldPosition, 400, cid, oldPosition) end end end local function extractRandomValuesFromTable(tbl) --By Printer(This will make sure not to select a value twice from the table) if #tbl == 0 then return false end return table.remove(tbl, math.random(#tbl)) end function onCastSpell(creature, var) local targets = {} local playerPos = creature:getPosition() local spectators = Game.getSpectators(playerPos, false, false, 0, 10, 0, 10) for i = 1, #spectators do local specs = spectators[i] if specs ~= creature and not specs:isNpc() then targets[#targets+1] = specs end end if #targets == 0 then creature:sendCancelMessage('There is no targets in sight.') playerPos:sendMagicEffect(CONST_ME_POFF) return false end local targetCount = #targets for i = 1, #targets do local randTarget = extractRandomValuesFromTable(targets) addEvent(jumpOnTarget, i * 400, creature:getId(), randTarget:getId(), targetCount - i, playerPos) addEvent(jumpEffect, i * 300, creature:getId(), randTarget:getId()) end return false end local function sendDistanceEffectDelay(cid, fromPos, toPos, effect) local player = Player(cid) if not player then return end fromPos:sendDistanceEffect(toPos, effect) end local function ninjaJumpDash(cid, target, oldPos, lastJump, back) local player = Player(cid) if not player then return end local target = Creature(target) if not target then player:setGhostMode(false) return end if lastJump then player:setGhostMode(false) end if back then player:teleportTo(oldPos) else player:teleportTo(target:getPosition()) end doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_THUNDER) end function onCastSpell(creature, var) local cid = creature:getId() local playerPos = creature:getPosition() creature:setGhostMode(true) addEvent(ninjaJumpDash, 0, cid, target:getId(), playerPos, false, false) addEvent(sendDistanceEffectDelay, 100, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY) addEvent(sendDistanceEffectDelay, 300, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY) addEvent(ninjaJumpDash, 400, cid, target:getId(), playerPos, false, true) addEvent(ninjaJumpDash, 600, cid, target:getId(), playerPos, false, false) addEvent(sendDistanceEffectDelay, 700, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY) addEvent(sendDistanceEffectDelay, 1000, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY) addEvent(ninjaJumpDash, 1100, cid, target:getId(), playerPos, false, true) addEvent(ninjaJumpDash, 1300, cid, target:getId(), playerPos, false, false) addEvent(sendDistanceEffectDelay, 1400, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY) addEvent(sendDistanceEffectDelay, 1700, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY) addEvent(ninjaJumpDash, 1800, cid, target:getId(), playerPos, true, true) return false end function isWalkable(cid, pos) local tile = Tile(pos) if not tile then return false end if tile:queryAdd(cid) == 1 and not tile:hasFlag(TILESTATE_PROTECTIONZONE) then return true end return false end local function jumpBehindTarget(cid, target) local player = Player(cid) local target = Creature(target) local targetPos = target:getPosition() local targetPositions = { north = Position(targetPos.x, targetPos.y-1, targetPos.z), east = Position(targetPos.x+1, targetPos.y, targetPos.z), west = Position(targetPos.x-1, targetPos.y, targetPos.z), south = Position(targetPos.x, targetPos.y+1, targetPos.z) } local targetDir = target:getDirection() if targetDir == NORTH then dir = targetPositions.south elseif targetDir == EAST then dir = targetPositions.west elseif targetDir == WEST then dir = targetPositions.east elseif targetDir == SOUTH then dir = targetPositions.north end return dir end local function oldPos(cid, oldPos) local player = Player(cid) if not player then return end player:teleportTo(oldPos) end local function checkHasTarget(cid, count, oldPos) local player = Player(cid) if not player then return end if count < 1 then player:setGhostMode(false) return end local target = player:getTarget() if target then local behindTarget = jumpBehindTarget(cid, target:getId()) if isWalkable(cid, behindTarget) then player:teleportTo(behindTarget) else player:teleportTo(target:getPosition()) addEvent(backOldPos, 100, cid, oldPos) end player:setDirection(target:getDirection()) player:setGhostMode(false) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -20, -100, CONST_ME_FIREATTACK) return true end addEvent(checkHasTarget, 1 * 100, cid, count - 1) end function onCastSpell(creature, var) local playerPos = creature:getPosition() creature:setGhostMode(true) playerPos:sendMagicEffect(CONST_ME_POFF) addEvent(checkHasTarget, 1 * 250, creature:getId(), 50, playerPos) return false end Créditos : Printer Editado Abril 11, 2015 por ScreaM Link para o comentário Compartilhar em outros sites More sharing options...
ScythePhantom 83 Postado Abril 16, 2015 Share Postado Abril 16, 2015 WOW! Me amarrei na segunda spell! Muito legal, parabéns. Link para o comentário Compartilhar em outros sites More sharing options...
VaizardX 9 Postado Maio 3, 2015 Share Postado Maio 3, 2015 (editado) Como fica o spells.xml ? @ EDIT Spells.xml tava certo aqui , só funciona para TFS 1.x Editado Maio 3, 2015 por VaizardX Link para o comentário Compartilhar em outros sites More sharing options...
chateadoagr 12 Postado Maio 3, 2015 Share Postado Maio 3, 2015 (editado) Como fica o spells.xml ? @ EDIT Spells.xml tava certo aqui , só funciona para TFS 1.x tags do spells.xml se for para todas as vocations <instant name="NOME DO ATAQUE" words="NOME DA SPELL" lvl="1000" mana="0" event="script" value="nome do arquivo.lua"> </instant> com tal vocation usa <instant name="NOME DO ATAQUE" words="NOME DA SPELL" lvl="1000" mana="0" event="script" value="nome do arquivo.lua"> <vocation id="0"/> </instant> Editado Maio 3, 2015 por chateadoagr Link para o comentário Compartilhar em outros sites More sharing options...
CaioValverde 1 Postado Maio 6, 2015 Share Postado Maio 6, 2015 Muito bom! Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados