How to edit existing scripts?

Post » Wed Jun 20, 2012 2:13 pm

I want to create a mod with an extremely simple customization of an existing script in the base game. I want to modify MineOreScript to change StrikesBeforeCollection and AttackStrikesBeforeCollection from 3 to 1 to make mining faster.

I created a new plugin, loaded the Skyrim data file, and saved the plugin. Then I found the script under Gameplay -> Papyrus Script Manager, modified it, saved it, compiled it, and saved the plugin again. I ran the Skyrim launcher, activated the new plugin, loaded up a save, and tried mining an ore vein. My orc took his usual three whacks per resource, indicating that the script change wasn't being applied.

I checked the ESP file and found that it was only 1k. Am I missing a step somewhere that's preventing my changes from actually being saved into the plugin? I've found tons of tutorials for creating new scripts, but no mention anywhere of how to modify a vanilla game script. Do I have to create a new script to extend or override MineOreScript?

Any help would be greatly appreciated.
User avatar
Robert Devlin
 
Posts: 3521
Joined: Mon Jul 23, 2007 2:19 pm

Post » Wed Jun 20, 2012 10:50 am

Scripts aren't packed into the ESP anymore, so you didn't need to save as a new mod after you compiled it. Also, even if they were, it shouldn't be such a surprise since scripts don't take that much space.

I'm pretty sure I answered a thread just like this on the nexus... Anyway, I just took a look at the script in my source folder and I think something might be off. I haven't modified mine and the StrikesBeforeCollection on mine is already set to 1...

When you change AttackStrikesBeforeCollection to 1 and then you attack the ore vein, you only need to hit it once right? Because I just tried it and it worked for me. That's because the ore vein keeps track of how many times you attack it.

But when you just activate it regularly, that's not what happens. Each ore vein is actually linked to a piece of invisible furniture. When you activate an ore vein, it passes the activation along to the furniture. That's what plays the animation of you mining away. When the furniture activates the ore vein, that's when you get the ore added to your inventory.

Now you need to look at the MineOreFurnitureScript and see how it handles that. It looks like a huge mess, but what it's doing is to activate the ore vein every time it receives the animation event of "AddToInventory" from the player. I added a debug message to this, and it seems that this event only occurs every 3rd strike.

That's why even though you change the MineOreScript, it still takes 3 strikes when you activate the ore vein.
User avatar
Katie Samuel
 
Posts: 3384
Joined: Tue Oct 10, 2006 5:20 am

Post » Wed Jun 20, 2012 2:26 pm

Ah, that totally makes sense. Thanks a bunch for the excellent explanation! I'll give this another try later.
User avatar
Steven Hardman
 
Posts: 3323
Joined: Sun Jun 10, 2007 5:12 pm


Return to V - Skyrim