#1
Posted 22 August 2014 - 02:41 PM
The simplest thing I would think of in terms of making the script would be so every said minute would change the DMap's Cset. Maybe having 4 different Csets for one loop.
OR
Having the DMap change its Cset based on the computer's real-time clock. Seems more complex, but man that just blows my mind.
6 AM - 12 PM: Sunrise
12 PM - 6 PM: Daytime
6 PM - 12 AM: Sunset
12 AM - 6 AM: Nighttime
If anyone is able to do either of these or if there's already a script for this, let me know along with the setup.
~ Epad
#2
Posted 22 August 2014 - 06:33 PM
ZScript can't read from the real time clock and can't write to palettes. This means that the only way we could do this would be with warps which would cause problems with the screen resetting enemies and everything every few minutes. You could check sprites carry over in warps on every screen, but then you couldn't use any tile warps in the quest and I don't think anybody wants that.
#3
Posted 22 August 2014 - 06:50 PM
A better solution is to draw a transparent rectangle over the entire screen to simulate the different times of day. You can find a discussion on this type of script here.
Direct link to zim's quest, which has the day/night script: Download
I would love to link to just the script, but I don't think it exists as a separate entity.
#4
Posted 22 August 2014 - 07:15 PM
So how does the script affect the transparent layer according to the code?
#5
Posted 22 August 2014 - 07:48 PM
I took a look at it, and it seems like he's simulating night by just stacking multiple transparent black layers on top of each other. He has a nice lantern effect going too, by drawing arcs instead of just filling the entire screen with a rectangle.
void Lantern(int r) { //Screen->Rectangle(7,0,0,240,0,0,160,240,160,10,true,128); if(Link->Dir==0) {Screen->Arc(7,Link->X+7,Link->Y+7,r,290,70,15,1,Link->X+7,Link->Y+7,270,true,true,OP_TRANS);} if(Link->Dir==1) {Screen->Arc(7,Link->X+7,Link->Y+7,r,290,70,15,1,Link->X+7,Link->Y+7,90,true,true,OP_TRANS);} if(Link->Dir==2) {Screen->Arc(7,Link->X+7,Link->Y+7,r,290,70,15,1,Link->X+7,Link->Y+7,180,true,true,OP_TRANS);} if(Link->Dir==3) {Screen->Arc(7,Link->X+7,Link->Y+7,r,290,70,15,1,Link->X+7,Link->Y+7,0,true,true,OP_TRANS);} }
Here's the relevant section of the code. He just calls this function for multiple values of r, to stack the layers for a darker night and make it look like your lantern light fades as it gets further away from you.
#6
Posted 22 August 2014 - 09:30 PM
@Moosh What if the Cset changes every given minute on the ZC clock?
#7
Posted 23 August 2014 - 03:25 AM
@Moosh What if the Cset changes every given minute on the ZC clock?
Are you making a Classic quest? In a case like that you might be able to compress all the colors you need for a screen into a single CSet. Otherwise, using CSets wouldn't work. You could read from the ZC clock, but I believe that caps after a certain point, so a global variable that wraps back to 0 when it reaches they end of a cycle would be preferable.
Zim's method can work, but mass transparent layering in ZC has a tendency to produce very ugly results, especially if you double the number of layers.
#8
Posted 23 August 2014 - 03:46 AM
What about using multiple DMaps, with carryover secrets to keep everything consistant, and a simpler script that increments a counter every screen transition. After the counter hits a certain point, the next screen transition transfers you to the next DMap in line.
Also, if you plan on taking the transparency route, I've found that a good way of faking a paler transparency would be to use a 50/50 dithering effect with a maximum speed two-frame animation that alternates the clear and filled pixels. I used that method for a tranparent fog effect that looks very good when layered with a canopy shadow transparency over it, and it may help you if you decide on layering additional transparencies for your intended effect. (I don't know how well it would work since you're doing a full-screen transparency, but with my fog animation trick, the effect was made even smoother by making the layer scroll diagonally as well.)
#9
Posted 23 August 2014 - 10:40 AM
@Moosh I am using DoR, so having multiple layers wouldn't really help the quest's design,. I have seen Zim's Quest, but I don't think it would work out well for me.
@kurt91 I never worked with carry-overs, so I'm not sure how it would work. Would it carry a sprite that already has been triggered (like opening a chest) to the next Dmap?
#10
Posted 25 August 2014 - 07:25 AM
The internal clock is stored as an int, rather than a float, (for whatever reason) in seconds. That should cap at 214,748 seconds, translating down to:
4,129 minutes, 8 seconds; or...
68 hours, 48 minutes, 8 seconds; or...
2 days, 20 hours, 48 minutes, 8 seconds.
If your game is large enough to exceed that, I'll give you a function, and matching array to store game time; that I'll be using as a basis for something similar to what you want to do here. I've experimented with a few methods to simulate day/night, and other cyclical changes, usually using global functions and draw commands. (If you don't expect to need 68+ hours for a player, then you can use the value of int Timer.)
An alternative, that hasn't been mentioned, but that would require extensive work, is to store every 'day' combo, and its matching 'night' combo a set number of spaces apart on every combo page, and during a transition, use draw commands to replace all combos on any given screen with the /- value of its matching combo. You could do that wish a basic for loop, but the work involved in making a day/night tileset would be extraordinary.
#11
Posted 25 August 2014 - 07:46 AM
I just tried this and it created a scanline effect. Is it possible that the trick only works for some computers?Also, if you plan on taking the transparency route, I've found that a good way of faking a paler transparency would be to use a 50/50 dithering effect with a maximum speed two-frame animation that alternates the clear and filled pixels. I used that method for a tranparent fog effect that looks very good when layered with a canopy shadow transparency over it, and it may help you if you decide on layering additional transparencies for your intended effect. (I don't know how well it would work since you're doing a full-screen transparency, but with my fog animation trick, the effect was made even smoother by making the layer scroll diagonally as well.)
Anyways, EPad, here's an old quest of mine that never took off that illustrates the problems with a Day/Night script changing DMaps: https://www.dropbox....cQuest.qst?dl=0
You can hold down Ex1 to speed up the clock and observe what happens to the enemies as the palette changes.
#12
Posted 25 August 2014 - 08:02 AM
@Moosh I checked out the Epic.qst and it is very close to what I was looking for, minus the timer on the bottom and the long period of time itself. I was probably aiming to do 3 or 5 minutes for each transition. I only stopped after the Dmap changed so I wasn't sure if the timer stops if it reaches a certain point like Majora's Mask.
Now I am only having a timer for a large section of my overworld, two sub-overworlds uses a different Cset so I don't think it will look nice with the Night Cset. Can I try the script in my quest for a bit? If so, what do I need to change for the transition to work over time, how does the set up work, and does the timer continue if I go to another Dmap?
#13
Posted 25 August 2014 - 08:25 AM
#14
Posted 25 August 2014 - 08:56 AM
This is the best way of which I'm aware to translate rel-world time (in seconds, rotating other counters to negate caps) into in-game time. I 'm using cascading functions for modularity, and some of these tracking events are very-specific to my work (e.g. Sesperzium Cycle).
I'll likely include it in RPG.zh, in a more-refined manner, assuming that I find a better way to handle blocks of time conversions, using constants, division, and a % == 0. Suggestions in that regard, I'd appreciate, as my current plan is to use integer division, and use two constants for operands, and if the division result yields a modulus value of 0, then the operation is a success...
That seems the best way to allow user-defined time conversion.
Edited by ZoriaRPG, 25 August 2014 - 10:57 PM.
- judasrising likes this
#15
Posted 25 August 2014 - 03:35 PM
Great! I don't know what else to say from your response @ZoriaRPG. Any more advanced coding talk will make my head spin
Also tagged with one or more of these keywords: day, night, cset, dmap
cset
Zelda Classic →
ZQuest Editor Help →
CSets: Use and TransparencyStarted by Timelord , 03 Mar 2020 cset, csets, transparent and 6 more... |
|
|
||
Zelda Classic →
ZQuest Editor Help →
Advanced Editor HelpStarted by Riflezen , 13 Oct 2019 Freeform Dungeons, DMap, Map, NPC |
|
|
||
Zelda Classic →
ZC Development →
ZC Feature Requests →
Quest flag for single hurt cset for link and enemiesStarted by Shadowblitz16 , 29 Apr 2019 hurt, cset, single |
|
|
||
Zelda Classic →
Scripting Discussion →
Random Worlds by Randomizing DMapsStarted by HeroOfFire , 09 Jun 2018 randomizer, random, world, DMap |
|
|
||
Zelda Classic →
ZQuest Editor Help →
Dmap Guy ConundrumStarted by linkinsphere , 27 Jan 2018 zquest, guy, interior, dmap |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users