Jump to content

Recommended Posts

Posted

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
end

I 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
end

Is 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!

Posted (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 by user826
Posted

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!

Posted

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.

Posted

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...