[Eventing]Extremely Simple Day/Night, For those who dont want it to be complicated |
|
|
|
|
Oct 19 2008, 11:03 AM
|

Level 8

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled

|
Okay, are you someone who just wants a watch and for their maps to get darker through the day? Then this is for you. Steps 1 + 2 are parallel process common events with a switch activation For steps 1 + 2 create an autorun map event that turns on a switch and then erases itself For step 3 place the script anywhere, I put it below the default scripts and before main. Just copy and paste Step 1: Minutes and Hours CODE Put in the following commands in a common event: (Dont forget a switch to activate it!!)
@>Control Variables:[0002:Hours] = 10 (When you want day to start. This is also when the screen will become daytime) @>Loop @>Wait 1 frame(s) @>Control Variables: [0003: Seconds] += 1 @>Conditional Branch: [0003: Seconds] = 25 @>Control Variables: [0001: Minutes] += 1 @>Control Variables: [0003: Seconds] = 0 @>Conditional Branch: Variable [0001: Minutes] == 60 @>Control Variable: [0001: Minutes] == 0 @>Control Variable: [0002: Hours] += 1 @> : Branch End @>Conditional Branch: Variable [0002: Hours] ==13 @>Condition Branch: [0004: AM/PM] = 1 @>Control Variables: [0002: Hours] = 1 @>Control Variables: [0004: AM/PM] = 2 @>Control Switches: [0001: PM] = OFF Else @>Control Variables: [0002: Hours] = 1 @>Control Variables: [0004: AM/PM] = 1 @>Control Switches: [0001: PM] = ON : Branch End @> : Repeat Above @>
Step 2: Day and Night CODE Put in the following in a common event: (Dont forget a switch to activate it!!) @>Loop @>Condition Branch: Switch [0001: PM] = ON @>Conditional Branch Variable [0002: Hours] = 10 < make this number when night starts! (here its 10 pm) @>Change Screen Color Tone: (-187, -119, -34, 68) @>Control Switches: [0002: Night] = ON @> : Branch End @> : Branch End @>Condition Branch: Switch [0001: PM] = OFF @>Conditional Branch Variable [0002: Hours] = 6 < make this number when morning starts! (here its 6 am) @>Change Screen Color Tone: ( 0, 34, 0, 0) @>Control Switches: [0002: Night] = OFF @> : Branch End @> : Branch End @>Condition Branch: Switch [0001: PM] = ON @>Conditional Branch Variable [0002: Hours] = 10 < make this number when day starts! (here its 10 am) @>Change Screen Color Tone: ( 0, 0, 0, 0) @> : Branch End @> : Branch End @> Wait: 1 frame(s) @> : Repeat Above @> Cool, aint it? Test it out, its awesome!!!! Heres a screenie to look at:  Note that the hud is optional and does not have to be used, instead you can use a watch on the menu screen, an item, or a map event. This is covered in the next spoiler tag. Option A: Watch On Menu Screen Edit def refresh in Window_PlayTime to look like this: CODE def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 120, 32, "Time") @total_sec = Graphics.frame_count / Graphics.frame_rate hour = $game_variables[2] min = $game_variables[1] text = sprintf("%02d:%02d", hour, min) self.contents.font.color = normal_color self.contents.draw_text(4, 32, 120, 32, text, 2) end
If it shows 0s, change these lines: hour = $game_variables[2] Change 2 to your hour variable min = $game_variables[1] Change 1 to your minute variable Option B: Hud CODE class Window_YourHUD < Window_Base def initialize super(0, 416, 640, 64) self.contents = Bitmap.new(640 - 32, 64 - 32) refresh end def refresh self.contents.clear reset_variables return if !@actor draw_actor_hp(@actor, 0, 0) draw_actor_sp(@actor, 160, 0) self.contents.font.color = system_color self.contents.draw_text(320, 0, 60, 32, "Time") @total_sec = Graphics.frame_count / Graphics.frame_rate hour = $game_variables[2] min = $game_variables[1] text = sprintf("%02d:%02d", hour, min) self.contents.font.color = normal_color self.contents.draw_text(400, 0, 60, 32, text, 2) end def reset_variables @actor = $game_party.actors[0] @old_hp = @actor ? @actor.hp : 0 @old_maxhp = @actor ? @actor.maxhp : 0 @old_sp = @actor ? @actor.sp : 0 @old_maxsp = @actor ? @actor.maxsp : 0 end def update super refresh if (@actor = $game_party.actors[0] or @old_hp = @actor ? @actor.hp : 0 or @old_maxhp = @actor ? @actor.maxhp : 0 or @old_sp = @actor ? @actor.sp : 0 or @old_maxsp = @actor ? @actor.maxsp : 0) end end class Scene_Map alias yourhud_main main alias yourhud_update update def main @yourhud = Window_YourHUD.new yourhud_main @yourhud.dispose end def update @yourhud.update yourhud_update end end
If there is an error, change the lines hour = $game_variables[2] min = $game_variables[1] to hour = $game_variables[y] y = your hour variable min = $game_variables[x] x = your min. variable Addon 1 : Bed System (Map Event) CODE @>Change Screen Color Tone: ( 0, 34, 0, 0) @>Wait: 20 frame(s) @>Play ME: '014-Inn01", 100, 100 @>Control Variables: [0002: Hours] = 7 <<This is your time when waking up @>Control Variables: [0001: Minutes] = 30 << This is your minutes, together its 7:30 @>Control Variables: [0003: Seconds] = 0 @>Control Variables: [0004: AM/PM] = 2 @>Wait: 60 frame(s) @>Change Screen Color Tone: (0, 0, 0, 0) @>
Coming Soon: 1. Weather System - just needs to be added (extremely buggy, ill post it, but you have to help me out!) 2. Houses dont get dark until bedtime (9:30?) - to be done 3. Bed System - DONE! 4. Lightning in my weather system (also easily done) Sorry if im lazy, ill get these done eventually. !!!!NEW!!!! Demo Available!!!
This post has been edited by shantanu: Nov 22 2008, 05:04 PM
__________________________
 Current Koushaku Productions Members: 2 Current Koushaku Productions Projects: 3
