|
Post by nerussentia on Apr 1, 2008 3:55:44 GMT -5
I know its probably posted, but I did searches all over and couldn't find a thing. I have a transition script for time to proceed in normal way: noon, dusk, night, dawn, noon. There is one problem. I tried so much and couldn't figure it out. What do I have to do to keep the time of day no matter what map I go into? I want it to be night, then leave a map to another and it still be night. Any assistance?
|
|
|
Post by Dungeon Warden on Apr 1, 2008 14:34:00 GMT -5
I'm sure this was talked about before. There's probably a script somewhere. There is a clock script in the common scripts topic. What you need to do is run the clock off a variable that keeps track of the hour or time of day so you can use that variable on every map with the clock script.
Here's a simple time of day example. It wouldn't be hard to switch it to a hourly clock.
Script Branch Repeat flag 0 [off] = off Script Branch Variable [time of day] = 0 Screen Display = time [noon] wait 1800 F {This is equal to 60 seconds} Var[time of day] = 1 End SB Script Branch Variable [time of day] = 1 Screen Display = time [dusk] wait 1800 F Var[time of day] = 2 End SB Script Branch Variable [time of day] = 2 Screen Display = time [night] wait 1800 F Var[time of day] = 3 End SB Script Branch Variable [time of day] = 3 Screen Display = time [dawn] wait 1800 F Var[time of day] = 0 End SB
If you place this on every map, then the display will change to the current time of day and the clock will start ticking for the next time of day. To make an hourly clock, all you need to do is have the time of day variable go from 0 to 23. You can make zero equal midnight if you want the hours to follow a standard 24 hour clock.
|
|
CajunGaijiin
RPG Making Novice
Little Mary Sunshine dead of drug overdose-more at 11....
Posts: 50
|
Post by CajunGaijiin on Apr 2, 2008 10:47:03 GMT -5
Hey-one I can help with. Whoo-hoo!
The clock script in my game has events that are closely tied in with the time o'day, as well as exact hours and days. Since I need a consistent time frame, I decided to run my time o'day correction from my entry script.
The clock script(present in every map) switches the Time o'day variable based on the hour count. (Ie: Hour count=10:00, time o'day=2(noon) At 1800, Time o'day switches to 3 (dusk) etc.
When the party enters a new map, before the default color comes up, the entry script calls my time correction script which simply states: 1)if time o'day variable=1 then Time Of Day=Dawn. 2)if time o'day variable=2 then Time Of Day=Noon etc.
That way, when the default color comes back up, The appropriate period of the day is already set. This alternate method may work better for you, depending on how you intend to use time in your game. It really just depends on the level of detail you need to achieve. Good luck and, peace.
|
|
|
Post by nerussentia on Apr 3, 2008 16:14:15 GMT -5
So DW... Do I make this a action or a condition script? I made it action to put in the background so it flows as the game plays on.
|
|
|
Post by Dungeon Warden on Apr 4, 2008 13:00:26 GMT -5
It has to be an action script so that it will run in the background as the game is played.
I should mention that the script should have a timer on the screen display command so that the light gradually changes as the day progresses (I use 30 F myself). However, doing this makes the light gradually change when the player enters a new map (changing from Noon [the default] to the new light level, which looks really weird if it's suppose to be night).
To avoid this, put the following commands in the enter map script:
Script Branch Variable [time of day] = 0 Screen Display = time [noon] 0 F End SB Script Branch Variable [time of day] = 1 Screen Display = time [dusk] 0 F End SB Script Branch Variable [time of day] = 2 Screen Display = time [night] 0 F End SB Script Branch Variable [time of day] = 3 Screen Display = time [dawn] 0 F End SB
Here's a neat way to do an hour checker that saves memory:
Flag [temp 0] = off SB Repeat Flag [temp 0] = off Script Branch Variable [hour] < 6 Screen Display = time [night] 0 F Flag [temp 0] = on To End SB End Script Branch Variable [hour] < 12 Screen Display = time [dawn] 0 F Flag [temp 0] = on To End SB End Script Branch Variable [hour] < 18 Screen Display = time [noon] 0 F Flag [temp 0] = on To End SB End Screen Display = time [dusk] 0 F Flag [temp 0] = on SB Repeat end
This assumes a 24 hour clock with 0 at midnight and the light changing every 6 hours. You can adjust it to your liking.
How this works it that the repeat never repeats. The To end command jumps the line and causes the repeat to go to the end where it checks to see if it should repeat. Since Flag [temp 0] (a temporary flag that you can use for things like this where you don't need to save the flags orientation) is now on, the repeat ends. This save you from having to check if the variable [time] is between 12 and 18 (for example). Once the scripts checks if [hour] is less then 18, it already knows it must be 12 or higher, since if it was lower, this script branch would have been skipped by the To End command.
Note that the last option (dusk) doesn't need to check [hour] since there is no way to reach this command unless [hour] is between 18 and 23.
I found this trick out by looking at the scripted menu system that the preset game has for testing your game (the one that's set to the [] button). I suggest everyone study this set of scripts for some great tips on how to write tighter code.
|
|