Jump to content

Help with a script that isn't working


wilwhitt56

Recommended Posts

I'm trying to adjust a script me and another person were working on that isn't working. It saved, but it won't activate. Essentially it's suppose to give you a spell at a set level for my race. Maybe some fresh eyes can see what's wrong?

Scriptname AAFahrnymphGiveSpellScript extends Quest

Spell Property AAConjureWolfIllusion Auto

quest property LevelUpQuest Auto

Race property AAFahrnymphRace Auto

Event OnStoryIncreaseLevel (int aiNewLevel)

if (aiNewLevel >=10)

endif

Debug.notification("AAFahrnymphGiveSpellScript has detected the player has leveled up to level: "+aiNewLevel + "!")



if (Game.Getplayer().GetRace() == AAFahrnymphRace)

	if(aiNewLevel >=10 && !Game.GetPlayer().HasSpell(AAConjureWolfIllusion))

		Game.GetPlayer().AddSpell(AAConjureWolfIllusion)

endif

endif

LevelUpQuest.stop()

endevent

Link to comment
Share on other sites

Your posted script stops the quest after all conditions are checked but it is outside of the condition blocks.  This means that first run of the script will stop the quest even if that particular run does not match your conditions.

Here is a variation that should do what you are wanting:

Scriptname AAFahrnymphGiveSpellScript extends Quest

Spell Property AAConjureWolfIllusion Auto
quest property LevelUpQuest Auto
Race property AAFahrnymphRace Auto

Event OnStoryIncreaseLevel (int aiNewLevel)
  Debug.notification("AAFahrnymphGiveSpellScript has detected the player has leveled up to level: "+aiNewLevel + "!")
  If !(Game.Getplayer().GetRace() == AAFahrnymphRace)
  ; not matching race - stop quest
    LevelUpQuest.stop()
  Else
    If (aiNewLevel >=10 && !Game.GetPlayer().HasSpell(AAConjureWolfIllusion))
      ; greater than or equal to 10 and does not have spell - give spell
      Game.GetPlayer().AddSpell(AAConjureWolfIllusion)
      LevelUpQuest.stop()
      ; got the spell - stop quest
    EndIf
  EndIf
Endevent

Now you do want to make sure that your properties are filled and that you are testing on a new game or one that has not seen your mod.  The purpose of that is to ensure that the data is loaded fresh and nothing in the save file is getting in the way of any adjustments.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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