|
|
|
|
|
|
|
|
|
Oct 19 2008, 11:19 AM
|
Level 3

Group: Member
Posts: 34
Type: None
RM Skill: Undisclosed

|
Looks cool 1) in common events do you mean the ones in the database or make an event on the map 2) does the code go under main?
sorry i just got back into rpgmaker after a 2 year rest.
|
|
|
|
|
|
|
|
|
Oct 19 2008, 04:26 PM
|

Level 50

Group: +Gold Member
Posts: 1,519
Type: Scripter
RM Skill: Undisclosed

|
Edited: Have you tried this while changing maps? I had a go at the whole loop thing using common events and my loops broke  I like your scripting though, I have no idea how to script, but I think I could learn alot from using yours
This post has been edited by Night_Runner: Oct 21 2008, 08:36 PM
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
|
Oct 19 2008, 09:03 PM
|

emerge -avt awesome! Wait... it brings me.... HERE?!

Group: Revolutionary
Posts: 1,717
Type: Scripter
RM Skill: Advanced

|
Not bad, though this is simple...
Though XD a true day/night can be done by events, scripting is lame since not EVERYTHING needs to be scripted, menu's, movement sure, but battle systems can be evented with the help a few scripts, I prefer evented battles because it's your own and all an abs really is, is just detecting X/Y, now if you play LOG, Som, SD, you'll notice if you hit it at a high point in the sprite it'll move diagonal well that's natural in an abs and all it is, is X/Y detection.
Though for stretching an image... that might require a script"I'd ask for help on that one"
Great system overall, but I'll share my own tomorrow since I'm a bit busy now, also RMXP can be compared to Game Maker if you have pixel-movement added, I actually find XP's scripts to be better than GM, GM for rpg's is just not worth it in a long run.
__________________________
Xeilsoft - Follow your dreams to the very end..
Kits that I'm working on. [Unity3D 4.0] LTTP/Minish Cap - I don't have time for custom gfx like what the pze folks are doing but I will try and work on some enhanced LTTP graphics.
Main PC Core i7 3820 overclocked @ 4.8GHZ Galaxy: Nvidia Geforce GTX 680 GDDR5 2GB Asrock X79 Extreme9 w' creative sound 64GB corsair platinum @ 1600MHZ Muchkin 128GB SSD(boot), OZKIN 2TB SSD, Western Digital GREEN 1TB HDD. Rosewill Lightning 1000W PSU OS: Funtoo Linux, Windows 8 (Virtual Machine)
iMac (March 2013) 3.4GHz Quad-core Intel Core i7, Turbo Boost up to 3.9GHz 16GB 1600MHz DDR3 SDRAM - 2X8GB 1TB Serial ATA Drive @ 7200 rpm NVIDIA GeForce GTX 680MX 2GB GDDR5
|
|
|
|
|
|
|
|
|
Oct 20 2008, 12:29 PM
|

