Common Modding Questions: Skyrim Modding Tutorial (2024)

Common Modding Questions: Skyrim Modding Tutorial

7/7/2015

22 Comments

This tutorial covers a few ways to achieve certain functions in the CK. I've focused on issues that are relatively common, or ones that are usually left unanswered, especially ones that I struggled with myself. You can view this as a list of smaller tutorials on fairly small subjects. I'll expand this post as I find more problems on theSkyrim Nexus Forums(modding only).

The included tutorials are on the following subjects: Making An NPC Attack in Dialogue, How to Change Attack Speed for a Weapon, Creating a New Combat Style, Making a One-Time Event Via Script, and Adding Items to a Container Via Script. You can find a tutorial oncreating compatibility patcheselsewhere.


We use the terms CK, mod, branch, topic, info and response. The CK is the Creation Kit, the tool used to modify Skyrim. A mod is a modification to the game, a branch is a collection of topics; a topic is a collection of infos; an info is a collection of responses put together for a single circ*mstance. A response is a single line of dialogue.

Now that that's out of the way, let's start.

Making NPC's Attack in Dialogue

This tutorial can teach you how to use dialogue to initiate combat with the player, or other NPC's. A good example of this the encounter with the Old Orc. (Skip to step 4 if you just want the code to paste in)

1) Open up your quest in the Character-->Quest tab. (I'm assuming you already have a quest made. If you don't, make one now.)

2) Go to the Dialogue Views tab, or the Player Dialogue tab, whichever you prefer.

3) Find the info you want to cause the speaker to attack the player in.

4) In the Papyrus Fragment box under the End section, type in the following code:

AkSpeaker.StartCombat(Game.GetPlayer())

5) Click the Compile button. No errors should appear, if you typed that in correctly. If they do, try step again.

6) Save and exit the CK. Test it. If it the NPC doesn't attack you, repeat the steps.

Explanation:

For those who don't understand Papyrus Fragments, they're essentially little snippets of code. They're part of a bigger script, but you can edit each part of the larger script within these Papyrus Fragments. They're a fragment of the script, that's been pre-placed for you. In our example, we placed the Papyrus Fragment at the End. That means that the code will run once the NPC finishes speaking. If we placed it in the Begin section, it would run accordingly.

AkSpeaker is a reference to the NPC speaking. Like all Ak references, it finds the object it's pointing to, and performs whatever action is past the period on that obejct. StartCombat forces the NPC to start combat with the reference in the parentheses. In our case, we called Game.GetPlayer, which is a function used to find the reference of the player. You could also define a property and replace Game.GetPlayer with it, if you wanted the NPC to initiate combat with a different Actor. For our script, this will work well, though.

Note that the NPC will flee from the player at a low health if their confidence (found under AI Data, in their NPC editor) is set higher.


Adding Items to a Container Via Script

This tutorial will teach you how to add items to a container via script, and how to do it at a certain stage of a quest. Skip to step 3 for the script, or step 5 for the script with quest stages. Thanks to IshaeaMeradin for some help fixing a few issues here.

1) Open your script (or create it) with your editor of choice (or the built-in CK editor).

2) Add one properties, pointing to the item you want to add. For this script, we'll be using the example of Gold001. As Ishara pointed out on the Forums, we don't need a property for the container, since we're attaching the script to the container. We can use Self instead. We will be using the event onActivate, but you may use a different one for your own script. (OnActivate will add the item when the container is activated, and unlike in Oblivion, will automatically open your container unless you add extra code to say otherwise.)

3) Type in the following:

Scriptname Yourscriptname Extends ObjectReference

MiscObject Property Gold001 Auto; this should be a property for the item to add to the container

Event onActivate(Actor AkActionRef)

If akActionRef == Game.GetPlayer()

Self.AddItem(Gold001, 100)

EndIf

EndEvent

4) Save your script and attach it to your container, making sure all the properties are pointing towards something.

To only add on a certain stage:

5) Click the Edit Properties button by right clicking on your script and selecting it.

6) Add a property, which we'll call MyQuest, and attach it to your quest (the one that has a stage that will allow the item to be added to the container).

Be sure to flag it auto at the end, like our other properties. For our example, we will pretend that stage 30 is the one that adds the item to the container, but it could be any stage.

7) Open up your script, and change the script to this:

Scriptname Yourscriptname Extends ObjectReference

MiscObject Property Gold001 Auto; this should be a property for the item to add to the container
Quest Property MyQuest Auto

