Jump to content

How to make a quest adding a new spell to the player permanently?


gigantibyte

Recommended Posts

There are at least a few different ways to add a spell to the player on mod load, below is probably the quickest (not necessarily the cleanest) way:

  1. Check the box for starting the quest game enabled
  2. Set up your stages, e.g., 0 and 10, based on what actions you want to take; if you're just adding a spell for example, you can get away with just 2 stages
  3. Set up a script to your entry stage 0 to give the spell to the player (sounds like you've already done this part); also in this stage, do a SetStage(10) once the spell is added
  4. For stage 10, do a Stop()

 

So your stage 0 script would look something like this:

If(Game.GetPlayer().AddSpell(SpellToAdd01, true))
MsgToDisplay.Show()
endIf
SetStage(10)

Your stage 10 script would look something like this:

Stop()

Link to comment
Share on other sites

I created a stage 0, but I can't attach a script without a log entry. So I made an empty log entry and attached the script I made in the kmyQuest window. However, when I click ok and go back, the kmyQuest window resets to 'NONE'. Is this script is ok?

 

Scriptname MyQuestScript0 extends Quest

Spell Property MySpell Auto 

EVENT OnInit()    


if !Game.GetPlayer().HasSpell(MySpell)
Game.GetPlayer().AddSpell(MySpell)
endif

SetStage(99)

EndEvent

 

 

I didn't have a message to display, so I hope this works as good. Also, if stage 99 does not exist, I'm assuming the quest will be advanced to the last stage?

Link to comment
Share on other sites

Just create an empty log entry. Also, you do NOT need to do this as an event, much less using OnInit(). Just drop the sample excepts I put into each of the empty stage entries for 0 and 99 respectively.
Link to comment
Share on other sites

Just create an empty log entry. Also, you do NOT need to do this as an event, much less using OnInit(). Just drop the sample excepts I put into each of the empty stage entries for 0 and 99 respectively.

 

Do you mean in the Papyrus Fragment window? I don't need the property line?

 

Edit:

 

Pasting your script into the Papyrus Fragment window results in compile errors saying my spell and 'MsgToDisplay' is undefined.

Edited by gigantibyte
Link to comment
Share on other sites

Pasting your script into the Papyrus Fragment window results in compile errors saying my spell and 'MsgToDisplay' is undefined.

If you don't want to show a separate message to the player on the spell add, just comment out or delete that line.

Link to comment
Share on other sites

Pasting your script into the Papyrus Fragment window results in compile errors saying my spell and 'MsgToDisplay' is undefined.

If you don't want to show a separate message to the player on the spell add, just comment out or delete that line.

 

Still get compile errors. But part of my main problem in getting this to work, was the fact I wasn't testing on a saved game where the mod had not been installed.

 

You are right that there are "a few different ways" ways of adding a spell to the player on mod activation. I'm too much of a novice to understand the arguments being made for the "best" way, I just want something that works and doesn't adversely mess up the player's game. My goal was achieved by going back with the OnInit() event on the advice I got here.

 

Thank you for replying. It's not always easy finding help.

Link to comment
Share on other sites

I'd recommend following the procedure set forth above but do so in a NEW quest. If you're binding the scripts to an existing quest that has already run in your existing save, that may be why it's not working. Regarding the compile errors, what's the content of the line(s) the compiler barfs at?

 

Regarding OnInit(), you CAN use that approach, but I tend to avoid using it more from personal preference, and the spell add in this case will trigger without using OnInit().

Link to comment
Share on other sites

  • Recently Browsing   0 members

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