Postado Abril 13, 2015 10 anos 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 Tag spells.XML(configure a gosto, use o mesmo para todos os scripts acima) : <instant name="NAME" words="NAME" lvl="1" mana="1" prem="0" aggressive="1" selftarget="0" exhaustion="1" group="attack" groupcooldown="1" needlearn="0" script="ARQUIVO.lua"> <vocation name="VOCATION NAME"/> </instant> Para adicionar a spell, só ir em data/spells/scripts criar um arquivo .lua para o script e adicionálo e dps ir em spells.XML colocando a tag, configurada de acordo com a spell em questão. Créditos Printer. Editado Abril 14, 2015 10 anos por Linus (veja o histórico de edições)
Postado Abril 13, 2015 10 anos Amigo seu conteúdo é muito bom mais poderia melhorar um pouco o tópico, adicionando um pequeno tutorial de como adicionar as spells e colocar os códigos em spoiler, pois tem muitos.
Postado Abril 14, 2015 10 anos Autor Colocar em spoiler buga a identação ... e não quero dar tudo na mão dos cara, pra eles ao menos ter o bom-senso de procurar aprender ou até mesmo de perguntar caso haja alguma dúvida e se isso acontecer eu estarei ensinando.
Postado Abril 14, 2015 10 anos Colocar em spoiler buga a identação ... e não quero dar tudo na mão dos cara, pra eles ao menos ter o bom-senso de procurar aprender ou até mesmo de perguntar caso haja alguma dúvida e se isso acontecer eu estarei ensinando. Aprovarei o tópico caso você adicione o XML e o tutorial pelo menos.
Postado Abril 14, 2015 10 anos Autor Pronto... se ainda não tiver dentro dos padrões, pode mover pra lixeira Editado Abril 14, 2015 10 anos por Linus (veja o histórico de edições)
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.