SKYRIM
Attack Speed Mod by renketsu0
Skyrim » Gameplay effects and changes
Added: 17/12/2012 - 02:18AM
Updated: 31/08/2013 - 07:26AM

24 Endorsements

2.2 Latest version

889 Unique D/Ls

1,283 Total D/Ls

14,305 Total Views

Uploaded by renketsu0

Description

Last updated at 7:26, 31 Aug 2013 Uploaded at 2:18, 17 Dec 2012

This mod enables attack speed debuffs and allows speed stacking across independent mods. It also doubles as a guide to navigate other modders through properly handling attack speed buffs/debuffs.

USERS
Simply download the with nexus mod manager and make sure your other mods that use attack speed are in compliance. Overwrite the scripts if asked.

MODDERS
Read the accompanying guide.






Attack Speed Mod Guide

by Renketsu0

Contents

[0] Which Version to Download?
[1] Purpose and Logic of ASM
[2] What ASM Adds
[3] What ASM Replaces
[4] Making Your Mod Compatible
[5] Proper Magic Effects (IMPORTANT)
[6] Spells vs Modav
[7] Additive Vs Multiplicative Stacking
[8] Stability
[9] Diagnosing and Working around Issues
[10]Sample Spells

Changelog

There is a TL;DR for long sections if you need quick reference or think I'm too wordy.
____________________________________________

[0] Which Version to Download?
There are two ways to get ASM's base attack speed on everybody, an invisible cloak or adding the spell to all races.
The cloak version is best for compatibility while the race version is best for setups that are already script heavy.

With that said, you should download the main file (cloak application) unless one of the following is true:
* You can easily get rid of race conflicts in TES5Edit or the like
* Your system is script-heavy already.
* You believe even the faintest exection of a script is a vile thing that must be eradicated immediately

Otherwise there is not much benefit for the potential extra work.

In the case that you end up using the races edit version, keep in mind it will conflict with other mods that edit races. You will have to fix race conflicts and add the spell to custom races yourself.


[1] Purpose and Logic of ASM

Attack Speed Mod (ASM) is designed to allow proper attack speed buff/debuff stacking across mods. It also enables attack speed debuffs, which couldn't be implemented properly in vanilla. Attack speed was implemented a bit poorly in Skyrim and is very difficult to work with. ASM also doubles as a guide since attack speed has so many quirks that can make modding difficult without one.

Attack speed is determined by the Actor Value weaponspeedmult, which Skyrim defaults to be 0. Values of 0 or 1 are normal attack speed. Values between 0 and 1 are a loss of attack speed, so 0.5 is 50% attack speed. Values above 1 are a gain of attack speed, so 1.5 is 150%. Values less than 0 are also treated as normal (100%) attack speed. More on this in section 6.

When a character uses the Dual Flurry Perk, Vanilla Skyrim adjusts your attack speed by adding 1.2 to your weaponspeedmult. The problem with this is that they have included the base attack speed in that addition. Mods that alter attack speed using this same logic are incompatible. Why?

Imagine you have a mod that gives vampires +15% attack speed at night. This mod would do this by adding 1.15 to your weaponspeedmult. What if your vampire character is also a Dual Flurry user? You would get

0 (the original) + 1.15 + 1.2 = 2.35

So instead of the intuitive 1.35 one would expect, your character would instantly become broken tier.

You could try fixing this on a specific basis by making Dual Flurry add 1.2 and the vampire mod add 0.15, but then what happens if you're a vampire out at night but not a Dual Flurry User? You'd have

0 + 0.15 = 0.15

You'd end up with 0.15 weaponspeedmult or 15% attack speed, which is slow as molasses.

Other mods may have prevented this internally with a "one or the other" non-stacking solution or even possibly adding them together through advanced condition checks. However that same type of conflict would occur with any two independent mods.

This mod fixes these conflicts by first giving all Actors a weaponspeedmult of 1, and then adding all successive increases and decreases from there. So in the last example the math would go as follows

1 (new base) + 0.15 + 0.2 = 1.35

Essentially, ASM separates the base speed from the modifications. This is how stacking is supposed to be done. With this guide, altering attack speed is nothing to be afraid of.

TL;DR
ASM is designed to allow attack speed stacking across mods, and highlight the quirks of altering attack speed. Attack speed is not hiding under your bed, waiting for you to fall asleep. You're going to conquer and ridicule it from here on out.




[2] What ASM Adds

