Jump to content

timer and gamemode


delizihin

Recommended Posts

I have three questions.

1-I have a script made out of a "GameMode" and a "MenuMode". Do I have to place it in something (like an object) to make it work?

2-"GetSecondsPassed" gets how many seconds passed, but I need how many minutes passed in-game to get how much time passed while waiting and sleeping too. Which command I need to use?

Link to comment
Share on other sites

I have three questions.

1-I have a script made out of a "GameMode" and a "MenuMode". Do I have to place it in something (like an object) to make it work?

2-"GetSecondsPassed" gets how many seconds passed, but I need how many minutes passed in-game to get how much time passed while waiting and sleeping too. Which command I need to use?

1. All scripts need to be attached to an Object, NPC, or quest to function. Likewise, the scripts will only be run when that thing is present or active.

 

2. getsecondspassed does not return time in the game world, but instead returns real time between script passes. If you're trying to detect how much time has changed between when a player started sleeping and when they have stopped, you would need to make use of two internal variables Gameday and Gamehour. Something like

 

scn GenericSleepTimeCHeckerScript.

short sday
short shour
short eday
short ehour
short playersleeps
short rday
short rhour

begin menumode 1012
if playersleeps != 1 && istimepassing == 1
set shour to gamehour
set sday to gameday
set playersleeps to 1
endif
end

begin gamemode
if playersleeps == 1
set eday to gameday
set ehour to gamehour
set rday to eday - sday
set rhour to ehour - shour
if rday >= 1 && rhour < 0
set rhour to (rday * 24) + rhour
endif
message "player has slept/waited %g hours" "rhour"
set playersleeps to 0
endif
end

 

or something along those lines.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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