morrowind1979 Posted November 22, 2017 Share Posted November 22, 2017 I cant get my feeding/perk script to run correctly. This is what I have: Scriptname MW1979DemonFeedScript extends ActiveMagicEffect SPELL Property Claws25 Auto SPELL Property Claws50 Auto SPELL Property Claws75 Auto SPELL Property Claws100 Auto SPELL Property DMAbsorb Auto GlobalVariable Property FeedCNT Auto Race Property MW1979DemonRaceAbsorb Auto Event OnEffectStart(Actor Target, Actor Caster) FeedCNT.SetValueInt(FeedCNT.GetValueInt() + 1) EndEvent Event OnEffectFinish(Actor Target, Actor Caster) If FeedCNT.GetValue() == 49 Game.GetPlayer().AddSpell(Claws25) If FeedCNT.GetValue() == 99 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws50) If FeedCNT.GetValue() == 199 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws75) If FeedCNT.GetValue() == 499 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().AddSpell(Claws100) If FeedCNT.GetValue() == 999 Game.GetPlayer().SetRace(MW1979DemonRaceAbsorb) Game.GetPlayer().AddSpell(DMAbsorb) EndIf EndIf EndIf EndIf EndIf EndEvent The problem is that the global is being increased correctly(I checked this with console commands.) But the spells are not being removed or added when the global reaches the corresponding value. Does anyone know what I am doing wrong? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 22, 2017 Share Posted November 22, 2017 Your EndIf positions are all wrong. The way it is now, it is expecting the global variable value to be 49 before it will check to be 99. There is no way that the value can be five different things at the same time. Try changing it to as follows: Event OnEffectFinish(Actor Target, Actor Caster) If FeedCNT.GetValue() == 49 Game.GetPlayer().AddSpell(Claws25) ElseIf FeedCNT.GetValue() == 99 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws50) ElseIf FeedCNT.GetValue() == 199 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws75) ElseIf FeedCNT.GetValue() == 499 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().AddSpell(Claws100) ElseIf FeedCNT.GetValue() == 999 Game.GetPlayer().SetRace(MW1979DemonRaceAbsorb) Game.GetPlayer().AddSpell(DMAbsorb) EndIf EndEvent Link to comment Share on other sites More sharing options...
morrowind1979 Posted November 22, 2017 Author Share Posted November 22, 2017 Your EndIf positions are all wrong. The way it is now, it is expecting the global variable value to be 49 before it will check to be 99. There is no way that the value can be five different things at the same time. Try changing it to as follows: Event OnEffectFinish(Actor Target, Actor Caster) If FeedCNT.GetValue() == 49 Game.GetPlayer().AddSpell(Claws25) ElseIf FeedCNT.GetValue() == 99 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws50) ElseIf FeedCNT.GetValue() == 199 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws75) ElseIf FeedCNT.GetValue() == 499 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().AddSpell(Claws100) ElseIf FeedCNT.GetValue() == 999 Game.GetPlayer().SetRace(MW1979DemonRaceAbsorb) Game.GetPlayer().AddSpell(DMAbsorb) EndIf EndEvent Exact same result: The global is increased but the spells & swaprace are not added to the player. Got it to work using this script changing == to >=(the game dosen't seem to like ==). But the problem I have now is that all spell adds and raceswaps work fine. But the spell added messages are being displayed every time the player feeds instead of only when the global has met its value. Scriptname MW1979DemonFeedScript extends ActiveMagicEffect SPELL Property Claws25 Auto SPELL Property Claws50 Auto SPELL Property Claws75 Auto SPELL Property Claws100 Auto SPELL Property DMAbsorb Auto GlobalVariable Property FeedCNT Auto Race Property DemonRaceAbsorb Auto Event OnEffectStart(Actor Target, Actor Caster) If FeedCNT.GetValue() <= 2000 FeedCNT.SetValueInt(FeedCNT.GetValueInt() + 1) EndIf If FeedCNT.GetValue() >= 49 Game.GetPlayer().AddSpell(Claws25) If FeedCNT.GetValue() >= 99 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws50) If FeedCNT.GetValue() >= 199 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws100) Game.GetPlayer().AddSpell(Claws75) If FeedCNT.GetValue() >= 499 Game.GetPlayer().RemoveSpell(Claws25) Game.GetPlayer().RemoveSpell(Claws50) Game.GetPlayer().RemoveSpell(Claws75) Game.GetPlayer().AddSpell(Claws100) If FeedCNT.GetValue() >= 999 Game.GetPlayer().SetRace(DemonRaceAbsorb) Game.GetPlayer().AddSpell(DMAbsorb) EndIf EndIf EndIf EndIf EndIf EndEvent Link to comment Share on other sites More sharing options...
morrowind1979 Posted November 22, 2017 Author Share Posted November 22, 2017 Fixed it! Got it working by adding a seperate global and condition for each spell that is added to the above script. Now everything works and the addspell messages are only displayed once Link to comment Share on other sites More sharing options...
Recommended Posts