Jump to content

[LE] More Scripting help with magic effect


Recommended Posts

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

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

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...