Main Menu
  • Welcome to The RPG Maker Resource Kit.

script for certain areas to open on certain days

Started by shadow-man, February 22, 2011, 06:38:43 PM

0 Members and 1 Guest are viewing this topic.

shadow-man

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

Irock

I'm pretty sure this can be done with events.

Unless you're talking about real world time.

shadow-man

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

hikomarukun

#3
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.
RPMG2k forever!

Pokey

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

shadow-man

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

Zeriab

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*