List of Script Examples
From OpenTibia Fans
(Redirected from List of Examples/revscriptsys)
- These examples applies to revscriptsys, and will probably not work for your server.
Contents |
Spell Examples
Conjure Arrow
An implementation of the Conjure Arrow spell.
local conjureArrows = Spell:new("Conjure Arrows") conjureArrows.words = "exevo con" conjureArrows.vocation = {"Paladin", "Royal Paladin"} conjureArrows.level = 13 conjureArrows.mana = 100 conjureArrows.soul = 3 conjureArrows.product.id = 2544 conjureArrows.product.count = 10 conjureArrows.effect = MAGIC_EFFECT_MAGIC_ENERGY conjureArrows:register()
Magic Rope
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()
Protect Other
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 listener = registerOnDamageListener(event.target, protectFromDamage) wait(30000) stopListener(listener) end protect:register()
| Revscriptsys Reference |
|---|
| List of functions · List of Event Types · List of Examples |
| Lua Libraries - string · table · coroutine · math · IO · OS · Debug |
| Classes - Thing · Creature · Player · Actor · NPC · Item · Container · Teleport · Combat · Condition · Spell · Map · Tile · Town · House · Waypoint · Channel · Command · Vocation · Event · Enum · Thread |
| Events - OnAccountLogin · OnAttack · OnAdvance · OnConditionAdded · OnConditionExpired · OnConditionTick · OnChangeOutfit · OnDamage · OnDeath · OnEquip · OnHear · OnJoinChannel · OnKill · OnLeaveChannel · OnLoadItem · OnLogin · OnLogout · OnLook · OnLoseCreature · OnMove · OnMoveItem · OnSay · OnServerLoad · OnServerUnload · OnSpawn · OnSpotCreature · OnTimer · OnTurn · OnUseItem |

