Need help with GetNthEffectMagnitude

Post » Sat Nov 24, 2012 6:24 pm

So, I made a complete food overhaul to make it somewhat useful. As a rule of thumb any meat-based foods fortify health, any fish-based foods fortify magicka and just about everything else fortifies stamina [some beverages fortify magicka, some others fortify health].

Needing a way to to set a limit to the boost the player can gain I came up with this:

Scriptname HealthBoostCheck extends activemagiceffect  Message Property FoodNoHealthEffectMSG autoGlobalVariable Property FoodHealthBoost  autofloat FoodHealthBoostEvent OnEffectStart(actor akTarget, actor akCaster)	FoodHealthBoost = Game.GetPlayer().GetActorValue("Health") - Game.GetPlayer().GetBaseActorValue("Health")	FoodHealthBoost.Setvalue(FoodHealthBoost)	if (FoodHealthBoost >=  50)			FoodNoHealthEffectMSG.Show()	endIfEndEventevent OnEffectFinish(actor akTarget, actor akCaster)	FoodHealthBoost = Game.GetPlayer().GetActorValue("Health") -  Game.GetPlayer().GetBaseActorValue("Health")	FoodHealthBoost.Setvalue(FoodHealthBoost)EndEvent

This is attached to the FoodFortifyHealth effect, with a HealthBoost < 50 condition to apply the effect itself. The same applies to the other two stamina and magicka scripts.

I'm not satisfied with this solution because if the player is already under some attributes fortifying effect the food doesn't give any advantage over the current effect. So I thought I might store the food effect magnitude in a variable but I have to read its value with GetNthEffectMagnitude first and I have no idea on how to use it. To begin with I'd need something like this:

Scriptname HealthBoostCheck extends activemagiceffect  GlobalVariable Property FoodHealthBoost  autoPotion CurrentFoodEvent OnEffectStart(actor akTarget, actor akCaster)	Int magnitude = CurrentFood.GetNthEffectMagnitude(0) as Int	FoodHealthBoost.Setvalue(magnitude)EndEvent*snip*

This obviously doesn't work because CurrentFood is non-existing. Where am I supposed to use GetNthEffectMagnitude, and how?

For some obscure reason scripts can't be attached to potions and I'm not sure if OnItemRemoved might be of any help here [does it even check for consumed items?]. This would have been MUCH easier if the CK would have let me read the and values directly : /

Long story short: how do I get around this?
User avatar
Ronald
 
Posts: 3319
Joined: Sun Aug 05, 2007 12:16 am

Return to V - Skyrim