Hello everyone. I've been modding Oblivion of many years now, and I have yet to run into something that I haven't been able to solve on my own. However, today, as I was writing what should have been a simple magic script effect, I hit a brick wall, that being, my script is causing CTDs. IT should be noted that the crash does not occur immediately upon activating the effect, but rather several seconds later, and seemingly at arbitrary intervals.
Basically, I was attempting to create an ability that will push damage from health to magicka until such time as the player runs out of magicka. My script it as follows:
scn aaaAbRaceLianidMagickaShieldSCRIPTshort hpshort curr_hpshort prev_mpshort curr_mpshort max_mpshort mod_amtbegin scripteffectstart set hp to player.Getav health set max_mp to player.GetBaseActorValue magicka player.modav magicka max_mp set prev_mp to player.getav magicka endbegin scripteffectupdate set curr_mp to player.getav magicka if (curr_mp > prev_mp) ; Punish the player and remove the spell player.removespellns aaaAbRaceLianidMagickaShield set mod_amt to player.getav fatigue set mod_amt to mod_amt * -2 player.modav2 fatigue mod_amt else set curr_hp to player.Getav health if (curr_hp > hp) set hp to curr_hp endif if (curr_hp < hp) set mod_amt to hp - curr_hp set curr_mp to curr_mp - mod_amt if (curr_mp >= 0) set mod_amt to mod_amt + curr_mp removespellns aaaAbRaceLianidMagickaShield player.modav2 health mod_amt set mod_amt to mod_amt * -1 player.modav2 magicka mod_amt else player.modav2 health mod_amt set mod_amt to mod_amt * -1 player.modav2 magicka mod_amt endif endif endif set prev_mp to player.getav magickaendbegin scripteffectfinish set max_mp to max_mp * -1 player.modav magicka max_mp player.addspellns aaaAbRaceLianidMSCoolDownend
... Now it's not like I'm trying to do anything complicated here, and I'm just not seeing (or possibly don't know any better) what could be causing the issue. Your input would be most appreciated, and thank you for your time.
edit: Forgot to mention, I have GOTY Edition running with OBSE and Cobl, and all of them should be fully up to date.