krestor Posted April 16, 2023 Posted April 16, 2023 I am trying to make a script that will add 5 silver ore to a chest after one in game day has passed after the chest has been enabled this is what i have so far If GetGlobalValue GameDaysPassed == 1 SilverOreChest1.AddItem SilverOre 5 Else GetGlobalValue GameDaysPassed =< 1 SilverOreChest1.AddItem SilverOre 0 EndIf
MadMansGun Posted April 16, 2023 Posted April 16, 2023 (edited) 1 hour ago, krestor said: GetGlobalValue GameDaysPassed =< 1 SilverOreChest1.AddItem SilverOre 0 don't know about making it work but this part is unnecessary for sure, delete it. Edited April 16, 2023 by MadMansGun
Seijin8 Posted April 16, 2023 Posted April 16, 2023 1 hour ago, krestor said: I am trying to make a script that will add 5 silver ore to a chest after one in game day has passed after the chest has been enabled this is what i have so far If GetGlobalValue GameDaysPassed == 1 SilverOreChest1.AddItem SilverOre 5 Else GetGlobalValue GameDaysPassed =< 1 SilverOreChest1.AddItem SilverOre 0 EndIf Setting aside that this isn't remotely formatted correctly... ... Where does the script check if the object is enabled? Is the script supposed to be attached to the chest itself? I hope you only plan on having one of them. Probably needs at minimum a way to track the last time it was opened, or was it only supposed to work on the first day of the game? As MMG spotted, why would you run a function that did nothing? Just do nothing. Someone who is better caffeinated and more awake should look at this before it is used, but in general, it would look like this: Scriptname NotThatWellThoughtOutScript extends ObjectReference Actor property PlayerRef auto MiscObject property SilverOre auto float fDayLastOpened = 0.0 Event OnActivate(ObjectReference akActionRef) If akActionRef == PlayerRef float fCompare = Utility.GetCurrentGameTime() If fCompare >= (fDayLastOpened + 1.0) self.AddItem(SilverOre, 5) fDayLastOpened = fCompare EndIf EndIf EndEvent
krestor Posted April 16, 2023 Author Posted April 16, 2023 @Seijin8 I am trying to make a chest that fills with ore every day to simulate workers in a mine dropping ore off to be collected and i was going to attach the script to chest. Do you think i should use a quest for it some how?
krestor Posted April 16, 2023 Author Posted April 16, 2023 @Seijin8 I tried the script and it worked the only downside is that the chest says its empty until you open the chest
krestor Posted April 16, 2023 Author Posted April 16, 2023 So i changed onActivate to OnClose and it worked like intended
MadMansGun Posted April 16, 2023 Posted April 16, 2023 maybe use a area trigger to activate the script so the chest gets filled before you open it. 1
Seijin8 Posted April 17, 2023 Posted April 17, 2023 (edited) 17 hours ago, MadMansGun said: maybe use a area trigger to activate the script so the chest gets filled before you open it. I mean, if you want it more real(ish), the chest would ping the cell every few hours to count how many miners were there and add one ore for each of them. If the mine has round-the clock shifts, it will fill faster, and wouldn't fill at all if the miners were home sleeping, or whatever. EDIT: I guess the ping would check to see if the miners were working or sleeping, maybe see if their package was a work package? As it stands, the player could leave for a month, come back and still only have 5 ore. Stuff like this, each layer of "real" you want to add requires more complexity everywhere else to support it. Personally, I'd not use a chest at all and instead have a mining foreman who collects the ore over time. For me, it is more interesting to interact with NPCs than furniture. Edited April 17, 2023 by Seijin8
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now