Quest to add the following spells to the player
Player gets a constant effect spell increasing his/her attack base speed by 1.
Player gets a cloak that gives this spell them to others
Cloak has a script that runs ONE TIME ONLY to give the spell to actors within cloak radius
Script DOES NOT run continuously, WILL NOT lag up your game, and WILL NOT persist after uninstalling the mod.
The cloak DOES NOT trigger the Brawl Bug because the Brawl Bugs Patch scripts are included (credits to jonwd7).




[3] What ASM Replaces

Since ASM uses 1 as a base weaponspeedmult I needed to alter the Dual Flurry 1, 2, and Quickshot Perks to add 0.2, 0.35, and 0.3 weaponspeedmult respectively. I also had to alter the Elemental Fury shout likewise. If you have a mod that changes these perks or the shout, make sure it's compatible first and put it lower in your load order.




[4] Making Your Mod Compatible

Making your existing attack speed mod compatible with ASM is very easy. All you have to do is replace instances of attack speed increases/decreases with the previous value minus 1. So if your change was scripted, you just change

setav/modav weaponspeedmult 1.x
to
modav weaponspeedmult 0.x

where x is the percent increase or decrease

It's important that your script uses modav now, to make it compatible with other attack speed mods. If you use setav and another mod uses setav, one change will overwrite the other and cause problems. Modav fixes that by simply adding or subtracting from the current value. I would still higly recommend a spell based change though (see Spells vs Modav)

If you altered attack speed with a spell, it's the same as above except you change the magnitude of the spell instead. Make sure you read section 5 for info on how to get your magic effects setup properly.



TL;DR
Instead of changing weaponspeedmult by 1.x use 0.x, where x is % change
Use modav for scripts if you must, but try to switch to spells
Read Section 5 for spells/abilities




[5] Proper Magic Effects (IMPORTANT)

This is basically the more "guide" section of the guide. I'll discuss everything I've discovered about altering attack speed, while giving you a template of how to create spells that modify it.

If you want to modify attack speed with a spell you MUST DO THE FOLLOWING in your Magic Effect:


[1]Your Effect Archetype must be Peak Value Modifier(PVM). This is essential to make sure effect doesn't stack with itself.
[2]Make a unique keyword for your effect, then click ok to close the dialog box, then reopen it.
[3]Assoc. Item 1 is your weaponspeedmult or leftweaponspeedmult and Assoc. Item 2 is a the keyword of effects you don't want it to stack with. Put your unique keyword here. If 2 PVMs with the same keyword end up on the same Actor, the one with the lower (or same) magnitude will be dispelled automatically. Using the "Dispel Effects with these keywords" checkbox WILL NOT WORK for [left]weaponspeedmult, or movement speed for that matter. I tried a thousand different ways and finally came to the conclusion that you have to use PVM with the effect's own keyword. This also means you will have to do a separate effect for both the left and right hands since PVM only modifies one value at a time. Tedious? Yes. But at least it works without errors.
[4]You must use the Recover Flag to make sure the values return to normal after the effect expires. Otherwise it will be permanent. You should do this with constant effects too just in case the spell needs to be removed at some point in time. That way attack speed changes will revert without any problems.

Now that that's out the way here are some other things that are good to know:


[5]Attack speed modifications only applies to humans afaik. I'm certain it doesn't work on creatures and I've observed that it doesn't work on draugr.
[6]If you want a debuff you need to use the detrimental flag. This will subtract the magnitude from the weaponspeedmult instead of adding to it.
[7]Skyrim treats values that are 0 or less as normal attack speed, so don't stack debuffs too low. More on this in section 7.
[8]Tapering doesn't work with these. I'm not sure if it's the weaponspeedmult itself or the necessary recover flag that causes this, but I've definitely tried quite a bit to no avail. Alternatively you could make multiple unique PVM effects and, since stacking works, put them in the same spell but with different durations. This will allow a you to make a spell that increases or decreases the buff/debuff over time. Tedious, but I've used it to great effect and you can find this example, Manifest Sap, in my sample spells esp.
[9]weaponspeedmult and speedmult (movement speed value) afaik have all the same traits, however the speedmult has a default value of 100 and not 1. With speedmult, a 50 means 50% movement speed and a 150 means 150%. So if you're interested in messing around with movement speed as well, you can use this guide (PVM, recover flag, and all) but keep that small difference in mind.



