Skip to content

CombatLib Part 10: Magic Items

ThePix edited this page Jan 29, 2018 · 3 revisions

This continues from this page, and assumes you have installed the libraries in your game, have some basic equipment, three goblins and some simple spells in your game.

In this part we will create some magic items.

Healing Potions

Healing potions restore the player to full health. Just create an item, and on the Combat tab, set the type to "Healing potion". You might want to set a price too.

Scrolls

Scrolls are much like instant spells; they have an instant effect and then they are done. They will also stop any on-going spell effect. It is set up just the same, by adding a suitable script. All the examples from the Instant Spells page should work here too.

Magic Items

Magic items are things you can wear and that give you a bonus whilst worn. Like all worn items, only one can be worn in each slot, as per the rules for clothing (they all go in the wear layer 10).

Rings and Talismans

These are magic items where most of the work has been done already. Select either "Ring" or "Talisman" as the type, give it a level, this will be the value of the bonus. Then select the attribute it will boost.

Rings go in a wear slot called "ring", whilst talismans use "amulet".

Magic Items

A magic item is a more general form of the ring or talisman. You can choose any wear slot (or several). You can also give your own script that fires when the ring is put on, and a reverse script that fires when the ring is taken off.

Whilst the scroll is much like an instant spell, the magic item is like the lasting spell, and the same scripts should work fine (though unlike scrolls, using a magic item will not cancel on-going spells). Note that there is no "Cannot hold anything" option here; it would make no sense for a ring.

Potions

Potions work similar to magic items and lasting spells. Unlike items, they will terminate any on-going spell, and casting another spell will terminate their effects.

As with lasting spells and magic items, you require two scripts, one to turn the effect on, one to turn it off. The same code should work fine.

You can have the player unable to hold anything for the duration of the effect, so a potion of wolf-form should be easy enough using the scripts from the previous page. As potions can be taken by anyone regardless of their magic prowess, it is a good idea to have them only last a limited number of turns; the default is 7.

Next...

In the next part we will look at the character creation process.

Clone this wiki locally