Event onActivate(Actor AkActionRef)

If akActionRef == Game.GetPlayer() && MyQuest.GetStage() == 30

Self.AddItem(Gold001, 100)

EndIf

EndEvent

Explanation:

For the usual item adding, it's fairly simple. If the person who opened the container (the reference that performed an action on the object the script is attached to - akActionRef) is the player, then add your pre-defined item to the chest. Then, make the player activate the chest as usual.

The item-adding on quest stage, the script does the same thing as above, with an added if statement. If the AkActionRef is the player

andyour quest is at stage 30, then the item will add, and the player will activate the chest.Changing the Attack Speed of a Weapon

This tutorial will teach you how to change the attack speed of a weapon, from incredibly slow to lightning-fast, or anywhere in between.Note: Must be done individually, for each weapon you want to modify.

1) Open up the CK.Load up your mod as the active file, and its masters, if you're editing a weapon in that mod.Otherwise, just check the boxes next to Skyrim.esm and Update.esm.

2) Find the weapon you want to modify. It should be under Items>Weapons. You can use the object window filter to find it. We're going to look for the steel warhammer, so search "Steel" in the object window filter and scroll until you find it (that is, the steel warhammer). Then double click it to "open" it.

3) Make sure you're in the Game Data tab for the weapon. This will be below the value and name section. If you're not in the Game Data tab, click it to go to it.

4) Where it says weapon speed, modify it however you like. I'll set mine to 8.00, so I can tell the difference.

5) Save your plugin. (File>Save or the floppy disk icon next to the folder on the main toolbar.) Name it whatever you want. I'll name mine 'Steel Warhammer - Speed Edition'. Close the CK.

6) Load up your game. Go to Data Files, and check the box next to Steel Warhammer - Speed Edition.esp, as well as its masters. (Skyrim.esm and Update.esm for us. The masters are the names you checked when you loaded your plugin into the CK.)

7) Go get the Steel Warhammer. Swing it around. It's super-fast. You're done! Repeat steps 2-5 for every weapon you want to modify.

Explanation:

It's pretty simple. You're modifying the weapon speed - how fast the weapon swings/shoots/stabs. Increase the value to be faster. Decrease to be slower. Default is usually 1.0 for swords, and somewhere between 0.6-0.8 for two handed weapons.

Creating a New Combat Style

This tutorial will teach you how to create a new combat style that you can apply to any NPC in the game. A combat style determines how the NPC will fight, and what style of combat they will prefer.

1) Open up the CK. Check the boxes next to Skyrim.esm and Update.esm.If you have your own mod you want to add a combat style to, set that as the active file.Click OK and let the CK load. Save your mod with the floppy disk icon next to the folder icon. Name it something. Mine is 'Combat Styles of Awesome'.

2) Go to Miscellaneous>CombatStyle and right click in the right-hand side of the Object Window. Select New.

3) A prompt should pop up. Give your combat style an ID. I'll name mine 'csCSoA01' (CombatStyleCombatStylesofAwesome01).A bit redundant, maybe, but following the

proper naming conventions is always good.

4) Now, begin editing your combat style. Refer

hereto see what all the values mean.

5) Close and exit the prompt by pressing OK. Save your plugin with the same icon as before, and exit the CK. You're done. Now, you can apply the combat style to an NPC in the dropdown menu in the AI tab of their editor. (Not the AI Packages, but the other one - AI Behaviour, I believe.)

If you so wish, you can change combat style through dialogue with scripting. The function is SetCombatStyle, but requires SKSE to be used. However, it does not persist across save games - so be sure to use OnPlayerLoadGame.

Using SKSE Functions

This is also how you use functions from any other mod/resource like SkyUILib, SkyUI, or FISS.

This tutorial will teach you how to use functions or events from SKSE in your scripts.

1) Go to the SKSE site, skse.silverlock.org.

2) Download the 7z Archive version of the latest SKSE (you can choose beta or the latest, I usually use beta but if you don't want to have access to functions from it, that's fine).

3) Extract the contents of the archive to your Skyrim folder (the one containing TESV.exe and such), saying Yes to All if it asks you to replace anything.

4) Now, in order to use functions from SKSE in your script, you... Use them like you would any other function or event. In order for them to work, the user must have SKSE of the version you used or higher. They can have the 7z or Installer version installed.

Explanation:

