:: COMPLETE TIME SYSTEM :: :: tutorial details :: version :: v1.0 author :: rylie thomas :: fan*c boi email :: fan-cboi@mbox.com.au homepages :: http://www.stas.net/6/fancboi [personal] http://www.stas.net/1/enos [dev.team] program :: RPG Maker 2000 v1.06 thanks :: see end of file archiving :: this tutorial is allowed to be used on your web site so long as it is not changed in any way. Please email me if you would like to add this to your site so that i can check it out and add your site to the list below: sites :: These sites have my permission to have this tut, check these sites first for the latest version: http://www.stas.net/1/enos http://rpgmaker.chat.ru/ :: introduction :: This tutorial explains how to create a complete time system, which as well as a basic day/night feature, also cycles through days, months years. It can easily be modified to count minutes, hours, weeks... whaever... this is great if you want the player to have to wait 5 weeks for an airship to be built, this system could be great for games where you could travel back in time (eg tlo Zelda: Majora's Mask) where all the events could be reset to those at that time in the game. there are so many possibilities and it's really quite simple. I have only just found RM2000 a couple of weeks ago, so there may be some errors in here... my game isn't far enough along to really guve the system a complete test, especially the time travel bit. i've got a few more tutorials to write so any feedback on this one would be very beneficial. The system can be run in one of 2 basic ways: game time: this involves excelerated time, so that it may take 3 minutes of actual playing time to complete the cycle of one day. this is most suited to cases where you may want to the game to last several months... or even years. real time: this would involve one minute of time passing in the game for every one minute of playing time. this is proably best suited to games tha are set over a small period of say one month, unless you wish to try something really original. This ould also be tweaked just to let the player know how long they have been playing the game, without actually effecting any in game events. :: game time :: first things first, all this day/night stuff is from a great faq from Gimp Master (gimpinmaster@hotmail.com) which, surprisingly was on some day/night stuff. his faq is konda what inspired me to do the complete time system. it's not hard to find his original faq (theres a copy on my site at : http://www.stas.net/1/enos/tutorials.html) so i'm only going tp include the actual 'code'... grad his faq if you're confused. these are all seperate common events event name : timeDay start cond. : parallel process activated on : switch : timeDay var : timeDay switch : timeDay, timeEvening <>wait 0.1s <>Variable Op: [0001: timeDay] + , 1 <>Fork Optn: [0001: timeDay]-7000over <>Set screen tone: (R070, G090, B070, S090),1.0sec(W) <>Variable Op: [0001: timeDay] Set, 0 <>Change switch [0019: timeDay] off <>Change switch [0020: timeEvening] on <> : Excepting Case <> : End Case <> event name : timeEvening start cond. : parallel process activated on : switch : timeEvening var : timeEvening switch : timeEvening, timeNight <>wait 0.1s <>Variable Op: [0002: timeEvening] + , 1 <>Fork Optn: [0002: timeEvening]-2466over <>Set screen tone: (R000, G050, B070, S080),1.0sec(W) <>Variable Op: [0002: timeEvening] Set, 0 <>Change switch [0020: timeEvening] off <>Change switch [0021: timeNight] on <> : Excepting Case <> : End Case <> event name : timeNight start cond. : parallel process activated on : switch : timeNight var : timeNight switch : timeNight, timeMorning <>wait 0.1s <>Variable Op: [0003; timeNight] + , 1 <>Fork Optn: [0003: timeNight]-2466over <>Set screen tone: (R070, G080, B080, S090),1.0sec(W) <>Variable Op: [0003: timeNight] Set, 0 <>Change switch [0021: timeNight] off <>Change switch [0022: timeMorning] on <> : Excepting Case <> : End Case <> event name : timeMorning start cond. : parallel process activated on : switch : timeMorning var : timeMorning switch : timeMorning, timeDay <>wait 0.1s <>Variable Op: [0004: timeMorning] + , 1 <>Fork Optn: [0004: timeMorning]-2466over <>Set screen tone: (R000, G050, B070, S080),1.0sec(W) <>Variable Op: [0004: timeMorning] Set, 0 <>Change switch [0023: timeMorning] off <>Change switch [0020: timeDay] on <> : Excepting Case <> : End Case <> of course you can change the var/switch names to suit yourself and you may want to at least tweak the overlay colours. as each sectio of code is almost identicle it's easy enough to just keep copying and pasting... just remember to change the var/switch names... now... to make it so that it counts day just add this line to the spot where you want your days to start (ie in the morning, or to put it better, when night ends) all this is doing is adding +1 to the variable dayCounter... more about that in a mo' heres my code: event name : timeNight start cond. : parallel process activated on : switch : timeNight var : timeNight switch : timeNight, timeMorning <>wait 0.1s <>Variable Op: [0003: timeNight] + , 1 <>Fork Optn: [0003: timeNight]-2466over <>Set screen tone: (R070, G080, B080, S090),1.0sec(W) <>Variable Op: [0003: timeNight] Set, 0 <>Note:here is the line i added... no need for this comment <>Variable Op: [0018: dayCounter] + , 1 <>Note:and that's it... <>Change switch [0021: timeNight] off <>Change switch [0022: timeMorning] on <> : Excepting Case <> : End Case <> now we have one more (little) event to make which will handle the months, year and stuff... event name : timeCounters start cond. : parallel process activated on : var : dayCounter, monthCounter, yearCounter switch : <>FORK Optn:Varbl[0018:dayCounter]-31 <>Variable Ch:[0019:monthCounter]+ ,1 <>Variable Ch:[0018:dayCounter]Set,0 <> :END Case <>FORK Optn:Varbl[0019:monthCounter]-13 <>Variable Ch:[0020:yearCounter]+ ,1 <>Variable Ch:[0019:monthCounter]Set,0 <> :END Case <> firstly this checks if the var dayCounter equals 31 (i really can't be bothered to work out making months with different amounts of days. that you would need to have another var called monthName or something and would need seperate fork conditions for each seperate month... that doesn't actually sound to hard does it... maybe i'll update this tut later... where was i? yeah... when the dayCounter equals 31 then it adds +1 to the var monthCounter. then it resets dayCounter to 0 so that it starts again from the start. then we do the same stuff with the month and the years. so if the number of months equals 13 then add +1 to the years and reset the months. if you want to just make an item or custom menu or something that can show the player the current date... a watch would be good. just make an item that activates a switch, which in turn activates an event which would display a message window which shows what ever variables you want. my event would look like this: event name : showDate start cond. : parallel process activated on : switch : showDate var : dayCounter, monthCounter, yearCounter switch : <>Messg: day : \V[0018] : :month : \V[0019] : : year : \V[0020] <>Change Switch:[0027:showDate]-OFF Set <> now at the start of the game you will probably want to setup a lot of these variables for example you may want your game to start on the ninth of june year 2057. Over the course of your game you will proably want to set up more variables as well as things like money, items etc. so i'll explain it now just in case you don't know. find the map where your game will start and create a new event called 'setup' or whatever... place it out of the way (like up in the top corner. Make it a parallel process and you can leave the rest of the stuff alone. Now all you need to do is insert some change variable commands for dayCounter, monthCounter, yearCounter and set them to 9, 6, 2057 respectivly (that's only if you are using the above example, feel free to set them to whatever you want) at the end have switch called setupDone and have it to ON. create another page which is activated by this switch (setupDone) and leave it blank. this way once the evnet is done, it wont be repeated. :: real time :: well this is the one i am most proud off because i think it could be used to do some _original_ stuff. i cant wait to see what people can do with it. the day/night system is the only difference between this and the game time version, so that's what i'll explain here. for anything else see the section above. because this system uses real time (ie one minute played equals one minute in the game) this is mainly done through the the wait function. anyway... here we go... event name : timeCounter start cond. : parallel process activated on : var : seconCounter, minuteCounter, hourCounter, dayCounter, monthCounter, yearCounter switch : <>wait 1.0s. <>Variable Ch:[0021:secondCounter]+ ,1 <>FORK Optn:Varble[0021:secondCounter]-61 <>Variable Ch:[0022:minuteCounter]+ ,1 <>Variable Ch:[0021:secondCounter]Set,0 <> :END Case <>FORK Optn:Varble[0022:minuteCounter]-61 <>Variable Ch:[0023:hourCounter]+ ,1 <>Variable Ch:[0022:minuteCounter]Set,0 <> :END Case <>FORK Optn:Varble[0023:hourCounter]-25 <>Variable Ch:[0018:dayCounter]+ ,1 <>Variable Ch:[0023:hourCounter]Set,0 <> :END Case <>FORK Optn:Varble[0018:dayCounter]-31 <>Variable Ch:[0019:monthCounter]+ ,1 <>Variable Ch:[0018:dayCounter]Set,0 <> :END Case <>FORK Optn:Varble[0019:monthCounter]-13 <>Variable Ch:[0020:yearCounter]+ ,1 <>Variable Ch:[0019:monthCounter]Set,0 <> :END Case <> well theres the code... hope you get it... :: progress :: 3/12/2000 version 1.0 complete. i will update this tut soon as well as explaining everything more and gramatical errors i still have to add the following: -display proper day, month names -differnet lengths for different months -explain how to trigger events based on times (you can probably figure this one out) -any suggestions? i would like to include examples of how others have used, or plan to use the system(s) email to: fan-cboi@mbox.com.au -i'm sure other things will ocur to me. :: thanks :: Don Miguel :: for tranlating rm2k and (hopefully) including this on his site Gimp Master :: great da/ynight feature whic hinspired this effort. ASCII :: tey did make the freakin' 'maker' series after all if you are looking for any other stuff to do with creating your own games then check out enos, my games development site. http://www.stas.net/1/enos