Jamo12 Posted January 25, 2013 Share Posted January 25, 2013 (edited) Hi, I'm working on a mod that requires the tracking of when a day has passed. Every day the player needs to be shown a message. I've spent a couple of hours tinkering around with GameDaysPassed but after many attempts my greatest achievement is getting the message to display every few seconds. Before I tear my hair out I thought I'd come to the forums for a little help. I appreciate any help, Thanks Edited January 25, 2013 by Jamo12 Link to comment Share on other sites More sharing options...
Gribbleshnibit8 Posted January 26, 2013 Share Posted January 26, 2013 As per the wiki.If all you want to know is if it is a new day (strictly meaning that the 12:00am boundary has been crossed), save the current GameDaysPassed into a SHORT variable (lastDay) and then when you want to do your comparison, create a SHORT (currentDay) and set it to the current GameDaysPassed. If (currentDay - lastDay) >= 1, then a day has passed. By storing GameDaysPassed in SHORT variables you trim off the factional hours that live in the decimal places. If you use floats instead of SHORTs you will essentially be checking if "24 hours has passed" rather than, "is it the next day." Link to comment Share on other sites More sharing options...
Jamo12 Posted January 26, 2013 Author Share Posted January 26, 2013 Ah, I have read that but I'm not sure what it means, I know have to set Currentday to the current GetDaysPassed, but I don't know to keep the older GetDaysPassed of the LastDay. Link to comment Share on other sites More sharing options...
TheNonsenseFactory Posted January 28, 2013 Share Posted January 28, 2013 Ah, I have read that but I'm not sure what it means, I know have to set Currentday to the current GetDaysPassed, but I don't know to keep the older GetDaysPassed of the LastDay.If you create a variable in your script, you can store values there for later use. See the GECK wiki for reference. You set LastDay to GetDaysPassed the first time the script is run (*). Thats the start of the timer. Then when (GetDaysPassed - LastDay) >= 1 you show the message to the player, and then set LastDay to GetDaysPassed again so that we wait for another day to pass before sending the next message. (*) If you want to do something only once, you can do something like thisScriptName YourScriptName short DoOnce short LastDay Begin GameMode if (DoOnce == 0) set LastDay to GameDaysPassed set DoOnce to 1 endif end Link to comment Share on other sites More sharing options...
Recommended Posts