enderalse/scripts/source/_00e_fs_recipe.psc

51 lines
1.2 KiB
Plaintext

Scriptname _00E_FS_Recipe extends ObjectReference
{Will teach the player the some of the effects of the given ingredients}
Ingredient Property ing0 = None Auto
Ingredient Property ing1 = None Auto
Ingredient Property ing2 = None Auto
Ingredient Property ing3 = None Auto
Ingredient Property ing4 = None Auto
Ingredient Property ing5 = None Auto
MagicEffect Property effect0 = None Auto
MagicEffect Property effect1 = None Auto
MagicEffect Property effect2 = None Auto
MagicEffect Property effect3 = None Auto
Event OnRead()
MagicEffect[] effects = new MagicEffect[4]
effects[0] = effect0
effects[1] = effect1
effects[2] = effect2
effects[3] = effect3
If ing0 != None
_TeachEffects(ing0, effects)
EndIf
If ing1 != None
_TeachEffects(ing1, effects)
EndIf
If ing2 != None
_TeachEffects(ing2, effects)
EndIf
If ing3 != None
_TeachEffects(ing3, effects)
EndIf
If ing4 != None
_TeachEffects(ing4, effects)
EndIf
If ing5 != None
_TeachEffects(ing5, effects)
Endif
EndEvent
Function _TeachEffects(Ingredient ing, MagicEffect[] effects)
int i = ing.getNumEffects()
While i > 0
i -= 1
if effects.Find(ing.getNthEffectMagicEffect(i)) != -1
ing.LearnEffect(i)
Endif
EndWhile
EndFunction