Level 8

Group: Revolutionary
Posts: 118
Type: Developer
RM Skill: Skilled

|
uh, Night_runner, quite frankly, you are completely wrong.
It is a parrallel process meaning that it works along side all other events. You activate the switch once, and it goes on forever without ever being interrupted by anything. Tho only way that could happen is if you turn off then turn on the switch in one event (Then it would restart)
Also, im not a scripter, I can only do basic stuff. Im a developer, writer, spriter, and eventer
This post has been edited by shantanu: Oct 22 2008, 01:50 PM
__________________________
 Current Koushaku Productions Members: 2 Current Koushaku Productions Projects: 3
|
|
|
|
|
|
|
|
|
Oct 21 2008, 05:56 PM
|

Level 50

Group: +Gold Member
Posts: 1,519
Type: Scripter
RM Skill: Undisclosed

|
No problems shantanu, but did you actually physically try it? (Don't you hate it when the only thing someone congratulates you on is the bit you didn't do? Sorry, it just irritates me aswell...)
EDIT: Have it running, wait until like 11 or something, then teleport to another map, and you'll see what I mean (Hopefully)!
This post has been edited by Night_Runner: Oct 21 2008, 09:00 PM
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
|
Oct 22 2008, 11:51 AM
|

Level 5

Group: Member
Posts: 73
Type: Event Designer
RM Skill: Advanced

