Script Question - Absorb Frost

Post » Fri Aug 13, 2010 3:48 am

Hmmm, I don't know if editing the spell while it's already active on the player will work. I think you may have to remove it and reapply it after you make any changes.

EDIT: Another idea: Get an activator to cast a restore health on the player. Might look ugly though.
User avatar
REVLUTIN
 
Posts: 3498
Joined: Tue Dec 26, 2006 8:44 pm

Post » Fri Aug 13, 2010 5:16 am

scn HVHAbsorbFrostScriptOBSElong FrostMagref UserRefBegin OnEquip	UserRef.PlayMagicShaderVisuals HVHEffectAbsorbFrostEndBegin OnUnequip	UserRef.StopMagicShaderVisuals HVHEffectAbsorbFrostEndBegin GameMode	set UserRef to GetContainer	if ( UserRef.GetEquipped HVHIceRobeOBSE == 0 )		return	endif	set FrostMag to UserRef.GetTotalActiveEffectMagnitude FRDG	if ( FrostMag >= 1 )		if ( UserRef.HasSpell HVHAbsorbFrostHeal == 0 )			UserRef.AddSpellNS HVHAbsorbFrostHeal		endif		set FrostMag to ( FrostMag * 2 )		SetNthEffectItemMagnitude FrostMag HVHAbsorbFrostHeal 0	else		if ( UserRef.HasSpell HVHAbsorbFrostHeal == 0 )			UserRef.RemoveSpellNS HVHAbsorbFrostHeal		endif	endifEnd

Here's attempt #4. I modified attempt #2, under the assumption the problem was the 0-magnitude restore health ability. This method instead uses a 1-point restore health ability, applied only when the user is experiencing frost damage, and removed otherwise. Otherwise, it is the same as attempt #2. This script doesn't do much more than the previous 3 attempts however, but something interesting happened that may be significant.

When i looked in my "Active effects" page, I saw "Frost Damage" present (17 points of it, in fact). However, "restore health" was nowhere to be seen. This means that, for whatever reason, "UserRef.AddSpellNS HVHAbsorbFrostHeal" did not happen.

EDIT: Upon review, I found out why the spell isn't added. "if ( UserRef.HasSpell HVHAbsorbFrostHeal )" should be "if ( UserRef.HasSpell HVHAbsorbFrostHeal == 0) ". Testing now...

Tested. Nothing changed, the restore health ability still didn't apply.
User avatar
Klaire
 
Posts: 3405
Joined: Wed Sep 27, 2006 7:56 am

Post » Thu Aug 12, 2010 5:47 pm

I've just hit a massive breakthrough. By putting console printouts into the script, I've discovered that an unchanged Frost Damage effect is actually registered by the game (or at least by OBSE) as a Negative! All this time, I was checking to see if the magnitude was greater than 0, but when I should have been checking if it was less than 0!

I've just applied this knowledge to my third script, the one that ran through every active effect and reversed the magnitude of any frost damage. It works!!!! The player experiences frost damage, and it shows in the Active Effects menu as being a positive magnitude as before, but the player regenerates health instead of losing it!

The only note is that if the player's health is at 1 and he gets hit by a fresh frost damage effect, it can kill the player. Basically, a high-magnitude frost damage spell is still capable of killing. However, if the user survives the first frame, it'll heal instead of damage, as desired. The only way to get around this, I think, would be to reverse the effect before the user feels it, which is pretty much impossible.
User avatar
-__^
 
Posts: 3420
Joined: Mon Nov 20, 2006 4:48 pm

Post » Fri Aug 13, 2010 4:17 am

I gotta say, that's pretty cool.
User avatar
Bellismydesi
 
Posts: 3360
Joined: Sun Jun 18, 2006 7:25 am

Post » Thu Aug 12, 2010 8:40 pm

I know, isn't it?

I'm working on a nice robe mesh right now (female is pretty much done, haven't started on male), and I'll be making a short (yet difficult) quest for it. Once that's all done, I'll release a mod featuring these scripts for the masses to enjoy, and devour their frost-bearing enemies!
User avatar
Nicola
 
Posts: 3365
Joined: Wed Jul 19, 2006 7:57 am

Post » Fri Aug 13, 2010 5:47 am

I'm happy for you that you got it to work! Nice going. So damage spells register as negative? I haven't gotten my resist sundamage effect working yet, because there isn't a good way to store what the effects magnitudes were before changing, atleast not without arrays I think. I don't want to set it to negative (or positive as the case may be) because that would heal you instead of just protecting you depending on what sun conditions there are. So close! :D
User avatar
Wanda Maximoff
 
Posts: 3493
Joined: Mon Jun 12, 2006 7:05 am

Previous

Return to IV - Oblivion