Meridias561 Posted January 22, 2013 Author Share Posted January 22, 2013 (edited) Yep. Scriptname TCHavenKeepStarterChestScript extends ObjectReference ;assuming I understand this right, the function sets the timer and ;when the timer ends, fires the event allowing for fast travel ends, etc float property HoursTilNextNoon auto ObjectReference Property chest Auto MiscObject Property OreIron Auto Location Property Embershard Auto ObjectReference Property HavenSiteMarker Auto float function GetCurrentHourOfDay() float Time = Utility.GetCurrentGameTime() Time -= Math.Floor(Time) Time *= 24 Return Time EndFunction function SetTimerForHavenKeepSupply() HoursTilNextNoon = GetCurrentHourOfDay() if HoursTilNextNoon < 12 ;it is before noon RegisterForSingleUpdateGameTime(HoursTilNextNoon) elseif HoursTilNextNoon == 12 ;it is noon, set for next day RegisterForSingleUpdateGameTime(24) else ;it is after noon HoursTilNextNoon = 36 - HoursTilNextNoon RegisterForSingleUpdateGameTime(HoursTilNextNoon) endif endFunction event OnInit() SetTimerForHavenKeepSupply() EndEvent Event OnUpdateGameTime() if (HavenSiteMarker.IsEnabled()) if (Embershard.IsCleared()) chest.AddItem(OreIron, 1, true) Debug.Notification("Adding....?") endif ;actual stuff for AddItem and such goes here endif SetTimerForHavenKeepSupply() endEvent Edited January 22, 2013 by Meridias561 Link to comment Share on other sites More sharing options...
Eckss Posted January 22, 2013 Share Posted January 22, 2013 (edited) Given that you're getting the Debug message, the problem lies in the AddItem line, so here's some things to try:change the line to; chest.AddItem(OreIron, 1, 1) or shift the additem line to below the debug line. Otherwise, is the chest a respawning container?is the chest reference pointing at the correct chest?shouldn't the chest reference be declared as a container?is the oreiron reference pointing at the correct version of iron ore? I think that's it, unless you've got a previous version of the script saved in the savegame you're using for testing and the game's running that instead of the current one. Edited January 22, 2013 by Eckss Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 22, 2013 Share Posted January 22, 2013 Is this script assigned to the chest directly? If so, you have no need to declare the chest as a property. Just use Self instead. -- If you do wish to test this, then be sure to clear the current property value on the form first before deleting it from the script file. Otherwise you will get warnings in the papyrus log. Also is the chest a respawning chest? If so then it may not work at all. From the wikiAn item added to a respawning chest using AddItem will most likely not appear. This is due to the chest resetting its contents every day or so. If the player has not talked to the merchant recently, their inventory will reset before they see the item in it. Link to comment Share on other sites More sharing options...
Meridias561 Posted January 22, 2013 Author Share Posted January 22, 2013 I changed the script to use the Self reference on the chest instead of the chest property, and set the additem to use 1 instead of true and it's working now. Thanks for all the help everybody! :) fyi: not a respawn chest. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted January 22, 2013 Share Posted January 22, 2013 You shouldn't need to change the true to 1. I've had AddItem work fine with true. It was more likely to be confusion with the property trying to declare self :P Link to comment Share on other sites More sharing options...
Recommended Posts