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, and Adding Items to a Container Via Script. You can find a tutorial on creating compatibility patches elsewhere.
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 circumstance. A response is a single line of dialogue.
Now that that's out of the way, let's start.
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:
6) Save and exit the CK. Test it. If it the NPC doesn't attack you, repeat the steps.
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 circumstance. 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:
5) Click the Compile button. No errors should appear, if you typed that in correctly. If they do, try step again.
- AkSpeaker.StartCombat(Game.GetPlayer())
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.
Step 1) Open your script (or create it) with your editor of choice (or the built-in CK editor).
Step 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 opened.)
Step 3) Type in the following:
Scriptname Yourscriptname Extends ObjectReference
MiscObject Property Gold001 Auto; this points to gold, which is a misc object, but the object you want to ;add may be different
Event onActivate(Actor AkActionRef)
If akActionRef == Game.GetPlayer()
Self.AddItem(Gold001, 100)
EndIf
EndEvent
Step 4) Save your script and attach it to your container, making sure all the properties are pointing towards something.
Step 5) Click the Edit Properties button by right clicking on your script and selecting it.
Step 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.
Step 7) Open up your script, and change the script to this:
Scriptname Yourscriptname Extends ObjectReference
MiscObject Property Gold001 Auto; this points to gold, which is a misc object, but the object you want to ;add may be different
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 and your quest is at stage 30, then the item will add, and the player will activate the chest.
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.Step 1) Open your script (or create it) with your editor of choice (or the built-in CK editor).
Step 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 opened.)
Step 3) Type in the following:
Scriptname Yourscriptname Extends ObjectReference
MiscObject Property Gold001 Auto; this points to gold, which is a misc object, but the object you want to ;add may be different
Event onActivate(Actor AkActionRef)
If akActionRef == Game.GetPlayer()
Self.AddItem(Gold001, 100)
EndIf
EndEvent
Step 4) Save your script and attach it to your container, making sure all the properties are pointing towards something.
Step 5) Click the Edit Properties button by right clicking on your script and selecting it.
Step 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.
Step 7) Open up your script, and change the script to this:
Scriptname Yourscriptname Extends ObjectReference
MiscObject Property Gold001 Auto; this points to gold, which is a misc object, but the object you want to ;add may be different
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 and your 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.
Step 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.
Step 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 I search "Steel" in the object window filter and scroll until I find it. Then I double click it to open it.
Step 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.
Step 4) Where it says weapon speed, modify it however you like. I'll set mine to 8.00, so I can tell the difference.
Step 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.
Step 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.)
Step 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.
Step 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'.
Step 2) Go to Miscellaneous>CombatStyle and right click in the right-hand side of the Object Window. Select New.
Step 3) A prompt should pop up. Give your combat style an ID. I'll name mine 'csCSoA01' (CombatStyleCombatStylesofAwesome01).
![]() |
The Combat Style prompt |
Step 4) Now, begin editing your combat style. Refer here to see what all the values mean.
Step 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.)
![]() |
An example of a combat style, made by me, for a knight. Favors melee over everything else, and will not use magic at all. |
No comments:
Post a Comment