Ir para conteúdo

Líderes

Conteúdo Popular

Exibindo conteúdo com a maior reputação em 10/07/19 em todas áreas

  1. zipter98

    Spell teleport

    Fiz bem corrido aqui, talvez não funcione. local config = { effect = xxx, --Efeito. interval = 500 --Intervalo, em milésimos de segundo, entre os teleportes. } local combat, invisibility, outfit = createCombatObject(), createConditionObject(CONDITION_GAMEMASTER, -1, false, GAMEMASTER_INVISIBLE), createConditionObject(CONDITION_INVISIBLE, -1, false) setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE) function getDamage(cid, level, magic) return -(level * 5 + magic * 12), -(level * 5 + magic * 12 + 55) end setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "getDamage") function isWalkable(pos, creature, proj, pz)-- by 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 pz then return false, true end local n = not proj and 2 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 doSpellTeleport(cid, target, positions, original_position) if not isPlayer(cid) then return true elseif #positions < 1 or not isCreature(target) then doTeleportThing(cid, original_position) doRemoveCondition(cid, CONDITION_INVISIBLE) doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE) doPlayerSetNoMove(cid, false) return true end local index = math.random(#positions) local toPos = positions[index] if not isWalkable(toPos) then repeat table.remove(positions, index) index = math.random(#positions) toPos = positions[index] if #positions < 1 then doTeleportThing(cid, original_position) doRemoveCondition(cid, CONDITION_INVISIBLE) doRemoveCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE) doPlayerSetNoMove(cid, false) return true end until isWalkable(toPos) end doTeleportThing(cid, toPos) doSendMagicEffect(getThingPos(cid), config.effect) doCombat(cid, combat, numberToVariant(target)) table.remove(positions, index) addEvent(doSpellTeleport, config.interval, cid, target, positions, original_position) end function onCastSpell(cid, var) local target = variantToNumber(var) if not isCreature(target) then return doPlayerSendCancel(cid, "You need a target.") end local pos = getThingPos(target) local posis = { {x = pos.x + 1, y = pos.y + 1, z = pos.z}, {x = pos.x + 1, y = pos.y - 1, z = pos.z}, {x = pos.x - 1, y = pos.y + 1, z = pos.z}, {x = pos.x - 1, y = pos.y - 1, z = pos.z} } doAddCondition(cid, invisibility) doAddCondition(cid, outfit) doPlayerSetNoMove(cid, true) doSpellTeleport(cid, target, posis, getThingPos(cid)) return true end
    1 ponto
Líderes está configurado para São Paulo/GMT-03:00
×
×
  • Criar Novo...