AddItem on Start Quest - Not working right

Post » Sun Jun 17, 2012 1:08 pm

Ok, this is probably a question for the more experienced modders/scripters.

I've made a new quest, that is a start quest. I only want it to do one thing: Add items to a container.

I've made the script, it is set up to add the item (and display a debug message to say it has run), set up the quest, all is good.

I run the game, and upon loading I get the debug message saying the item is added (so the code is running). However the item hasn't been added to the container.

If I stop the quest using the console and restart it, I get the debug message saying the item has been added and the item IS added.

So, the code is correct, it just refuses to add when the quest is automatically started by the game. Any ideas on why this might be or how I might fix it?

I'll attach the code below (for those that have messed around with this, the properties have been set up correctly through the CK):

Spoiler
Scriptname AATestFactionInventorySCRIPT extends Quest Hidden
ObjectReference Property WarmChest Auto
Armor Property ChefOutfit Auto
EVENT OnInit()
WarmChest.AddItem(ChefOutfit, 3)
Debug.MessageBox("Item Added via second method")
endEVENT
User avatar
emily grieve
 
Posts: 3408
Joined: Thu Jun 22, 2006 11:55 pm

Post » Sun Jun 17, 2012 11:14 am

In Papyrus, you can't reference forms directly by their editorIDs anymore. Unless they're parameters for events or other functions, you have to use a property (like you've done for ChefOutfit).

Duh... misread your code.

Cipscis
User avatar
Chloe Yarnall
 
Posts: 3461
Joined: Sun Oct 08, 2006 3:26 am

Post » Sun Jun 17, 2012 12:33 pm

Are you sure you have assigned the proper values to WarmChest and ChefOutfit? I've never modded any of the Bethesda games, but from what I read on the CK wiki, you must do this from the GUI if you do not do it in the script itself.
Edit: Nevermind. Apparently I too should pay proper attention to the entire post before answering. I would still suggest that you double check that WarmChest is set to the correct instance of the ObjectReference type. It seems to be the most obvious thing that could go wrong. Maybe you could manipulate the chest in some other way, to confirm?
User avatar
clelia vega
 
Posts: 3433
Joined: Wed Mar 21, 2007 6:04 pm

Post » Sun Jun 17, 2012 1:05 pm

What flags do you have checked on your quest? During beta testing, there was some funniness with http://www.creationkit.com/OnInit running twice if a quest was "Start Game Enabled" but not set to "Run Once". This might be related.

Also, just out of curiosity, why have you made this script hidden?

Cipscis
User avatar
Jordyn Youngman
 
Posts: 3396
Joined: Thu Mar 01, 2007 7:54 am

Post » Sun Jun 17, 2012 12:46 pm

I made it hidden to see if it did anything :-P

WarmChest is definately set correctly, as it works if I restart the quest in the console.

It is actually running twice, but that should only make it add the item 6 times instead of 3. I'll try doing RunOnce to see if it fixes it though.
User avatar
Roisan Sweeney
 
Posts: 3462
Joined: Sun Aug 13, 2006 8:28 pm

Post » Mon Jun 18, 2012 3:38 am

As a blind guess, perhaps the container isn't in a good state to have items added to it right at the beginning?

Try adding a call to http://www.creationkit.com/Wait_-_Utility beforehand as a test.

Cipscis
User avatar
Agnieszka Bak
 
Posts: 3540
Joined: Fri Jun 16, 2006 4:15 pm

Post » Sun Jun 17, 2012 5:41 pm

RunOnce didn't improve the situation. Item still doesn't appear (and I can't restart the quest in the console to make it appear now obviously).

Maybe there is an issue with adding items to things on the first frame/s after loading a game...
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm

Post » Sun Jun 17, 2012 2:35 pm

As a blind guess, perhaps the container isn't in a good state to have items added to it right at the beginning?

Try adding a call to http://www.creationkit.com/Wait_-_Utility beforehand as a test.

Cipscis

Heh. Great minds. Was just about to try that.
User avatar
Madison Poo
 
Posts: 3414
Joined: Wed Oct 24, 2007 9:09 pm

Post » Sun Jun 17, 2012 7:51 pm

Ok... Wait worked. I might add something to the Wiki saying not to immediately add items.
User avatar
Beulah Bell
 
Posts: 3372
Joined: Thu Nov 23, 2006 7:08 pm

Post » Sun Jun 17, 2012 5:53 pm

Good to know. I wonder what else might require this precaution?

Cipscis
User avatar
katie TWAVA
 
Posts: 3452
Joined: Tue Jul 04, 2006 3:32 am


Return to V - Skyrim