Jump to content

Help? Detecting when 24 hours have passed?


Guest Messenjah

Recommended Posts

Guest Messenjah

So I need a way to detect when 24 hours or one full day has passed.

 

Basically I want to use an int property that will be flagged as 1 when true and flagged as 0 when false. Dialogue will flag it as true but after 24 hours have passed, it will flag as 0 or false.

 

I will have the player walk through a trigger that will detect if at least one day has passed. If 1 full day has passed, it will flag the int property as 0.

 

What would be the best approach for this?

 

Need some ideas since I am lacking time right now to find the solution on my own. :(

Link to comment
Share on other sites

In the script you'll define the starting time and then you'll refresh the ending time. When their difference is one day, you're ready to go.

 

If you want a timer which is detached by any other event except the time, you make a script and attach it to a quest with a low delay

I didn't test it, but this more or less should explain the concept:

Scn MyTimer

float fStartingTime
float fEndingTime

Begin GameMode

if fStartingTime
else
   Let fStartingTime := GameDaysPassed
endif

if fEndingTime - fStartingTime < 1
   Let fEndingTime := GameDaysPassed
else
   ; one day's passed
endif

end

Instead if you want to check that only on a trigger, you could store the variables on a script attached to a quest, along with all the other variables you need to track down in your mod, you don't flag Start Game Enabled, then you change the values using the script of the activator. Something like this:

-The quest script

Scn MyQuestVars

...
float fStartingTime
float fEndingTime
...

-The activator's script:

scn MyActivator
int bDoOnce

Begin OnTriggerEnter Player

If bDoOnce
   if MyQuestVars.fEndingTime - MyQuestVars.fStartingTime < 1
       Let MyQuestVars.fEndingTime := GameDaysPassed
   else
       ; one day's passed
   endif
else
   Let bDoOnce := 1
   Let MyQuestVars.fStartingTime := GameDaysPassed
endif

The only exception is the player's waiting 24 hours inside the trigger zone, if you think it's a risk you should add a MenuMode block.

Edited by Fallout2AM
Link to comment
Share on other sites

Guest Messenjah

So I'm trying to wrap my head around this script. Perhaps it would help to explain my end game first.

 

Basically, I want to have a set of dialogue interactions that the player can choose from once a day with a particular npc. Many of these have multiple lines of dialogue and multiple reactions and they are all at random. I could check "Say once a day," but it will automatically give the player the next random dialogue found in the list. This would enable the player to spam all the options at once. I want the player to be able to select one of these options once a day so that it can't be spammed. Therefor, the way to fix this is to set a condition that is 0 when the option is available and 1 when the option is unavailable. So when the player says one of the lines, the dialogue script fragment will result in flagging the condition as true and will set the starting time. Then the quest script or a trigger could result in checking the end time in order to set the condition back to 0.

if fEndingTime - fStartingTime < 1
   Let fEndingTime := GameDaysPassed
else
   ; one day's passed
endif

So here, were are checking the difference between fEndingTime and fStartingTime to make sure that it is less than a value of 1 day, correct? If it is less than 1, then we are setting fEndingTime to the same value as GameDaysPassed. If it is not, then one day has passed. Am I following the logic here correctly?

Edited by Messenjah
Link to comment
Share on other sites

Guest Messenjah

Something else I'm not quite grasping:

if fStartingTime
else
   Let fStartingTime := GameDaysPassed
endif

Can you better explain this logic? We don't really seem to be checking a condition with fStartingTime? Is there a default value that is being assumed by the game here? ifStartingTime == 0 ? If all it is doing is checking to see if fStartingTime exists, the float is already defined, so it exists, so this value would always be true. Therefor;

else
   Let fStartingTime := GameDaysPassed
endif

would be a moot point wouldn't it? :confused:

 

 

Also:

If bDoOnce
else
   Let bDoOnce := 1
endif

We are first checking bDoOnce to see if it is a value of 0, if it is, then set it to 1, so that the script only runs one time, correct? Therefor it would be teh same as:

If DoOnce == 0
     Set DoOnce to 0
Endif
Edited by Messenjah
Link to comment
Share on other sites

Can you better explain this logic?

if fStartingTime exists, then it means I already defined it and I don't mean to define it again. If it doesn't exist, it means this script is running for the very first time and fStartingTime is zero. At that point, define it to GameDaysPassed. It's the same if you use a variable to stage the script, this is just another solution, you can choose whatever solution you want once you get the sense.

 

 

would be a moot point wouldn't it?

 

I don't see why, what do you mean?

 

 

We are first checking bDoOnce to see if it is a value of 0, if it is, then set it to 1, so that the script only runs one time, correct? Therefor it would be teh same as:

If DoOnce == 0
Set DoOnce to 0
Endif

No, what you wrote will be executed more and more without any effect

Maybe you wanted to compare to 1, like this:

If DoOnce == 0
   Set DoOnce to 1
   ; do the code
Endif

; do the code will be executed only once.

 

I use boolean expressions in my scripts because they're slightly faster than compare to a specific value, but the sense is the same.

 

So here, were are checking the difference between fEndingTime and fStartingTime to make sure that it is less than a value of 1 day, correct? If it is less than 1, then we are setting fEndingTime to the same value as GameDaysPassed. If it is not, then one day has passed. Am I following the logic here correctly?

Exactly. The sense should be "check the difference between the ending time and the starting time, until this difference is 1 day".

 

 

Basically, I want to have a set of dialogue interactions that the player can choose from once a day with a particular npc. Many of these have multiple lines of dialogue and multiple reactions and they are all at random. I could check "Say once a day," but it will automatically give the player the next random dialogue found in the list. This would enable the player to spam all the options at once. I want the player to be able to select one of these options once a day so that it can't be spammed.

 

Oh now I understand what you're doing. It's more or less like when in FO3 you ask to your robot (WASDWorth?) if he has water or if he can say a joke but only once for a day.

Well you could still use the Once a day, you just need to put another level in the dialogue

 

- Can I ask you for something? - ONCE A DAY - This subject will be among the other subjects but will appear only once a day.

- Sure, go On - Extra step is necessary

- Can you tell me a joke? - And now your random sentences. They all will be back to the main level, so you won't have the Can I ask you for something? anymore.

- 1 ) Joke 1 - RANDOM

