Creating a script to make spell damage scale based on player

Post » Thu Jun 21, 2012 3:32 pm

Hey everyone, Today i decided i was going to create a new mod for skyrim, that fixes the damage scaling issue with Magic. Basically i want to make the mod improve destruction damage based on player level and how many skill points the player has spent in destruction etc etc. From what i understand from all the tutorials ive read / seen, is that I will need to create a papyrus script to do this? Can anyone point me in the right direction to create such a script? I am very familiar with coding and oop, i have experience with JS, php, C# and python, so im not new to coding :biggrin: . Any and all help is very much appreciated!
User avatar
Andy durkan
 
Posts: 3459
Joined: Fri Aug 03, 2007 3:05 pm

Post » Thu Jun 21, 2012 4:23 pm

It would be a fairly simple augmentation of the spell's damage in your magic effect script based on the player's level and destruction skill. All you really need is a formula. So, if you want to double the spell's damage at max level and max destruction skill, the formula would be this:

(((( / 100) * game.getPlayer().getAV("Destruction")) / 81) * game.getPlayer().getLevel())

Put the result of that calculation into a variable, plug that variable into the amount for the DamageAV function. So the script would look something like this:

scriptname mymagicdamageaugmentationscript extends ActiveMagicEffectFloat DamAugmentEvent OnEffectStart(Actor akTarget, Actor akCaster)	 If Target != game.getPlayer()			   DamAugment = (((( / 100) * game.getPlayer().getAV("Destruction")) / 81) * game.getPlayer().getLevel())			  akTarget.DamageAV("Health", DamAugment)	 EndIfEndEvent

Or, if you want it to be global:


scriptname mymagicdamageaugmentationscript extends ActiveMagicEffectFloat DamAugmentEvent OnEffectStart(Actor akTarget, Actor akCaster)	   DamAugment = (((( / 100) * akCaster.getAV("Destruction")) / 81) * akCaster.getLevel())	   akTarget.DamageAV("Health", DamAugment)EndEvent
User avatar
Nicole Mark
 
Posts: 3384
Joined: Wed Apr 25, 2007 7:33 pm

Post » Fri Jun 22, 2012 1:25 am

Ahh ok, i see now how it works alittle :biggrin:

Would i have to do anything special for other effects such as the magika drain for shock spells, or the duration / magnitude on illusion / alteration spells?
User avatar
Talitha Kukk
 
Posts: 3477
Joined: Sun Oct 08, 2006 1:14 am

Post » Fri Jun 22, 2012 1:12 am

I do not believe it is possible to modify spell duration in Papyrus. None of the statistics (Area, Magnitude, Duration) can be touched by Papyrus at this point, and you need SKSE if you even want to read them.
User avatar
SHAWNNA-KAY
 
Posts: 3444
Joined: Mon Dec 18, 2006 1:22 pm

Post » Thu Jun 21, 2012 4:31 pm

Well basically i want to overhaul the spell system to make it as balanced as melee classes :)
User avatar
Marquis deVille
 
Posts: 3409
Joined: Thu Jul 26, 2007 8:24 am

Post » Fri Jun 22, 2012 12:37 am

If you want to make it scale by percentage based on the relevant magic skills, and don't mind the increases starting from a 0 rank upward, that's doable relatively easily through custom perks. You can mod spell duration / power with a condition that checks if the magic effect in question is from a particular school, and which multiplies the duration / power by, say, 1+[stat value]*0.01 (for 1% boost per point in the skill, for instance). There's a specific option in the mod spell duration / power entry points to allow you to apply that particular formula, and a specific condition that lets you select based on the associated magic school. ^^

That's how I got magic to svck less in my own game.

Edit: I'd give better instructions, but I'm currently in Linux land and can't fire up the CK with my custom runtime mod to step through exactly what I did. ^^'

More complicated formulas, however, would be hard to pull off, but I'm certain that the formula for melee weapons takes a similar approach (increases at a linear rate from rank 0).
User avatar
Kristian Perez
 
