user826 Posted March 9, 2020 Posted March 9, 2020 I have a quest script that I want to run once a day, but it refuses to trigger when a new day begins and I don't understand why. My script is attached to a quest that's set to run when the game starts, with a priority of 75 and a processing delay of 1. The script looks like this at the moment:scn MyScript int LastDay begin GameMode if (GameDaysPassed - LastDay >= 1) set LastDay to GameDaysPassed ;The stuff I want to happen daily endif endI also tried using the following GameHour trigger (which has worked for me in the past) to no avail:scn MyScript int DoOnce begin GameMode if (DoOnce == 0) ;The stuff I want to happen daily set DoOnce to 1 endif if (GameHour >= 0) && (GameHour < 1) if (DoOnce == 1) set DoOnce to 0 endif endif endIs there some simple mistake that I'm just not seeing? Right now, it returns the correct value when I start the game, but if I wait 24 hours, or use the console to set the GameHour to 23.99 and wait a few seconds for the clock to tick over, the value doesn't change. It's supposed to increment by one, but it's not happening. Any insight would be greatly appreciated!
user826 Posted March 9, 2020 Author Posted March 9, 2020 (edited) Never mind, it turns out everything was working correctly, but my math was wrong for the script that I wanted to run daily. It was doing exactly what I told it to do, but the formula was wrong, so the result I got was not the one I was expecting. Edited March 9, 2020 by user826
GamerRick Posted March 10, 2020 Posted March 10, 2020 Cool, but you did see that you need JIP to fix the problems with it?
user826 Posted March 10, 2020 Author Posted March 10, 2020 Well, I don't use JIP when I make mods (I only have it because TTW requires it to run), but it's nice to know there is a solution. Thanks!
Mktavish Posted March 10, 2020 Posted March 10, 2020 I don't know about the JIP thing since it's a plugin to nvse . But this piece of code is an infinite loop , not going anywhere, (doesn't really loop) ~~~~~~~~~~~~~~~if (GameDaysPassed - LastDay >= 1) set LastDay to GameDaysPassed~~~~`~~~~just get rid of the " = " so only greater than comparison .you don't allways need 2 operators.
Mktavish Posted March 11, 2020 Posted March 11, 2020 On 3/11/2020 at 12:01 AM, user826 said: @Mktavish - Thanks for the tip! did it work ?
user826 Posted March 11, 2020 Author Posted March 11, 2020 Well, it was working fine before, it's just that my formula was not producing the expected result because I typed it in wrong. The original script I posted was fine.
Mktavish Posted March 11, 2020 Posted March 11, 2020 I guess you lost me now . What I said to change didn't make a difference or just not changed ?
Recommended Posts