STEAM GROUP
Skyrim Creation Kit (Public) CKPublic
STEAM GROUP
Skyrim Creation Kit (Public) CKPublic
88
IN-GAME
1,098
ONLINE
Founded
February 7, 2012
All Discussions > Papyrus Corner > Topic Details
Kempeth May 21, 2015 @ 2:48pm
Solved: Give the player an item when game loads
I'm going up the wall. I need to give the player an item necessary for the mod. I used to do the same for powers but all of a sudden* it doesn't work anymore! What am I doing wrong?

Scriptname _DS_MyScript extends Quest Event OnInit() if (!player.HasSpell(SpellCrystallize)) player.AddSpell(SpellCrystallize) endif if (!player.HasSpell(SpellSoulForge)) player.AddSpell(SpellSoulForge) endif if (player.GetItemCount(ItemDummyGem) == 0) player.AddItem(ItemDummyGem, 1) endif EndFunction Spell Property SpellCrystallize Auto Spell Property SpellSoulForge Auto SoulGem Property ItemDummyGem Auto

*I had to reinstall Skyrim because updating SKSE broke the game. Then I had to resubscribe to all my mods. Now Skyrim complains about some missing content.
Last edited by Kempeth; May 22, 2015 @ 11:11am
< >
Showing 1-8 of 8 comments
NH_ May 21, 2015 @ 9:42pm 
since the curated mods debacle scripts have been packaged in a .rar file. just unpackage it and make sure the scripts end up in data/scripts. install skse after you unpackage it. as for missing content your load order is probably different now and your saved games are most likely borked.
Kempeth May 22, 2015 @ 9:48am 
Thanks. But I think I figured out what the problem was. I just saved and reloaded to make the error go away. All I cared about seemed to still be there.

As for the script I think It can only run once - ever. I preciously used it to just give the player the two powers. So I assume the quest has somehow moved beyond the stage where this script is called.

I've had to use the ResetQuest command in the console and hot load my mod again. Is there a way to make the script run on every game load?
NH_ May 22, 2015 @ 9:51am 
uncheck run once?
Kempeth May 22, 2015 @ 9:52am 
That didn't help. All that did was call the script twice on the first load but still not on any following loads.
Kempeth May 22, 2015 @ 10:08am 
Still doesn't run more than once :(
Kempeth May 22, 2015 @ 11:02am 
OK. Close but still no cigar.

My scripts now look like this:
Scriptname _DS_ScriptGiveSoulGemPowers extends Quest {If the script needs to run again use fcf + ResetQuest + hlp} Float fVersion Spell Property SpellCrystallize Auto Spell Property SpellSoulForge Auto SoulGem Property ItemSoulGemDummy Auto Float Property NewVersion Auto Event OnInit() Maintenance(); EndEvent Function Maintenance() debug.MessageBox("Maintenance..."); if (fVersion < NewVersion) debug.Notification("Giving the player his powers, if necessary."); Actor player = Game.GetPlayer(); if (!player.HasSpell(SpellCrystallize)) player.AddSpell(SpellCrystallize); endif if (!player.HasSpell(SpellSoulForge)) player.AddSpell(SpellSoulForge); endif if (player.GetItemCount(ItemSoulGemDummy) <= 0) debug.Notification("Giving the player the gem"); player.AddItem(ItemSoulGemDummy); else debug.Notification("Player already has the gem"); endif fVersion = NewVersion; endif EndFunction Scriptname _DS_ScriptPlayerUpdate extends ReferenceAlias {Updates the player (adding stuff from new version)} _DS_ScriptGiveSoulGemPowers Property QuestScript Auto Event OnPlayerLoadGame() QuestScript.Maintenance(); EndEvent

I can get the "Maintenance" MessageBox to show up every time I load the game. But the notifications only occur when a new game is started.
Kempeth May 22, 2015 @ 11:10am 
Never mind. I have found the problem. Apparently the creation kit doesn't reliably update Float Properties. When I listed the old and new version in the MessageBox they were the same.

I've changed:
if (fVersion < NewVersion) ... fVersion = NewVersion;
to:
Float fNewVersion = 2; if (fVersion < fNewVersion) ... fVersion = fNewVersion;

And it works now. Thanks you nh_!
< >
Showing 1-8 of 8 comments
Per page: 1530 50

All Discussions > Papyrus Corner > Topic Details