Jump to content

Recharge Enchanment spell script fail : (


BloodyRain

Recommended Posts

I was trying to make a mysticism spell with that you can charge your weapons enchantment with your magicka.

 

I also just noticed that I screwed up the formula for the amount of energy recharged, it should be more charge for less magicka the higher your mysticism is but I think it wouldn't be like that currently, well whatever

 

what it should do: (with broken formula)

 

add PC Mysicism / 10 * Magicka to weapons charge where Magicka is either the amount needed to bring it to full charge or the amount the player has

I was aiming for a restoration ratio of 10 energy per magicka at 100 Mysticism, gonna try to make the formula for that later.

 

what it does: (broken formula too)

 

reducing magicka for the amount said with messageex, adding no charge, breaking magicka recovery since it mosttimes manages to reduce magicka below 0

 

before that NewCharge part it was modequippedcurrentcharge 16 ToCharge and didn't work too.

 

I'm using OBSE 0019 and if someone is bored enough to help me with this i'll gladly accept that help XD or just point me to a similiar mod, I'm about to give supreme magic a try but as I fast read through it it charges your weapons with your health and not magicka : /

 

scn RechargeEnchantmentScript

begin ScriptEffectStart

short PCMyst
short PCMagicka
ref PCWpn
short WpnCharge
short WpnMaxCharge
short ToCharge
short MagickaCost

set PCMyst to player.getav mysticism
set PCMagicka to player.getav magicka
set PCWpn to player.getequippedobject 16
set WpnCharge to player.getequippedcurrentcharge 16
set WpnMaxCharge to player.getobjectcharge PCWpn
set ToCharge to (WpnMaxCharge - WpnCharge)
set MagickaCost to (PCMyst / 10) * ToCharge

if MagickaCost > PCMagicka
set ToCharge to PCMagicka * (PCMyst / 10)
set MagickaCost to (PCMyst / 10) * ToCharge
endif

if MagickaCost < 0
return
elseif ToCharge < 0
return
endif

short NewCharge

set NewCharge to WpnCharge + ToCharge

player.setequippedcurrentcharge 16 NewCharge
incrementplayerskilluse mysticism 1 (ToCharge / 10)

messageex "%n charged with %g energy for %g magicka" PCWpn ToCharge MagickaCost

set MagickaCost to -MagickaCost
player.modav magicka MagickaCost

return

end

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...