Posts: 3365
Joined: Thu Aug 23, 2007 3:03 am

Post » Thu Jun 21, 2012 3:31 pm

If you want to make it scale by percentage based on the relevant magic skills, and don't mind the increases starting from a 0 rank upward, that's doable relatively easily through custom perks. You can mod spell duration / power with a condition that checks if the magic effect in question is from a particular school, and which multiplies the duration / power by, say, 1+[stat value]*0.01 (for 1% boost per point in the skill, for instance). There's a specific option in the mod spell duration / power entry points to allow you to apply that particular formula, and a specific condition that lets you select based on the associated magic school. ^^

That's how I got magic to svck less in my own game.

Edit: I'd give better instructions, but I'm currently in Linux land and can't fire up the CK with my custom runtime mod to step through exactly what I did. ^^'

More complicated formulas, however, would be hard to pull off, but I'm certain that the formula for melee weapons takes a similar approach (increases at a linear rate from rank 0).

That sounds like a pretty good idea.

So far i have found a few things such as:
  • adding a third level to the fire/frost/lightning specialization perks, which goes to 75% damage increase over the default 50%.
  • Changed the dual casting damage / cost from 220% / 280% to 250% / 275%
  • Increased the magicka regen in combat from 33% to 50%.

But these are mostly just increasing the damage from the destruction tree. Most settings are just tweeks to the Creation Kit -> Gameplay -> settings screen.


Things i would like to do but dont know how yet:
  • Increase destruction damage of expert / master level spells based on player level (Would be nice but not really a big deal to have)
  • Increase Rune base damage based on Destruction skill level
  • Increase the spell reduction cost (level 100 in skill tree) for all spells from 40% to 50%
Thank you guys for helping me so far, All help is appreciated as well as suggestions (as this might be released on tesnexus)
User avatar
Mario Alcantar
 
Posts: 3416
Joined: Sat Aug 18, 2007 8:26 am

Post » Fri Jun 22, 2012 1:10 am

OK... to be more specific (now that I'm in Windows land), you create a perk (I personally created one perk per school, and inserted them low in the skill trees by editing Actor Value / [spell school] / Perk Tree) with whatever criteria you want to earn it.

In the 'Perk Entries' window, you add a new entry with the entry point of your choice (Mod Spell Magnitude / Duration / Cost, whatever), and set the function to 'Multipy 1+Actor Value Mult'. This will change the thing below to "Value *= 1+ [actor value] * [constant multiplier].

To turn the skill rank for Destruction into a + damage % effect, for instance, you would simply select 'Destruction' in the dropdown, and '0.01' as the constant multiplier.

In the Spell tab, add a new item and set the condition function to 'EPMagic_SpellHasSkill', use the first button past the dropdown to select 'Destruction' (in this case), the comparison as '==', and the value as '1.000'. This will make this perk effect only alter spells that have 'Destruction' as their skill.

When this perk is on your character, any spell effect (castable spell, equipment, etc) with 'Destruction' as it's skill will increase in damage by 1% for every level you have in Destruction. It also continually updates, so as your Destruction goes up, so does destruction damage. You can easily modify this to affect other properties of spells based on other skills as you wish, and add extra perk items with conditions to create 'tiered' increases. With more tweaking and work, you could probably tie the value to a calculated value somewhere generated by a quest or background script... lots of options here. ^^

Edit: For testing, you might want to create a few test perks, a few tester items, and a custom script on those items that adds the perk on equip and removes it on removal. ^^

Edit 2: For increasing Rune damage, you can add a condition below EPMagic_SpellHasSkill of 'HasKeyword' with 'MagicRune'.

Edit 3: For increasing damage of specific tier spells, you can use the same technique they use for the cost reducing perks: 'SpellHasCastingPerk' condition, with the relevent perk (i.e. for novice Destruction spells, the casting perk is 'DestructionNovice00', etc.)
User avatar
Je suis
 
Posts: 3350
Joined: Sat Mar 17, 2007 7:44 pm


Return to V - Skyrim