TL;DR
You should read this entirely, but for quick reference:
Use Peak Value Modifier effect archetype
Give your Magic effect a unique keyword
Assoc. Item 1 is [left]weaponspeedmult
Assoc. Item 2 is the unique keyword you made for it (exit then reopen dialog box to see it)
Use the Recover flag, even for permanent buffs/debuffs
If you want a debuff instead of a buff use the Detrimental flag




[6] Spells vs Modav

Spells and modav can both be used to modify attack speed but I'd still recommend a spell based solution, since modav has no "memory." In other words, undoing the change is not automatic and must also be handled by scripting. A spell based solution has "memory" in the form of the Recover flag. Simply remove the mod, which removes the spell, which reverts the value to what it was originally. With a spell-based solution the actor's base weaponspeedmult is unchanged so when you remove all spell based modifiers it reverts back to 0. With modav you change the actor's base value. This means if you don't handle your mod's dispelling or uninstallation properly the actor will be left with permanently modified attack speed. I'm not saying you can't do it properly but it can be difficult, possibly resource consuming, and unnecessary since I've yet to find any attack speed changes that can't be done with spells. Papyrus is also known to be very slow and laggy at times. I should stress that I'm not suggesting against scripting in geneal, but the against use of the modav command to make the actual change. Complex things will still require scripting, but that's fine just as long as your change is done with a (target).addspell(yourspellnamehere) instead.



TL;DR
PLEASE USE SPELLS. MODAV ISN'T WORTH IT. PLEASE. STAHP.



[7] Additive Vs Multiplicative Stacking

Additive stacking looks like this

1 + 0.25 + 0.15 = 1.4

This is the way I intend this mod to work, though it can work with multiplicative stacking too. Additive stacking is the standard way to stack attack speed (or movement speed) because it's easy, intuitive, and the drawback is small. The drawback however is that you have to avoid stacking debuffs too hard. Like I said in section 5, Skyrim treats values 0 or less as normal attack speed. With this in mind, you as a modder should keep your debuffs modest and by that I mean debuffs of -30% or less. This will hopefully keep users from debuffing weaponspeedmults below 0. Or simply inform your users of this fact and go balls to the wall with -90%s, whatever works for you.

Multiplicative stacking looks like this

1 * 1.25 * 1.15 = 1.4375

Multiplicative stacking solves the problem of never letting values reach 0 or lower. It also has the possible desired benefit of increasing/diminishing returns. There is nothing truly wrong with multiplicative stacking but it requires scripting afaik (see spells vs modav) and it's basic drawback is that because the math is computerized, there is the possibility of your weaponspeedmult suffering from rounding errors, which will slowly distort your base value. If you can find a way around rounding errors please let me know.



TL;DR
Use additive stacking but make sure you don't debuff to values of 0 or lower.




[8] Stability

This section addresses an important issue. I put so much time into this mod because I want people to use it, not to be forgotten and neglected. However I realize that modders don't want to introduce another mod as a dependency for theirs if it isn't stable or has bugs in it. The catch is that I can't truly prove the stability of the mod without getting people to use it! With that in mind this section is dedicated to providing all the testing I went through to hopefully give other modders some confidence that my mod is well-designed and resilient to different situations.

