mountainmover88 Posted July 29, 2012 Share Posted July 29, 2012 I'm making a mod that allows players to cast spells using The Voice (freeing up hands for weapon-based combat, but sacrificing your ability to use shouts). I've got it mostly working (custom shout casts spells appropriately and cooldown works and everything), but I have no way to determine the magicka cost of the spell the player just shout-cast other than by hard-coding in the cost of every spell in the game and subtracting (no SpellTheyCast.GetBaseCost() function). Lame! Spells are cast using the .cast(Game.GetPlayer()) functionality. Also, hard-coding would make it so that spells from other mods would no longer be compatible so I really want to avoid that. Anyone think of/know a work around? Link to comment Share on other sites More sharing options...
tg08096 Posted July 29, 2012 Share Posted July 29, 2012 How about a script that causes the amount of damage dealt to the target is also dealt to the player, as in a no-hands warrior spell costs the warrior health instead of magicka? How much/how often the player can cast depends on basically health and risk. Just tryin to think outside the box. I personally would love to sacrifice shouts for no hands spells, since I refuse to start the main quest line and therefore can't use shouts anyway. Link to comment Share on other sites More sharing options...
steve40 Posted July 30, 2012 Share Posted July 30, 2012 Could you query the players magicka just before they cast the spell, then again after they cast the spell, then assume the difference is the cost? Link to comment Share on other sites More sharing options...
porroone Posted July 30, 2012 Share Posted July 30, 2012 The Cast() function doesnt return the spell cost, I am also having this issue with my flying mod, right now what I do is consume a % of the player's health and stamina until SKSE brings some function to do the trick. Also we need function to get enchanments, check for perks and all that. Link to comment Share on other sites More sharing options...
mountainmover88 Posted July 31, 2012 Author Share Posted July 31, 2012 (edited) Figured it out!The newest version of SKSE includes a spell.GetMagickaCost() function so I can just use that. Yay!Not sure if this function was included in previous versions of SKSE, but build 1.5.10 has it. http://skse.silverlock.org/The new SKSE version also has a function that lets you check for perks associated with the spell and, with enough workarounds, I bet we can now charge the player an appropriate amount.Thanks for the replies. Edited July 31, 2012 by mountainmover88 Link to comment Share on other sites More sharing options...
porroone Posted July 31, 2012 Share Posted July 31, 2012 Nope, it wasnt included in 1.5.9, this is awsome, thanks for letting me know ! :D Link to comment Share on other sites More sharing options...
porroone Posted July 31, 2012 Share Posted July 31, 2012 Hey, how do you check for enchantments ? I have been looking for a way to get the equipped armor, but I dont think there is one :/ Link to comment Share on other sites More sharing options...
porroone Posted July 31, 2012 Share Posted July 31, 2012 (edited) OK!! Found out a way to get the equipped armor pieces, using the GetWornForm() function, now to figure out how to get the enchants :/Edit: Hell yeah (Player.GetWornForm(4) as armor).GetEnchantment())Edit2: This is going to take a lot of code lol, I will post the function later.Edit3: Finished the function for Restoration and Destruction spells, its missing the enchant for the ring because my mod works by equipping a ring. Here is the code: Function GetRLCost() curLeft = Player.GetEquippedSpell(1) curRight = Player.GetEquippedSpell(0) SpellPerkL = curLeft.GetPerk() SpellPerkR = curRight.GetPerk() magickacostl = curLeft.GetMagickaCost() magickacostr = curRight.GetMagickaCost() chestEnchant = (Player.GetWornForm(4) as armor).GetEnchantment() bootsEnchant = (Player.GetWornForm(80) as armor).GetEnchantment() handsEnchant = (Player.GetWornForm(8) as armor).GetEnchantment() helmetEnchant = (Player.GetWornForm(2) as armor).GetEnchantment() AmuletEnchant = (Player.GetWornForm(20) as armor).GetEnchantment() if Player.HasPerk(SpellPerkL) magickacostl = magickacostl / 2 endIf if Player.HasPerk(SpellPerkR) magickacostr = magickacostr / 2 endIf while i < chestEnchant.GetNumEffects() i += 1 if chestEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Destruction" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf if chestEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Restoration" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf endWhile i = 0 while i < bootsEnchant.GetNumEffects() i+= 1 if bootsEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Destruction" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf if BootsEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Restoration" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf endWhile i = 0 while i < handsEnchant.GetNumEffects() i+= 1 if handsEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Destruction" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf if handsEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Restoration" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf endWhile i = 0 while i < HelmetEnchant.GetNumEffects() i+= 1 if HelmetEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Destruction" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf if HelmetEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Restoration" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf endWhile i = 0 while i < AmuletEnchant.GetNumEffects() i+= 1 if AmuletEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Destruction" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf if AmuletEnchant.GetNthEffectMagicEffect(i).GetName() == "Fortify Restoration" magickacostr = magickacostr - ((magickacostr*chestEnchant.GetNthEffectMagnitude(i))/100) magickacostl = magickacostl - ((magickacostl*chestEnchant.GetNthEffectMagnitude(i))/100) endIf endWhile endFunction Edited July 31, 2012 by porroone Link to comment Share on other sites More sharing options...
Recommended Posts