In order to use functions and events, these functions and events are defined in SOURCE scripts - PSC files found under Skyrim/Data/Scripts/Source. Installer SKSE only includes the PEX files; the 7z version includes the source files. Only someone modifying/making scripts needs the source files, users can just have the PEX files for things to work smoothly.

22 Comments

Anonymous

6/25/2014 08:45:19 am

Thanks. I was having trouble with the combat styles. This helped alot

Reply

KatsuroKurotsuki

7/5/2014 06:04:28 pm

I've been messing around in ck with new spells to make my mage gameplay more exciting. I was able to make the spells but I'd like the animations to show up for each individual spell. For instance I made a spell called Elemental Force which in essence combines Flames Frostbite and Sparks since Flames is loaded first it's the only animation that appears. How would I go about changing it so each animations appears and even the spell in hand shows fire frost and sparks? Is it a simple fix in ck or requires scripting?

Reply

Matthias

7/28/2014 11:42:11 am

Animations are quite difficult of deal with, and very complex. I don't work with them a lot, so I might not be completely accurate. I believe you're asking if your custom spell could have a custom animation while in the player or an NPCs hand (when equipped), like a swirling mix of fire and frost or something like that. I'm not sure if this is an animation or a texture/mesh, but it would require you to create new animations/textures/meshes, which is quite difficult and can take a lot of time. You could post on the Nexus Forums for more information, since there are likely people with more expertise in animations and such than I.

Reply

Matthias

7/28/2014 05:20:23 am

Animations are quite difficult of deal with, and very complex. I don't work with them a lot, so I might not be completely accurate. I beeline you're asking if your custom spell could have a custom animation while in the player or an NPCs hand (when equipped), like a swirling mix of fire and frost or something like that. I'm not sure if this is an animation or a texture/mesh, but it would require you to create new animations/textures/meshes, which is quite difficult and can take a lot of time. You could post on the Nexus Forums for more information, since there are likely people with more expertise in animations and such than I.

Reply

Breathofthevoid

8/5/2014 03:21:51 pm

Hey so I was hoping someone can help me out with a quest mod I'm trying to do. I want it so when the player sleeps in a bed, he has a "Dream" and is sent into another world space to complete his dream quest and is then moved back to where he has slept. I'm new to modding but have fiddle around in the creation kit for a bit but I'm not sure where to start with this. Any help would be appreciated a lot.

Reply

8/5/2014 05:26:13 pm

I'm looking into this. I'll get back to you once I've figured it out - it's a bit more complicated than I expected.

Reply

8/6/2014 06:55:05 am

Alright. I made a tutorial for you, and I'll be posting a slightly more refined one as a new tutorial soon. Here's the link:
http://www.mediafire.com/download/3ea5la0rsrdpks2/Making+A+Dream.txt

If you've got any questions, email me at [emailprotected].

Reply

Breathofthevoid

8/6/2014 12:01:32 pm

Thanks so much, this will help me out a lot!

NightDiver

9/30/2014 05:28:52 am

I'm having trouble using an asset from the Frostfall mod - specifically, deadwood in a crafting recipe to create some tentpoles for the mod Adventurer's Rucksack. I have no problem if I just use firewood but I'm trying to make it more immersive. I've never raided a pile of firewood build anything other then whittle something. Deadwood absolutely - hammocks, monkey bridges and lean-tos to name a few I've built as a kid.

Reply

9/30/2014 09:44:14 am

I'm not able to help much with the information you've given, but make sure you've .esmified Frostfall with Wrye Bash and used it as a master for your Frostfall patch (or for your main file if you want it to require Frostfall).

Or, you might be able to use GetFormFromFile (MAYBE) but I've never really worked with crafting recipes and that doesn't sound like it will work.

Reply

NightDiver

9/30/2014 10:39:35 am

I think I've got worked out. It seems to be a common problem. I found something by T3nd0 that seems to solve the problem. Any ideas as to why CreationKit strips the Master files I've through WyreBash? Really annoying. I'll try Esmifing the files if T3nd0's way fails.

I'm trying figure what's the best way to introduce mod resources from one mod into another mod.

Thanks for your help

9/30/2014 10:51:17 am

I'm not sure what you mean by stripping the master files. If the master files babe not been esmified properly, then they will not be allowed as master files and the mod will not function correctly.

Best way is masters and patches, though via scripting you can use GetFormFromFile or one of the SKSE functions about load order (check the CK Wiki).

NightDiver

9/30/2014 11:53:30 am

I went ahead recreated the mod I'm working on using the esmified Frostfall using Wyre Bash and it worked like a charm. Thanks for your time.

