Jump to content
⚠ Known Issue: Media on User Profiles ×

Actor Magnet Tutorial


Recommended Posts

Actor Ball / Katamari Dovahkiin Creation Tutorial

 

I've gotten a surprising number of requests for an explanation of how my Actor Magnet spell works, so I thought I'd write a tutorial about it. Really, there's nothing particularly groundbreaking about Actor Magnet. It just uses simple techniques in an unusual way.

 

This tutorial assumes you already have a passing familiarity with the Creation Kit (i.e. you've run through the basic tutorials on the Creation Kit wiki) and are looking to learn more about how to use and abuse the magic system.

 

During development of this mod I was calling the spell ActorBall and all the spells/effects/scripts are named accordingly. There are also some questionable naming conventions here, as I was building it in a hurry and didn't take the time to go back and rename everything. In other words, this is not neat and pretty :wink:

 

If you follow this tutorial, you should end up with a working duplicate of my Actor Magnet spell as posted to the Workshop and Skyrim Nexus. These are the original scripts. If you already have my Actor Magnet mod installed, either remove it first or name everything with a different prefix to avoid conflicts.

 

Actor Magnet actually consists of three different Spells and their associated MagicEffects.

 

 

  1. First we have the effect itself, ActorBallEffectSpell, which targets all Actors within the spell radius with the PushActorAway function. The Player is exempted and serves as the source of PushActorAway.
  2. Second, we have ActorBallAbility. This is an ability spell which, while the player "knows" it, continuously recasts ActorBall while providing visual and sound effects.
  3. Third, we have the ActorBallSpell spell. This is the spell the player actually casts. It is just a script that toggles the Magnet on and off by adding or removing the ActorBallAbility.

Part 1: The Effect

 

We're going to create the actual Actor Magnet effect first. For this, we are going to need a new MagicEffect, so let's create one! Launch Creation Kit and open the Skyrim and Update esm files in the usual manner. Pick Magic Effect in the Object Window, right click somewhere on the right side and choose New.

 

Here's a screenshot of the ActorBallEffect properties:

http://i.imgur.com/kvGn1.png

 

Right away you'll notice a few atypical things about this spell. For starters, there are no visual effects or sounds set up. This spell is going to be spammed about 10 times a second; flashy visual effects are a not a good thing to play that frequently. The Delivery is to Self, because the player is going to be the actor the spell is pushing everyone else toward. I have no Magic Skill set because otherwise the player will level very quickly; remember, this is going to be cast multiple times a second. The Effect Archetype is Script: This simply tells the game that the spell is scripted and no other effects need to be applied. Casting time is zero (although, as we'll see, that doesn't really matter).

 

The spell is not flagged as Hostile or Detrimental, which keeps it from ticking off city guards, citizens, and other allies.

 

Area is 2500. That's in feet (rather than the usual Skyrim units) so that's over half a mile in real-world terms. That's way beyond the draw distance in most cases, and ensures the moment an Actor is loaded it will be hit by the spell.

 

Now to the heart of the spell, the script. Click the "Add" button in the bottom right corner, double-click "New Script" and call it "ActorBallEffectScript". Here is the code, it's quite short:

 

Scriptname ActorBallEffectScript extends ActiveMagicEffect  

Actor Player

Event OnEffectStart(actor Target, actor Caster)
Player = Game.GetPlayer()
If Target != Player
 If Target.GetDistance(Player) > 2000
  Caster.PushActorAway(Target, -8)
 Else
  Caster.PushActorAway(Target, -5)
 EndIf
EndIf
EndEvent

 

That's it! This script is pretty easy to interpret. It uses the OnEffectStart event (which fires when the spell is cast) to apply the PushActorAway function to the caster and target. Notice we're using a negative value, which is why the target actor flies toward the caster rather than away from him. You also see that, beyond a certain distance, we're actually applying more force. This is because I was running into problems with far-off Actors not getting pushed uphill or over small obstacles like low fences. I'm not sure why this was happening, but applying a touch more force seemed to cover it. A lot of scripting time can be spent overcoming little oddities like this.

 

Compile/Save this script, close the scripting window, hit Ok, and save your mod.

 

Now that we have the Magic Effect, we need to create a Spell so we can cast it! Go to Spells on the Object Window, right click on the right panel, choose new. Here are the settings:

 

The Casting type and Delivery method must match those of the Magic Effect we just created, in this cast, Fire and Forget and Self, respectively. To add the Actor Ball Effect to the list of Effect, right-click the list, choose New, and pick ActorBallEffect from the drop-down list.

 

http://i.imgur.com/fpD59.png

 

Now fill in the magnitude and duration as 1 each. DO NOT FORGET TO FILL IN THE MAGNITUDE. This is a purely scripted spell, so the magnitude is not important but it MUST BE GREATER THAN 0. If it is 0, the spell will fail silently and you will go CRAZY trying to figure out what you did wrong. Ask me how I know this.

 

Your spell setup should now look like this:

http://i.imgur.com/V8Ncg.png

 

If the Area for Actor Ball Effect says 0, double-click it to edit the effect, then cancel. That should correct the Area value. Now hit Ok and save your mod.

 

At this point, you can play Skyrim, use the console command psb (Player Spell Book) to add all spells to your spellbook, find Actor Ball on the list and try casting it. It SHOULD yank all actors in the area toward you, just once per cast. If this doesn't work, run through the previous steps and see what you missed! CHECK THE MAGNITUDE!

 

Now on to part two, creating the Actor Magnet Ability!

 

Part 2: The Ability

 

An Ability is a particular type of spell that applies its effect as soon as the player "learns" it. Abilities are used for everything from simple visual effects (the fog effects surrounding a Frost Atronach are provided by an Ability) to race-specific traits like WaterBreathing. In this case, we're going to use an ability that casts the spell we just created over and over again.

 

Create a new Magic Effect. Here are the settings for it:

http://i.imgur.com/uN7G0.png

 

I used the IllusionPosFXBody hit effect to provide a visual effect when the Magnet is activated, and the IllusionPositiveFX shader to make the player glow green while the Magnet is running. The FX Persist flag makes sure the shader plays throughout the duration of the spell. Again, all casting costs are 0 and the effect is not part of an particular Magic Skill. Let's create the script. Name it ActorBallAbilityScript. Here is the code:

 

Scriptname ActorBallAbilityScript extends ActiveMagicEffect  
Import Utility

Spell Property ActorBallEffectSpell auto
Sound Property OBJEyeofMagnusCloseLowLPM auto

Bool Running = True
Int SoundInstance = 0

Event onEffectStart(ACTOR akTarget, ACTOR akCaster)
Debug.Notification("Actor magnet activated!")
SoundInstance = OBJEyeofMagnusCloseLowLPM.Play(akTarget)
While Running
 ActorBallEffectSpell.Cast(akTarget)
Wait(0.1)
EndWhile
EndEvent

Event onEffectFinish(ACTOR akTarget, ACTOR akCaster)
Debug.Notification("Actor magnet deactivated!")
Running = False
Sound.StopInstance(SoundInstance)
EndEvent

 

Again, the script is fairly simple. When it starts, it displays text indicating that the Magnet is activated, plays a looping sound effect, and starts a conditional loop. This is where the rapid recasting of Actor Magnet takes place. The wait time of 0.1 seconds provides a powerful pulling effect without bogging down the system too much.

 

When the onEffectFinish event fires (when the ability is removed from the Player), the Running bool is set to False, which kills the loop. We then stop the sound effect loop (for more info on sound handling, see the wiki article here: http://www.creationk...om/Sound_Script).

 

If I were creating this today, I'd probably use Updates instead of the loop, but it works fine as written.

 

After saving the script, you'll need to populate the properties. If you've followed this tutorial to the letter, you should be able to autofill the properties. Do this by double-clicking the script in the Magic Effect window, then hit "Auto-fill All". It should say "2 properties auto-filled". If you used different names or the auto-fill fails, just pick the Actor Ball Effect spell you created in part 1 for the ActorBallEffectSpell property, and pick the looping sound of your choice for the sound property (the effect I used for it is a low, almost electric droning sound faintly reminiscent of the Hypnotoad).

http://i.imgur.com/2FFBL.png

 

Once you've got the properties filled in, hit ok and save your new Magic Effect.

Now we need to create the actual Ability Spell, so save your mod and create a new spell. Fill it in like this:

http://i.imgur.com/72gYe.png

 

The Spell Type is Ability, which will cause the OnEffectStart event to fire as soon as the ability is added to the player with AddSpell. Add the new Actor Magnet Ability to the effect list just like we did before. Don't forget to set the Magnitude to 1! Now save your new spell.

 

We're nearly done!

 

Part 3: The Toggle

 

Create another new Magic Effect. Here are the settings:

http://i.imgur.com/RLksk.png

 

Here we're setting it up more like a normal spell, because this is the spell you'll actually cast to turn the Magnet on and off. We have finally set the Skill as Alteration, and we're using straight Alteration sound effects and visuals. Remember, we set the Hit Effect in the Ability so we don't need one here. Now for the script...

 

Scriptname ActorBallScript extends ActiveMagicEffect  
{NaaaNaNaNaNaaNaaNaNaNaNaaaNaaaaNaNaNaaaa}

Spell Property ActorBallAbility auto

Event OnEffectStart(actor Target, actor Caster)
If Target.HasSpell(ActorBallAbility)
 Target.RemoveSpell(ActorBallAbility)
Else
 Target.AddSpell(ActorBallAbility,False)
EndIf
EndEvent

 

Once again, pretty simple stuff. If the player doesn't have the ActorBallAbility spell, we add it to them. If they do, we remove it. It's a toggle. Set the Spell Property to the Ability we created in step 2 and save the new Magic Effect.

 

Now create a new Spell. Here are the settings:

http://i.imgur.com/oyePM.png

 

The spell is actually called Actor Magnet, because this is the only spell of the 3 that the player should see under normal circumstances. "Disallow absorb/reflect" is checked to avoid a bug that sometimes happens with self-targeted spells. The Menu Display Object is the graphic that will appear when you view the spell in the menu. In this screenshot it is set to the Fireball spell graphic; you may want to change it to one of the other MAGINV graphics. Add the Magic Effect we just created to the list, and don't forget to set the Magnitude to 1.

 

Go play!

 

NOW.... you can either start the game and use psb to add the spell to your inventory, or you can do what I do and create a tome for it. Creating the tome is very simple, just duplicate an appropriate tome (you'll probably want to use the tome for another Alteration spell) and change the spell it teaches you.

 

http://i.imgur.com/yrIEw.png

 

Now place the spell tome somewhere easy to reach, like the main hall of Dragonreach. For info on how to place items, see the Lokir's Tomb tutorial in the CK wiki.

 

Now get the spell and test out your own version of Actor Magnet!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...