The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: shadow-man on February 22, 2011, 06:38:43 PM

Title: script for certain areas to open on certain days
Post by: shadow-man on February 22, 2011, 06:38:43 PM
first off Hi and thanks for taking a look at this request

now what i really need is a script or something either a script or an event that will allow a certain area to either appear or open up on a certain day at a certain time i.e. i want an area to open up on halloween or christmas and then close after that day was over, it would start at 12am and finish 24 hours later
Title: Re: script for certain areas to open on certain days
Post by: Irock on February 22, 2011, 07:54:27 PM
I'm pretty sure this can be done with events.

Unless you're talking about real world time.
Title: Re: script for certain areas to open on certain days
Post by: shadow-man on February 22, 2011, 08:32:06 PM
hmmm it would be ok to be done through events but really i want it in real world time where it checks the computers calander or something i would even put a in game calander for the event where it has real world events. christmas,halloween on the actual days
Title: Re: script for certain areas to open on certain days
Post by: hikomarukun on February 23, 2011, 09:54:10 AM
If I understand correctly, if you had a variable that represented the days (1-365), you could have a common event that set the variable = to the day of the year (i.e. January 5th = 5, December 25 = 359 etc). Then you could also have that common event check to see if the variable = the number corresponding to the date of Halloween, Christmas, etc. And then if the variable does = the number for Halloween, then you can have whatever you want happen after that.

Here is an example for Christmas
Control variable [day of the year] +1   #obviously upon a new year, you will need to set this variable = 0
Conditional Branch: variable [day of year] = 359
     Text: Merry Christmas!    #put whatever you want to happen on Christmas here
Else
     (empty)
Branch End


You can just keep adding conditional branches for whatever day of the year you want, and can add 1 to the variable however you want. This would only work for an in game calendar, and honestly having a special even happen one a specific day in the real world might be kind of worthless? Using an in game calendar would be much more useful, I believe. I hope this helps.
Title: Re: script for certain areas to open on certain days
Post by: Pokey on February 23, 2011, 10:23:38 AM
If you're using a script to use the computer calendar, there must be some way to store the value in a variable.
the rest is pretty much explained by /\ them
Title: Re: script for certain areas to open on certain days
Post by: shadow-man on February 23, 2011, 08:31:48 PM
hmmmm i think i understand i shall have to learn a bit more about this because i am not a very good scripter but want to learn  :V

but thanks for the replies i have copied the last 2 replies into a work document to help me at a later time thanks all
Title: Re: script for certain areas to open on certain days
Post by: Zeriab on February 24, 2011, 07:38:48 AM
You can use the Time class to retrieve the system time.
Here are examples which you can use in snippets:
$game_variables[42] = Time.now.year
$game_variables[42] = Time.now.month
 
$game_variables[42] = Time.now.day    # Day of month
$game_variables[42] = Time.now.wday   # Day of the week
$game_variables[42] = Time.now.yday   # Day of the year

$game_variables[42] = Time.now.hour
$game_variables[42] = Time.now.min
$game_variables[42] = Time.now.sec
$game_variables[42] = Time.now.usec   # Microseconds

# Note $game_variables[042] and $game_variables[0042] is wrong. No leading 0s


The day of week is a bit tricky in that it gives a value from 0 to 6 where 0 = Sunday, 1 = Monday, ... , 6 = Saturday.

*hugs*