0 of 0

File information

Last updated

Original upload

Created by

_kmatt_

Uploaded by

AlchemicaMateria

Virus scan

Safe to use

Tags for this mod

About this mod

This is a ClibNG SKSE plugin that adds a handful of Papyrus functions focused around spells. Functions include setting the charge time of spells, checking for spell flags, setting spell flags (No auto-calc, no dual cast mod, etc.), and much more! This is meant as a resource for modders or as a dependency for other mods.

Requirements
Permissions and credits
Changelogs
Donations
Overview: 

This is an SKSE plugin that adds a handful of Papyrus functions focused around spells. Functions include setting the charge time of spells, checking for spell flags, and setting spell flags (No auto-calc, no dual cast mod, etc.). As of v1.1.0, this also includes updated versions of functions from Mag Extender and Spellcraft Functions SKSE64. This is meant as a resource for modders or as a dependency for those mods. Some of these may already be available in one way or another, but I was unable to them when I was searching for similar functions. As I learn more about SKSE plugins, C++, and CommonLib, I will update this with more functions if I find a need. If there is something specific with spells that you'd like to implement in Papyrus, let me know!

Requirements:

  • SKSE -> use for your version of the game
  • Address Library -> use for your version of the game

Mod Users: You only need to download the main mod with the plugin

Important Updates:

For both users and authors, please use v1.2.1 or above until further notice. This does not have serialization. Please do not try to use the Process() function with this version. I've found some new bugs with serialization that only happen in certain situations. I'll try to fix them and eventually release another version with serialization. This also means that copySpell() and combineSpells() are effectively useless at the moment as crafted spells won't persist across saves. It is possible to set it up in your script to re-craft spells on load - use Simple Obvious Spell Crafting by wSkeever as a guide.

For users experiences crashes with older versions of Controlled Casting, updating Spell Extender to v1.3.0 should fix the issues. Some mods add NPCs that seem to rapidly change spells which has potential to cause crashes. This update adds some failsafes that should prevent these crashes.

Compatibility:

Should be compatible with everything. Built with CommonLib NG so should work with all game versions. I have only tested on 1.6.353. 

Included Functions:

New with v1.3.0:

bool hasEffect(Form akForm, MagicEffect akEffect)
  • Returns true if akForm as the effect akEffect
bool hasEffectSpell(Spell akSpell, MagicEffect akEffect)
  • Returns true if akSpell as the effect akEffect
bool hasEffectScroll(Scroll akScroll, MagicEffect akEffect)
  • Returns true if akScroll as the effect akEffect
bool hasEffectEnchantment(Enchantment akEnchant, MagicEffect akEffect)
  • Returns true if akForm as the effect akEffect

String getSpellDelivery(Spell akSpell)
  • Returns the delivery form of the spell
  • Previously, you could only get delivery from a magic effect
  • Returns:
- "Self" 
- "Touch"
- "Target Location" 
- "Aimed"
- or "Target Actor"

Spell Crafting:
I am planning to make a new mod that is focused purely on spell crafting functions, but for now I will leave these here. However, without serialization for spells working, created spells will not persist across save games.

copySpell(Spell newSpell, Spell sourceSpell)
  • Copies sourceSpell into newSpell
  • Copies all spell data and magic effects
  • The main ‘issue’ with this is that the spell art doesn’t change. I tested copying flames into healing and the healing spell art and animation stayed but I was able to damage enemies as if it was flames.
  • The artwork issue could possibly be fixed, however, I was simply updating this function from another mod so I believe this is how it’s ‘supposed’ to work
  • This is an updated version of a function from “Spellcraft Functions SKSE64


combineSpells(Spell akBase, Spell[] spells, String name)
  • Combines the effects of all spells in array spells into spell akBase
  • akBase is ‘sacrificed’ and is replaced by the combination of the spells in spells
  • Name is the name of this new spell
  • This is an updated version of a function from “Spellcraft Functions SKSE64

Spell Setters:

setSpellCost(Spell akSpell, int cost)
  • Sets the cost override of the spell
  • This is the cost used when costs are manually calculated. If auto-calc is on, this will be ignored and cost is calculated based on the magic effects

setChargeTime(Spell akSpell, float time):
  • Sets the charge time to the specified time. Note: this only changes the charge time for the spell which isn't used unless the "No Auto-Calc" flag is present

setChargeTimeAll(Spell akSpell, float time):
  • Sets the charge time for the spell and all magic effects. Note, sometime multiple spells use the same magic effect. This function will ensure the charge time change takes effect regardless of if the spell is auto-calculated or not.

setSpellFlag(Spell akSpell, int flag, int bit):
  • Sets a specified spell flag to on or off (1 or 0). 

Spell Flags Supported: 
  • No Auto-Calc : 0
  • Ignore Resistance : 19
  • Area Effect Ignores Line of Sight : 20
  • Disallow Spell Absorb/Reflect : 21
  • No Dual Cast Modifications : 23
  • PC Start Spell : 17

There are also a variety of bool functions that return whether or not the spell has a certain flag:

IsManualCalc(Spell akSpell) ----------------------> Checks for No Auto-Calc / Manual Calc Cost flag                    
IgnoresResistance(Spell akSpell) ---------------> Checks for Ignore Resistance flag
IgnoresLOS(Spell akSpell) -------------------------> Checks for Area Effect Ignores LOS flag
IsNoAbsorb(Spell akSpell) -------------------------> Checks for Disallow Spell Absorb/Reflect flag
IsNoDualCastMod(Spell akSpell) ---------------> Checks for No Dual Cast Modification flag
IsPCStartSpell(Spell akSpell) ---------------------> Checks for PC Start Spell flag

There are a few other flags that could be implemented, but they are rarely used. All of these return true if the flag is present.

Effect Setters:

 setNthEffectDelivery(Spell akSpell, int delivery, int index)
 setNthEffectArchetype(Spell akSpell, int archetype, int index)
 setNthEffectPrimaryAV(Spell akSpell, int av, int index)
 setNthEffectSecondaryAV(Spell akSpell, int av, int index)
 setNthEffectSecondaryAVWeight(Spell akSpell, float weight, int index)
 setNthEffectTaperValues(Spell akSpell, float tapCurve, float tapDur, float tapWeight, int index)
 setNthEffectTaperCurve(Spell akSpell, float tapCurve, int index)
 setNthEffectTaperDuration(Spell akSpell, float tapDur, int index)
 setNthEffectTaperWeight(Spell akSpell, float tapWeight, int index)
 setNthEffectCastingSoundLevel(Spell akSpell, int level, int index)
 setNthEffectDualCastScale(Spell akSpell, float scale, int index)

  • Sets the respective magic effect data of the nth (index) effect of akSpell to the specified value
  • For casting sound level, 
    • 0 = lound 
    • 1 = normal
    • Silent = 2
    • Very loud = 3
    • Quiet = 4

Effect Getters:

float getNthEffectSecondaryAVWeight(Spell akSpell, int index)
float getNthEffectTaperDuration(Spell akSpell, int index)
float getNthEffectTaperCurve(Spell akSpell, int index)
float getNthEffectTaperWeight(Spell akSpell, int index)
int getNthEffectCastingSoundLevel(Spell akSpell, int index)
float getNthEffectDualCastScale(Spell akSpell, int index)

  • These all return the value for the respective magic data for the nth (index) magic effect of akSpell


Credits and Acknowledgements:

Ryan - CommonLib
CharmedBayron - CommonLib NG
po3 - Papyrus Extender
egocarib - MagExtender
yeebb - Spellcraft Functions SKSE64

Thanks and credit to DalkrBelladona for the original thumbnail image template!

Thanks to all in MrowrPurr's discord server for their help!
Especially, MrowrPurr, NightfallStorm, and Styyx


Source:

Plugin: 
Github (Work in progress)

Papyrus: see .psc files in download