This repository has been archived by the owner on Mar 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 150
List of Script Examples
René Mujica Moreau edited this page Jan 31, 2016
·
1 revision
An implementation of the Conjure Arrow spell.
local conjure_arrows = Spell:new("Conjure Arrows")
conjure_arrows.words = "exevo con"
conjure_arrows.vocation = "any"
conjure_arrows.level = 8
conjure_arrows.mana = 30
conjure_arrows.health = 3
conjure_arrows.effect = CONST_ME_MAGIC_BLUE
conjure_arrows.product.id = 2544
conjure_arrows.product.count = 15
conjure_arrows:register()
An implementation of the Magic Rope spell, which uses more advanced concepts for it's special effect.
local magic_rope = Spell:new("Magic Rope")
magic_rope.words = "exani tera"
magic_rope.vocation = "any"
magic_rope.level = 9
magic_rope.mana = 20
magic_rope.effect = CONST_ME_TELEPORT
function magic_rope:onBeginCast(event)
local caster = event.caster
local tile = map:getTile(caster:getPosition())
for spotid, _ in ipairs(otstd.ropespots) do
if tile:getGround():getID() == spotid then
return true
end
end
caster:sendCancel("Not possible.")
return false
end
function magic_rope:onFinishCast(event)
local caster = event.caster
local npos = caster:getPosition()
npos.y = npos.y + 1
npos.z = npos.z - 1
caster:moveTo(npos)
end
magic_rope:register()
A sample spell that halves all damage done to a player, casted like exura sio. And also removes five mana from the caster each time the protected player is hit.
local protect = Spell:new("Protect Player")
protect.mana = 50
protect.vocation = "any"
protect.level = 40
protect.words = "utevo protecto"
function protect:onBeginCast(event)
local target = getPlayerByName(event.param)
if target and event.caster:isInSight(target, false) < 6 then
event.target = target
return true
end
return false
end
function protect:onFinishCast(event)
local listener = nil
function protectFromDamage(damage_event)
damage_event.damage = damage_event.damage * 0.5
if not event.caster:removeMana(5) then
stopListener(listener)
end
end
local listener = registerOnDamageListener(event.target, protectFromDamage)
wait(30000)
stopListener(listener)
end
protect:register()