- 2 ) Joke 2 - RANDOM

- 3 ) Joke 3 - RANDOM

Edited by Fallout2AM
Link to comment
Share on other sites

Guest Messenjah

 

 

I don't see why, what do you mean?

 

Well, if it was already fStartingTime was already defined, there wouldn't be any point in defining it again. However, it would make sense the first time the script runs. :) I see what you did now.

 

 

 

No, what you wrote will be executed more and more without any effect

Maybe you wanted to compare to 1, like this:

If DoOnce == 0

Set DoOnce to 1

; do the code

Endif

; do the code will be executed only once.

 

Sorry, I made a typo. I intended for the DoOnce to be set to 1, not 0. My mistake.

 

 

Oh now I understand what you're doing. It's more or less like when in FO3 you ask to your robot (WASDWorth?) if he has water or if he can say a joke but only once for a day.

Well you could still use the Once a day, you just need to put another level in the dialogue

- Can I ask you for something? - ONCE A DAY - This subject will be among the other subjects but will appear only once a day.

- Sure, go On - Extra step is necessary

- Can you tell me a joke? - And now your random sentences. They all will be back to the main level, so you won't have the Can I ask you for something? anymore.

- 1 ) Joke 1 - RANDOM

- 2 ) Joke 2 - RANDOM

- 3 ) Joke 3 - RANDOM

 

Yep, this is exactly what I am trying to accomplish. Sadly, some of my voice actors have not contacted me in over a year. So making a change like this to the dialogue wouldn't work in this case. It is better to just cover it up by scripting some conditions instead. For future dialogue, I'll use this method as you suggested.

Link to comment
Share on other sites

Guest Messenjah

Crap, no wonder this doesn't work. It uses NVSE. :( I try not to use NVSE and stick with the default language.

 

How about a script that doesn't make use of NVSE?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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