Things with a * have tested as passed, an X have failed and are unresolved (I'll be honest) and blanks mean untested, but plan to do so soon

(*)base value persists when passing from an interior to an exterior
(*)base value persists when passing from an exterior to an interior
(*)base value maintained through fast traveling
(*)base value maintained for over 18 hours of buff/debuffing oriented gameplay
(*)multiple buffs/debuffs from independent mods stack properly
(*)buff/debuffs recover to previous values after effect expires
(*)buff/debuffs persist through saves and loads (also quicksave/load)
(*)buff/debuffs persist when passing from an interior to an exterior
(*)buff/debuffs persist when passing from an exterior to an interior
(*)complex spell in which the target loses 40% attack and movement speed, but gradually recovers to 100% over 10 seconds works and all values revert fine
(*)enchantment-based buff/debuff
(*)alchemy-based buff/debuff
(*)perk-based buff/debuff
(*)Brawl Bug does not occur, tested in 3 different brawls (vs Vilkas, Bersi Honey-Hand, and Holfgrir Horse-Crusher)
(*)Cloak's application script only runs once per actor
(*)Performance impact of the mod has been tested with Skyrim Performance Monitor. Impact was too small to be observed.

If you personally observe or test one of the untested things here please let me know, it would save me the trouble of doing work that has already been done.

Update: As of ASM 2.0 everything I've wanted tested has been tested and is working properly.





[9] Diagnosing and Working around Issues

If you have some kind of issue that you think is related to my mod, simply disable it and see if it goes away.

If the problem is still there, it is VERY UNLIKELY that it is a problem from my mod, and is beyond my responsibility.

you can see your [left]weaponspeedmult in the console with
player.getav weaponspeedmult
or others by clicking them with the console open and using
getav weaponspeedmult

Do this before and after disabling my mod to see what has changed.

The most common problem will probably be instances of stupidly high attack speed. If disabling my mod's spells fixes the problem, there is PROBABLY another mod you are using that is still handling attack speed the old way (weaponspeedmult + 1.x). Try to identify these mods and kindly ask that the mod author to convert to this standard for full compatibility between mods. While you wait for a response you'll have to either edit their esp yourself or use a console fix on each character affected as follows
player.modav weaponspeedmult -1
player.modav leftweaponspeedmult -1

but remember if you use modav to fix it, after mod author switches to the ASM standard you'll have to do it again replacing the -1 with 1 to fix your values back to normal.

If you are having another type of problem that goes away after disabling my mod please report it to me with much detail and I'll do my best to fix it as soon as I'm free.




[10]Sample Spells

I included an esp in the optional files section with some sample spells you can use templates or inspiration. Here is a quick description of what they do:

An Apprentice Restoration spell called Energize which buffs your attack and movement speeds by 20% for 20 seconds.

An Apprentice Restoration spell called Energize Other which does the above but to a target.

An Expert Illusion called Skooma Haze which debuffs the attack and movement speed of everything nearby by 30% for 30 seconds.

A complex Adept Alteration spell called Manifest Sap. This spell is unique in that it contains a mock tapering effect since tapering in the Magic Effect window doesn't work with attack or movement speed. Manifest Sap shoots a projectile that will debuff the attack and movement speeds of the target by 40%. The effect then slowly "wears off" by losing a portion (8%) of the debuff every 2 seconds, so that they are back to normal after 10 seconds. I did this to simulate the idea of a person working their way out of the sap over time.

To use these spells you'll have to add them using the console using
help "(spell name)"
with the quotes, to get the spell ID and then
player.addspell spellID

All of these spells interact together perfectly and without errors, for instance an actual test I did:

I cast Skooma Haze which will debuff the nearby Ralof's attack speed (AS) and movement speed (MS) by 30% for 30 seconds, leaving him at 70%. After 5 seconds I cast Energize on him which will give him +20% for 20 seconds, leaving him at 90% AS and MS. Then after another 5 seconds I cast Manifest Sap on him giving him a -40% and leaving him at 50% AS and MS . As Manifest Sap begins to wear off Ralof is at 58% after 2 seconds, 66% after 4 seconds, 74% after 6, 82% after 8, and 90% after it expires. In 5 more seconds Energize wears off, putting him back to 70% AS and MS. And finally in 5 more seconds Skooma Haze wears off restoring both back to 100%.

Update: 2.0 includes a potion and a pair of enchanted bracers for the sake of verifying that enchantments and potions work properly. If you want them open the console and type
help "of Attack Speed"
to get their IDs and then
player.additem itemID 1
________________________________________________


If you read the whole guide you probably realize that it opens up a whole world of possibilities. You can enhance the arsenal of your support mage, make attack speed based glass cannons, whatever you want. And most importantly everything can work together instead of overwriting or conflicting with one another.

Hopefully I did a good enough job that there are very few bugs or issues and people can start using this mod with confidence. And hopefully, more than all, it enhances your game experience.

Spread the word to everybody you know using attack or movement speed in their mod and happy stacking!




Change log
1.1 Updated Elemental Fury to work with ASM
1.2 Optimization. Cloak's application script was previously run every second for every actor. Now it only runs once and never again. Removed unnecessary cloak conditions, as the Brawl Bug does not occur even if the cloak stays on. Removed the off-switch as it is no longer necessary. Disabling the mod fully removes everything added.
2.0 Cleanup and new samples. consolidated left and right attack speed into one spell. Renamed everything in the mod to have the ASM prefix. Added 1 alchemy and 1 enchantment based buff to the sample spells file.
2.1 Conditions checks made slightly more robust by checking for the magic effect instead of the spell. There was a very rare case where this was important. Both files cleaned with TES5Edit.
2.2 Added Brawl Bugs Patch scripts (credits to jonwd7). Brawl bug testing before was flawed because Brawl Bugs Patch scripts from Skyrim Redone were present and it was assumed nothing but vanilla was in the testing environment.