|
Hei - Shantanu - I wrote a tutorial on a event based time system, so have a look at it, the link is in my sig. It may allow you to do things you didn't know you could on time events, and compress that script for you. It's a good concept tho, If I can get it working it may appear in my present 'secret' project, not the one I talk about in my sig.  Edit Ok, one very big problem here. If this event ran as a paralell process it would slow the game considerably as wait command practically freezes the game. You should instead put in a 'seconds' variable, and that adds 1 every frame (wait then doesn't freeze game as it is only one frame) and then when it gets to 25 (or 60) you add on another minite, also, your screen colour tone is a bit dark, try not to reduce blue much as 'night' black isn't pure - it's more like an incredibly dark purple colour.
This post has been edited by Libelnon: Oct 22 2008, 11:57 AM
__________________________
Cna yuo raed tihs? Olny 55% of plepoe can. I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! fi yuo cna raed tihs, palce it in yuor siantugre.
I have returned!... sort of. I probably won't stick around long, but...
|
|
|
|
|
|
|
|
|
Oct 22 2008, 02:08 PM
|

Level 50

Group: +Gold Member
Posts: 1,519
Type: Scripter
RM Skill: Undisclosed

|
Here's a link Project2.zipSorry I'm so much trouble, hopefully someone will be able to resolve this for me
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
|
Oct 23 2008, 11:50 AM
|

Level 5

Group: Member
Posts: 73
Type: Event Designer
RM Skill: Advanced

|
Heh, just a note - When you use time scripts, I used one that it waits 2 frames then adds 1 seconds, and the game ran at half frame rate - that is the effect of wait commands on the game. Also, you should include a vairiable to decide if it is AM or PM in a 12 hour clock, as then you can take out the need for a long wait in the day script. Then you can say 'If variable AM/PM = 2 (PM) and variable Hours = 6 (nighttime) then activate switch 'night' and change screen colour tone to -20,-20,0,10.'
__________________________
Cna yuo raed tihs? Olny 55% of plepoe can. I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! fi yuo cna raed tihs, palce it in yuor siantugre.
I have returned!... sort of. I probably won't stick around long, but...
|
|
|
|
|
|
|
|
|
Oct 24 2008, 02:05 AM
|

Group: Member
Posts: 4
Type: None
RM Skill: Undisclosed

|
ho do i add the script i've never used scripts before
|
|
|
|
|
|
|
|
|
Oct 25 2008, 02:41 AM
|

Level 5

Group: Member
Posts: 73
Type: Event Designer
RM Skill: Advanced

|
do us a favour - PM me when you've fully updated it - I want to put it into my RPG, including the script. Does the script use windowskins? or has it got no background? Oh, and another thing... You can do Lycanthropy with a script like this. If you set a switch for 'night', you can then remove the bitten player from the party and replace him/her with a werewolf character (Initialize, so that you don't get a lvl 1 lycan every night) and then when it's day again you can remove him from the party and replace him with (an initalized) player character. As for the bite, set up a skill that uses no MP, and call it 'Lycan Bite', and assign it a common event, in that event, you want to activate a switch called 'lycan ON'. You can cure yourself by turning that off, and the common event for day/night should check if that is on - I'll get u a full command list, just don't merge this with the night/day script, plz!
__________________________
Cna yuo raed tihs? Olny 55% of plepoe can. I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! fi yuo cna raed tihs, palce it in yuor siantugre.
I have returned!... sort of. I probably won't stick around long, but...
|
|
|
|
|
|
|
|
|
Oct 30 2008, 01:54 PM
|

Level 50

Group: +Gold Member
Posts: 1,519
Type: Scripter
RM Skill: Undisclosed

|
Where did you get that HUD from? I get the overwhelming feeling that you didn't actually make it, but you didn't credit anyone else for it..... @ hackje: It's easer to just tell you than to try and find it, lol 1. Highlight everything in that 'And lastly, a HUD' codebox, starting from class Window_...... down to that last end 2. Open the rpg maker xp project you want to put the script into, and that 3rd last icon along the top is the Script Editor (shortcut key F11), open it 3. On the left hand side it says Script >> Game_Temp, etc, scroll that side down to the bottom, and the last item there should be Main 4. Right click Main, and select insert 5. You can name your new new script whatever you like, and just paste the script you coppied into that massive blank section on the right hand side. If you aren't too confident, download that Project 2 posted above, it has the script, and you can just check off that EDIT: Actually, here's a more updated version, I edited the script a bit so it works with my sleeping system, that's all Project1.zip
This post has been edited by Night_Runner: Oct 30 2008, 02:43 PM
__________________________
K.I.S.S. Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question. Most important guide ever: Newbie's Guide to Switches
|
|
|
|
|
|
|
|
|
Nov 9 2008, 03:25 AM
|

Level 5

Group: Member
Posts: 73
Type: Event Designer
RM Skill: Advanced

|
well, maybe when we have perfected this, we should make a tutorial, hmm?
also, shantantu, have a look at my tutorial - it could give you ideas to include in your tutorial.
EDIT: Spotted a problem: if say... you rested, and it added on 80 seconds, 20 seconds would be shaved off - the conditional branches must be GREATER THAN or equal to, and the time should be minused rather than set. Also, a 24 hour clock would be easier to understand.
This post has been edited by Libelnon: Nov 9 2008, 06:31 AM
__________________________
Cna yuo raed tihs? Olny 55% of plepoe can. I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! fi yuo cna raed tihs, palce it in yuor siantugre.
I have returned!... sort of. I probably won't stick around long, but...
|
|
|
|
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
RPG RPG Revolution is an Privacy
Policy and Legal
|
|