Setup quest to add spell to player ...and global variables

Post » Sun Nov 18, 2012 8:00 pm

I'd just like a spell to be added once when the player first installs my mod. Not having much luck setting it up. Can someone give me the 'for Dummies' explanation? I get all kinds of compile errors when I try to use the Papyrus fragment section.

Also, I'd like to be able to store some configuration variables selected by the player. I think in geck I would have used quest variables, but that does not seem to be an option now. Do I use globals?
User avatar
Lou
 
Posts: 3518
Joined: Wed Aug 23, 2006 6:56 pm

Post » Sun Nov 18, 2012 9:53 pm

Attach...
ScriptName YourQuestScript Extends Quest ConditionalActor Property PlayerREF AutoBool Property bYourBool Auto ConditionalSpell Property YourSPEL AutoEvent OnInit()	PlayerREF.AddSpell(YourSPEL)EndEvent
...to a quest with its http://www.creationkit.com/Quest_Data_Tab flags ticked and the spell will be added.

The 'Conditional' keywords will allow you to check bYourBool's value from effects/MessageBox buttons/etc. using http://www.creationkit.com/GetVMQuestVariable.

To get/set bYourBool from another script:
YourQuestScript Property QuestScript AutoEvent SomeEvent()	QuestScript.bYourBool = TrueEndEvent
The 'Conditional' keywords are not necessary for a script to manipulate the variable.
User avatar
e.Double
 
Posts: 3318
Joined: Tue Jul 24, 2007 11:17 pm

Post » Sun Nov 18, 2012 8:46 pm

Attach...
ScriptName YourQuestScript Extends Quest Conditional Actor Property PlayerREF Auto Bool Property bYourBool Auto Conditional Spell Property YourSPEL Auto Event OnInit() PlayerREF.AddSpell(YourSPEL) EndEvent
...to a quest with its http://www.creationkit.com/Quest_Data_Tab flags ticked and the spell will be added.


Thanks, but this adds the spell every time a game is loaded, even a game saved after the mod was installed. 'Run Once' seems to do nothing. Any ideas?


Edit:

Nevermind. I had to deactivate my mod, run the game and save without the mod, then activate the mod and load the last saved game. The spell is only added once now. Gracias.
User avatar
yermom
 
Posts: 3323
Joined: Mon Oct 15, 2007 12:56 pm

Post » Sun Nov 18, 2012 2:57 pm

So the suggested method works great. But let's say the first time I released this mod without any quest variables set. The updated mod now uses them. I can give the users a warning as such:

To upgrade properly from a previous version:

- deactivate the mod
- load a game
- ignore warning that content is missing
- save a game without the mod
- install new version
- activate
- load game saved without the mod

but I expect some will ignore the instructions. Is there a chance my mod will crash the game if it calls on quest variables that don't exist for the user?
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am


Return to V - Skyrim