local config = {
runeName = "Teleport Rune",
runeId = 2275,
level = 100, -- Level to use the rune
magicLevel = 5, -- Magic level to use the rune
cooldown = 1, -- Cooldown before you can use the rune again (seconds)
magicEffect = CONST_ME_MAGIC_BLUE, -- Effect on target
position = Position(1000, 1000, 7), -- Location to get teleported to
}
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, config.magicEffect)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
local rune = Spell(SPELL_RUNE)
function rune.onCastSpell(creature, variant, isHotkey)
local target = Creature(variant:getNumber())
if target == creature then
creature:sendCancelMessage("You can not use this rune on yourself.")
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
return false
end
creature:teleportTo(config.position)
creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
return combat:execute(creature, variant)
end
rune:name(config.runeName)
rune:runeId(config.runeId)
rune:level(config.level)
rune:magicLevel(config.magicLevel)
rune:id(220)
rune:group("support")
rune:cooldown(config.cooldown * 1000)
rune:groupCooldown(2000)
rune:needTarget(true)
rune:isAggressive(false)
rune:allowFarUse(true)
rune:vocation("sorcerer")
rune:register()