5/4/2015 10:05:30 pm

Hay guy, i'm working on a mod for the Umbra Sword but instead of it trapping souls in a soul gem i'm using the enchantment from the glass bow of the stag prince and i was wondering how i can change the script from animals killed to NPCs kill

Reply

5/6/2015 02:55:06 am

I'm not certain that there IS an NPCs Killed function, but open up the script with Edit Source, copy the contents, Add a [New Script] to your Umbra Sword (removing the script for teh stag prince), give it a name, and paste in the contents of the previous script. Change the name of what you pasted in to the name you gave your script (the thing after Scriptname, change that appropriately). Then go find the part where it references Animals Killed and change that to the appropriate string/text from this list: http://www.creationkit.com/QueryStat_-_Game#Notes

Reply

Polka

9/19/2015 05:06:23 pm

This is probably a dumb question but how would I get a dialogue to trigger in a certain area/when an object is activated. Like say I have this object, when the player activates it a message box opens up, and when the player closes it the actor comes up and speaks to them.

Reply

Mattiewagglink

9/19/2015 05:15:03 pm

You'll want to attach a script to a triggerbox that looks like this:

Scriptname myScriptname Extends ObjectReference

GlobalVariable Property readyToTalk Auto

Event OnTriggerEnter(ObjectReference akActionRef)
readyToTalk.SetValue(1.0)
Disable()
EndEvent

----------
Then compile this script, replacing the myScriptname part with the name you gave your script. Go to Miscellaneous>Globals in the CK, and make a new Global called whatever you want. Value 0, NOT constant, short. Fill the property on the triggerbox myScriptname with the global you just made.

Then, make your dialogue, and give your actor a new package. Make it type forcegreet, give the parameter of what dialogue to start as the beginning topic of your dialogue, and condition the package to GetGlobalValue yourGlobalYouMade == 1.0.

Make your dialogue say once if you only want them to say it once, or just set the global to 2 when the dialogue is done.

Reply

Polka

9/24/2015 01:49:38 pm

Thanks so much, but I'm having an issue with the forcegreet. It never seems to trigger, the script compiled and everything else, I added the package to my npc, added the topic, set it up so the topic was blocking, but the npc never approaches me and initiates dialogue. I have to talk to him for it to fire. I've had this problem with forcegreets before, but I could never find a solution

Mattiewagglink

9/24/2015 06:32:21 pm

Make sure you've generated an SEQ if the quest is start game enabled. And then check the conditions.

Reply

Polka

9/25/2015 12:22:48 am

That actually helped a different problem I had, so thanks for that, but the forcegreet thing is still an issue. I've set the conditions so it only fires after getting an item, when they reach the triggerbox, and several other condition setups and nothing worked. Again, everything seems to work fine but the actual forcegreet package triggering. I know so little about scripting and I dug through the creationkit wiki, if I wanted to add an evaluatepackage script somewhere, would that work? Where would I even attach it? Sorry for all the questions, all your tutorials have been super helpful but I've been up all night and Im close to bleeding out my eyeballs

Mattiewagglink

9/26/2015 10:57:51 am

You'll want to attach a script to the triggerbox that looks like this:

Actor Property evaluateActor Auto

Event OnTriggerEnter(ObjectReference akActionRef)
if akActionRef == evaluateActor; when the person walks through the trigger
evaluateActor.evaluatePackage();evaluate package
disable(); do once
endif
EndEvent

Reply

Mattiewagglink

9/26/2015 10:58:15 am

And then fill the actor property once you compile.

    Archives

    July 2015
    June 2015
    May 2015
    February 2015
    December 2014
    November 2014
    September 2014
    August 2014
    July 2014
    June 2014

    RSS Feed

Common Modding Questions: Skyrim Modding Tutorial (2024)

References

Top Articles
Latest Posts
Article information

Author: Tuan Roob DDS

Last Updated:

Views: 5717

Rating: 4.1 / 5 (62 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Tuan Roob DDS

Birthday: 1999-11-20

Address: Suite 592 642 Pfannerstill Island, South Keila, LA 74970-3076

Phone: +9617721773649

Job: Marketing Producer

Hobby: Skydiving, Flag Football, Knitting, Running, Lego building, Hunting, Juggling

Introduction: My name is Tuan Roob DDS, I am a friendly, good, energetic, faithful, fantastic, gentle, enchanting person who loves writing and wants to share my knowledge and understanding with you.