Drain magic instead of Health when hit, Script Help

Post » Wed Jun 20, 2012 3:49 am

I have been working on a monk mod for some time now, and have had great success in balancing out my changes, adding perks, etc. The problem is I have hit a wall in terms of scripting, as I am just a novice.


What I am trying to do is this=
I want damage taken (magic damage and pyschical) to drain mana instead of health, and then to drain health once mana reaches 0.


I just cant seem to figure out how to script incoming damage to subtract from magicka appropriately, or how to make it switch over to health when magicka reaches 0 (as regenerating magicka means it wont be 0 for long). Please help if you can! =)
User avatar
Sakura Haruno
 
Posts: 3446
Joined: Sat Aug 26, 2006 7:23 pm

Post » Wed Jun 20, 2012 11:56 am

Not a perfect solution but the best I can think of on the top of my head.

In a rather tight OnUpdate event loop you have to monitor the players health tracking it and the previous health along with the current magicka. If the previous health is more than the current health, do nothing. If less than the previous health, determine the difference.If the player has less magicka than health damaged, subtract the remaining magicka they do have from the amount of damage to get a new damagehealth value and go ahead and decrease your magicka and just increase your health by the difference. If the player had enough magicka to absorbe all the damage, then heal your character the appropriate amount.

Be sure to use DamageActorValue and RestoreActorValue.

-MM

Edit: Obviously this would be a script on a spell applied as an ability with constant effect.
User avatar
Laura Hicks
 
Posts: 3395
Joined: Wed Jun 06, 2007 9:21 am

Post » Wed Jun 20, 2012 9:32 am

I hadnt considered that option, it is an interesting work around to be sure. I will try scripting it but in the meantime I am still up for additional suggestions!
User avatar
Elizabeth Lysons
 
Posts: 3474
Joined: Fri Feb 02, 2007 7:16 am


Return to V - Skyrim