We're going to go over how to create a very simple summon follower spell that will move your follower to the player, play a sound and show an effect, and then display a message upon the spell's completion.
Making the Summon Spell
Alright. It's pretty simple. All we need to do is create one magic effect, one spell, and one script attached to the magic effect. So first we'll create the magic effect. This does all the heavy lifting - it contains the script, the effects, etc. So navigate to the Magic Effects category (Magic>Magic Effect), and in the right-hand side of the Object Window right click and select New. Give your Magic Effect whatever ID you like, as well as whatever name you want.
It's type should be Script, and it should be on Self. No conditions are necessary. You can make the visual effects whatever you like. Create a new script in the bottom right corner, and name it how you like it. Mine will be called TestFollowerSummonScript, and we're going to pretend I have a follower I want to summon named Benjy. You'll also need to create a new message (preferably messagebox) that will be shown when your follower is summoned. To do this, go to Miscellaneous>Messages, and create a new message (right click and select New). Then you'll need to fill your message property in the script, which looks like this:
It's type should be Script, and it should be on Self. No conditions are necessary. You can make the visual effects whatever you like. Create a new script in the bottom right corner, and name it how you like it. Mine will be called TestFollowerSummonScript, and we're going to pretend I have a follower I want to summon named Benjy. You'll also need to create a new message (preferably messagebox) that will be shown when your follower is summoned. To do this, go to Miscellaneous>Messages, and create a new message (right click and select New). Then you'll need to fill your message property in the script, which looks like this:
Scriptname TestFollowerSummonScript Extends ActiveMagicEffect
Actor Property BenjyFollower Auto
;be sure to fill this property
Message Property SummonMessage Auto
;be sure to fill this property
Bool Ready = True
Event OnEffectStart(Actor akTarget, Actor akCaster)
If Ready; if we're ready
BenjyFollower.MoveTo(Game.GetPlayer(), 5, 0, 5, true)
SummonMessage.Show()
Ready = False
Utility.Wait(3.0)
Ready = True
EndIf
EndEvent
So first we have the usual declaration of the script's name. Then we have a property that should point towards our follower, Benjy. We have another property that points to the message so it can be displayed, and a boolean variable called Ready. What Ready does is make sure that we can't spam the summon follower, which could result in messageboxes popping up a lot. You can remove this if you like, since it's not entirely necessary because your spell will likely need to be recharged.
Then we have an If check which makes sure that Ready is true. You can remove this if you don't want the spam-check. Once we've made sure it is, then we move Benjy to the player, with an offset of 5 units (x and z, since we don't want them to be floating we don't touch y) so he doesn't go inside of the player. Then, once he's been summoned properly, we show the message, change Ready to false so the spell can't be spammed for 3 seconds, and then change Ready to true again.
Now we need to attach our magic effect to a spell. So press OK and exit your magic effect, then go to Magic>Spells and create a new one. Name it whatever you like. You can make it's type whatever you like. I usually go with Lesser Power, but Spell or any other works fine. Make the effect the same one we just created by right clicking in the effects table and selecing Add/New and then choosing your effect from the dropdown in the effect's window. If you want any conditions on your spell, put them there, but mine won't have any. Now close your spell - and you're done! Go ahead and test it in-game.
Then we have an If check which makes sure that Ready is true. You can remove this if you don't want the spam-check. Once we've made sure it is, then we move Benjy to the player, with an offset of 5 units (x and z, since we don't want them to be floating we don't touch y) so he doesn't go inside of the player. Then, once he's been summoned properly, we show the message, change Ready to false so the spell can't be spammed for 3 seconds, and then change Ready to true again.
Now we need to attach our magic effect to a spell. So press OK and exit your magic effect, then go to Magic>Spells and create a new one. Name it whatever you like. You can make it's type whatever you like. I usually go with Lesser Power, but Spell or any other works fine. Make the effect the same one we just created by right clicking in the effects table and selecing Add/New and then choosing your effect from the dropdown in the effect's window. If you want any conditions on your spell, put them there, but mine won't have any. Now close your spell - and you're done! Go ahead and test it in-game.
Adding the Spell to the Game
You might have noticed we didn't actually do anything to add the spell to the game, so you can't really test it (well, you could use console codes, but that's not really how we want to do this). I'm going to go over three ways to add this spell to the game.
On Game Start
One way to do it would be to add the spell to the player as soon as they start the game. To do this, we need to create a quest. So go to Character>Quests, and create a new quest. Give it an ID you like, leave the Type as NONE (so it won't show up as an actual quest), and name it however you like. Make sure only Run Once and Start Game Enabled are checked. Then press OK to close it. Now find it, and reopen it. This lets the quest data register so you can actually start editing the quest.
We're going to create an alias for the player which will add the spell to the player as soon as they start or load a new game. So go to the Quest Aliases tab, then create a new Reference Alias (right click, new reference alias). Name it PlayerAlias, and ignore all the widgets, boxes, and other stuff. Click the circle next to Specific Reference, click the big rectangle that says Forced: NONE, and it should open up a new window. Where it says cell, choose (any) from the dropdown, and it should default to PlayerRef in the second dropdown. If it doesn't, find the Player in the second dropdown and click OK.
Now we add the script. Click Add in the scripts area in the right-hand side of the alias window, and create a new script. I'll call mine TestSummonSpellAddScript, though yours may be whatever you want. It should look something like this:
We're going to create an alias for the player which will add the spell to the player as soon as they start or load a new game. So go to the Quest Aliases tab, then create a new Reference Alias (right click, new reference alias). Name it PlayerAlias, and ignore all the widgets, boxes, and other stuff. Click the circle next to Specific Reference, click the big rectangle that says Forced: NONE, and it should open up a new window. Where it says cell, choose (any) from the dropdown, and it should default to PlayerRef in the second dropdown. If it doesn't, find the Player in the second dropdown and click OK.
Now we add the script. Click Add in the scripts area in the right-hand side of the alias window, and create a new script. I'll call mine TestSummonSpellAddScript, though yours may be whatever you want. It should look something like this:
Scriptname TestSummonAddSpellScript extends ReferenceAlias
Spell Property SummonFollowerSpell Auto
Event OnInit()
Utility.Wait(1.0)
Self.GetActorReference().AddSpell(SummonFollowerSpell, false)
EndEvent
It's a pretty simple script. There's a property for your summon spell (be sure to fill this), and then an event. OnInit runs when the script is initialized, which, in our case, will be when the game starts or when you first load the game with your mod (since our quest is Start-Game Enabled, it will be started when the game starts). Run Once makes sure the OnInit event isn't fired twice, which usually happens unless you tick that box. Then we use Utility.Wait, which will wait for 1 second. Why is this necessary?
Because otherwise, as soon as you start a new game, before you've even chosen your character, the spell will be added. Which, from my testing, doesn't actually work. Wait waits until you are no longer in a menu, and then Waits one second. This stops the rest of the code from running before it's supposed to.
Self.GetActorReference() will get the actor the script is on, in this case the player. AddSpell adds the spell within it's parameters, and false makes sure there's no notification like "Spell Added" in the upper left hand corner when the spell is added.
Because otherwise, as soon as you start a new game, before you've even chosen your character, the spell will be added. Which, from my testing, doesn't actually work. Wait waits until you are no longer in a menu, and then Waits one second. This stops the rest of the code from running before it's supposed to.
Self.GetActorReference() will get the actor the script is on, in this case the player. AddSpell adds the spell within it's parameters, and false makes sure there's no notification like "Spell Added" in the upper left hand corner when the spell is added.
Once You Get Your Follower
If you only want to get the spell once you've hired or gotten your follower, that's even easier. Find the piece of code where your follower becomes your follower (likely in a dialogue fragment, though maybe in a stage or any other piece of code), and add a spell property. I'm going to call mine FollowerSummonSpell, though yours may be what you like. Then add this snippet of code after the code that makes your follower your follower:
Game.GetPlayer().AddSpell(FollowerSummonSpell, false)
This will add the spell within the AddSpell parameters to the player. The spell added is the spell your spell property points to, and the false part makes sure there is no text that says something like "Spell Added" when the player recieves the spell.
Spell Tome
You can also create a spell tome that will teach your character the spell. This isn't too difficult and only takes a bit of time.
Navigate to Items>Books, and create a new book. I actually recommend duplicating a currently existing spell tome, since then you don't have to choose all the texture paths and mesh paths. So I'll duplicate the spell tome for Conjure Familiar, and then right click and Edit my duplicate. You can change the ID to what you want, but for the name I recommend something along the lines of "Spell Tome: Summon Follower". In the area where the text is, replace the text with something simple like "Summon Follower". It's almost impossible to see the actual content of the book, but most spell tomes have the name of the spell written in them so I recommend it as well.
Choose your summon follower spell from the Teaches Spell dropdown, press OK, do NOT create a new form, and you're done.
What type of tutorial would you like to see next?
Navigate to Items>Books, and create a new book. I actually recommend duplicating a currently existing spell tome, since then you don't have to choose all the texture paths and mesh paths. So I'll duplicate the spell tome for Conjure Familiar, and then right click and Edit my duplicate. You can change the ID to what you want, but for the name I recommend something along the lines of "Spell Tome: Summon Follower". In the area where the text is, replace the text with something simple like "Summon Follower". It's almost impossible to see the actual content of the book, but most spell tomes have the name of the spell written in them so I recommend it as well.
Choose your summon follower spell from the Teaches Spell dropdown, press OK, do NOT create a new form, and you're done.
What type of tutorial would you like to see next?