Spellmaking guide

To make your first spell, start by creating a text file called "SpellName.txt," in which "SpellName" is the name of your spell (such as "Fireball.txt" for a fireball spell. Note that if your computer automaticly hides file extensions, the file may appear as simply "Fireball" and there is no need to append ".txt" in this case.)
Let's make a fireball spell as an example.
Once you've created "Fireball.txt," open the file. The content of the file will be the commands for your spellthey occur in the order they are written, much like events.
Each command should be entered in the following format:

DELAY COMMAND_NAME PARAMETERS

DELAY is the amount of time in milliseconds (thousandths of a second) before that command is carried out. (This is the same as events)
COMMAND_NAME is what action will be performed. There is a list of these below this starting guide.
PARAMETERS can be one or more space-separated words that define the specifications of the command being used. These vary based on the COMMAND_NAME and are also detailed below in the starting guide.

In our fireball spell, we might want to make the first command check to see if the user has enough mana. We would do so with the command

0 intCost 25

which would wait 0 milliseconds before carrying out the intCost command, which checks if the user has a certain amount of mana (in this case, 25).

After that, we presumably want our spell to throw a fireball. This command is a little more complex:

0 projectile 60 magic_fireball 0|0|0 1.0

Like the previous command, this one has a delay of 0 and will be carried out immediately; but since it's written after our first command, the mana check will happen first.
After waiting 0 milliseconds, the spell will carry out the projectile command, which fires a projectile according to the parameters we set. In this case, the initial velocity is 60, the name of the projectile is magic_fireball, the direction will be randomized by 0 in the x, y, and z directions (i.e., it will not be randomized), and will have a size of 1.0.

Let's say we wanted to change the fireball a little, by making it bigger, for example. We'd change one of the parameters, in this case the size, like this:

0 projectile 10 magic_fireball 0|0|0 3.0

This will make a fireball three times as big as our first. Similiarly, this

0 projectile 10 magic_fireball 10|10|10 1.0

Would create a fireball that is wildly innacurate in all directions.

Our finished spell looks like this:

0 intCost 25
0 projectile 60 magic_fireball 0|0|0 1.0
 
Place the file into the /spells/ folder of your Spell add-on.
When you enable your spell add-on, all the spell files in the /spells/ folder will be loaded in automatically.
To test your spell, event a brick with the client>buySpell event, and enter the name of the spell you created. From then on, you can cast that spell with the /cast <SpellName> command.


RANDOM FACTS

Manaburn - Using a command called taxMana, it is possible for your mana to reach below-zero conditions. When you are below zero mana, you take damage while your mana recharges to a level above zero. This effect is called manaburn.


LIST OF COMMANDS

intCost - INT Amount of mana to check and remove from the player. If the amount cannot be paid, the spell is cancelled and no mana is paid. Syntax: intCost <X> in which X is the required amount of mana.
intCostNoReduction - INT Amount of mana to check the player for. If the amount could not be paid, the spell is cancelled.
taxMana - INT Amount of mana to be removed from the player. This amount will always be paid. See Manaburn.

projectile <int> <string> <vector> <float> 
INT Initial velocity of the projectile. STRING Name of the projectileData Datablock to be spawned. VECTOR Parameters for randomized velocity from caster. FLOAT Scale of the projectile.

explode - STRING Name of the projectileData Datablock to be used, the explosion will be the explosion assigned to that projectile. FLOAT Scale of the explosion.

radiusDamage - INT Radius of the damage in TU. INT Damage to be inflicted on affected targets. BOOL Whether or not the caster will be affected.
radiusBurn - INT Radius of the burn in TU. INT Duration of the burn in seconds. BOOL Whether or not the caster will be affected.
radiusFreeze - INT Radius of the freeze in TU. INT Duration of the freeze in seconds. BOOL Whether or not the caster will be affected.

addHealth - INT Amount of health to be added to the player (negative value will deal damage).
protection - STRING Type of protection 'direct' or 'reduction'. INT or FLOAT Magnitude of specified effect, INT for direct, FLOAT for reduction. INT Duration of shields in seconds.
fortifyMana - INT Amount of mana to be fortified. INT Duration of effect in seconds.
setSpellDelay - INT Time in seconds to delay the next spell cast, 0 will allow new spells to be cast immediately (don't do this). NOTE: The default spell delay is half a second.
setScale - FLOAT Scale to set the player to.

playSound - STRING Name of the audioData datablock to be played.
clientPlaySound - STRING Name of the audioData Datablock to be played.

effect - 

scriptEffect - STRING Name of function to be called. STRING 'client' or 'player' or 'closestplayer' as target to be called. NOTE: calls functionname(target);


LIST OF DEFAULT CONTENT (datablocks for you to use)

