Spells are done by triggers, a typical example is that you got a Wapgate which is something like the "Spell-center" build zealot for spell 1, dragoon for spell 2...
The triggers often looks like this:
Condition: Current player brings at least 1 Zealot to Location X
Action: Preserve Trigger
Action: Remove 1 Zealots for Current Player at Location X
Action: Set Hitpoints for UNIT owned by Player X at Location Y to 100%
Action: Create 1 Carrier at Location Z for Player X [Z =a location which is always centerd on the hero of the player]
Action: Kill 1 Carrier for Player X
That trigger will effect that your "hero" (or "mage") will get 100% hitpoints as soon as he trained a zealot.
You can set mana costs by Gas (like in temple siege), just add a trigger which adds 1 gas for player X all Y seconds. Set those unit-prices to any Gas-Value you want.
Well, that's it.
Here is a list of often used actions as spells:
Create Unit (for example for Necromancer, or hallucinations)
Set Hitpoints (for heal spells or negative spells against enemys)
Set Energy (for getting full unit-mana or setting enemy's mana to 0 or whatever you want)
Move Unit (Moving a unit to a invalid location (not walkable) will make it stuck, so it cannot move any longer. Can cause lagg ingame (especially with air units, by air units you have to block the location, too)
Kill Unit (May be imbalanced, but maybe as a final spell against low NPCs)
Please report errors in the Staredit.Network forum.