Jump to content

Photo

Modified Day/Night Script


  • Please log in to reply
33 replies to this topic

#16 justin

justin

    Adept

  • Members

Posted 21 January 2015 - 04:15 PM

warp effects are gonna be tricky.  we are using a direct warp (aka pitwarp) to warp Link to the new dmap, and you can't set a warp effect.  We could fake it...  

import "stdExtra.zh"
 
// handles actually changing the Time Period dmap (with warp effect)
void TS_CheckandWarp(int wipetime){
   int curDMap = Game->GetCurDMap();
 
   for(int i=0; i<SizeOfArray(TS_DMaps); i++){
      if(curDMap >= TS_DMaps[i] && curDMap < TS_DMaps[i]+TS_NUM_TIMEPERIODS){
         if(TS_DMaps[i] + TS_CurrentState != curDMap){
            if(wipetime>0) closingWipe(wipetime);
            Link->PitWarp(TS_DMaps[i] + TS_CurrentState, Game->GetCurDMapScreen());
            if(wipetime>0) openingWipe(wipetime);
            return;
         }
      }
   }
}

You'll need stdextra.zh which is available in the database.  It has some functions for drawing opening/closing wipes.  It looks like they'll be circle-wipes, if you wanted other types you'd have to figure out how to draw them.

 

Replace the TS_CheckandWarp function in my original script with this new version.  And anywhere in the code you call TS_CheckandWarp(); you'll have to have a number, constant or variable inside the brackets.  

- In the FFC_TS_WarpReturnCheck function, i'd put 0 inside the brackets because its just a utility warp because you're on the wrong dmap, so you probably don't want the wipe effect.  But if you do, put a number greater than 0.

- At the end of the I_ACT_TS_TimeChange function, put a number greater than 0 inside the brackets.  I haven't used those wipe functions, so I don't know what would look good.  Experiment with different values until you find something you like.


Edited by justin, 21 January 2015 - 06:25 PM.


#17 ywkls

ywkls

    Master

  • Members

Posted 21 January 2015 - 04:49 PM

There is a bug in that code. I got the error message "Unexpected return" pointing me to the line 

if(wipetime>0) openingWipe(wipetime)
            return;//This line here.

When I change it to

if(wipetime>0){ 
     openingWipe(wipetime);
     return;
} 

it compiles. But there's a catch. 

 

My copy of stdExtra.zh seems to be working (which is a nice change since I hadn't been able to get it to function before). I haven't gotten the various subscreens or items to be shown on those screens finalized yet (i was trying other ways to do it... that didn't work.) From what you said, I'm guessing that in the FFC_TS_WarpReturnCheck function, where it has TS_CheckandWarp() I'd change it to TS_CheckandWarp(0) and in the action script to something else. If I have these set up wrong let me know.

 

But there is still a bug in that code which haven't identified. With the new setup, the rest of the code doesn't seem to work. Instead, I hear the sound of a secret being triggered and stay right where I am.

 

Another line which seems to have the wrong syntax is this one.

if(TS_DMaps[i] + TS_CurrentState != curDMap){

Shouldn't this be:

if (curDMap != TS_DMaps[i] + TS_CurrentState)

That's all I can find that I can at least try to figure out. I leave the rest up to you. Thanks for your insight and experience and contribution to my work!


Edited by ywkls, 21 January 2015 - 04:50 PM.


#18 justin

justin

    Adept

  • Members

Posted 21 January 2015 - 06:33 PM

sorry, edited my previous code.  it was missing a semicolon on that line.  your solution with the curly braces will cause some more bugs.

 

stdextra.zh is just a bunch of functions that make scripting easier, like the functions in std.zh.  they aren't meant to do anything on their own.

 

the order of the things in that line doesn't matter.

 

the bug where you stay where you are might be because of those curly braces you added.  or it could be because its being called from an item script which only runs for one frame, but the wipe stuff uses Waitframe, so it might not ever get to the pitwarp statement if you are using the wipes.  Remove those braces, first try with 0 set for wipetime - if that's not working the bug is somewhere else.  If that works, then try with a wipetime greater than 0, if this doesn't work its the one frame issue - which means the item script will need to spawn a FFC to handle it.



#19 Lejes

Lejes

    Seeker of Runes

  • Members
  • Location:Flying High Above Monsteropolis

Posted 21 January 2015 - 07:21 PM

Item scripts only run for one frame. If there's a Waitframe in one, it's effectively the same as Quit. If you want effects that go on for a while, it's best to have the item script launch an FFC script (ffcscript.zh can help with that).



#20 ywkls

ywkls

    Master

  • Members

Posted 23 January 2015 - 12:05 AM

Or I could do something like this...

Spoiler

 

That compiles and does basically what I had in mind. There may be a more efficient way to do it, but it's nice when I can figure out how to accomplish something script-related on my own. Still, I wouldn't have gotten this far without the efforts of justin (for creating the main script) and Lejes (for giving ideas) and all the others who've written scripts over the years that I've studied over the past few months in an effort to learn how to do it. 


Edited by ywkls, 23 January 2015 - 09:44 AM.


#21 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 17 December 2019 - 09:41 AM

Hey, I'm a beginner in scripting.
Excuse my terrible english, cause it's not my first language.
I use a global "DayNight" script and have exactly those problems, that your modification is supposed to fix.
My only problem...
I'm not sure if I have to change my whole script (incl all declared Day/Night Maps) or if I can simply add/replace some signs in the constants ...and load the ffc script.

It would be so great if I can keep my script cause it took me much time, to get it working.

#22 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 17 December 2019 - 11:07 PM

Hey, I'm a beginner in scripting.
Excuse my terrible english, cause it's not my first language.
I use a global "DayNight" script and have exactly those problems, that your modification is supposed to fix.
My only problem...
I'm not sure if I have to change my whole script (incl all declared Day/Night Maps) or if I can simply add/replace some signs in the constants ...and load the ffc script.

It would be so great if I can keep my script cause it took me much time, to get it working.

 

You should probably try Rob's 2.55 scripts for day/night transition. They don't require multiple maps, but rather, they tint the entire palette.


  • Bagu likes this

#23 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 18 December 2019 - 12:57 AM

 

Official ZC Discord Server



#24 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 24 December 2019 - 07:59 PM

Hallo Zoria, I have to appologize for my late reply, once more.
I'm only using a prepaid mobile flatrate atm, highspeed volume was down.

I very glad that you are trying to help my. Thanks for your patience

What I really need is a script (perhaps ffc Script) that always uses a cave/itemroom warp return.
I found a script like that, but it only works on tile Warp "A" Combos.

I need a simialar script which is functional on variable warps/returns (including side/scrollingwarps)

Only changing palletes is not an option, cause I use different alternate maps for my Villages
(like open/closed houses, crowded/empty market place etc.)

My village maps are not part of the OW map.
It's more like in Zelda 2.
When you reach the entrance of a village, you warp into.
You can't view OW map, in the villages, so using different (simialar looking) maps, is not a problem.
Also, these alternate map's warps (Hauses) lead to alternate interior.
(meat people inside their houses at night, who were outside at daytime)

Edited by Bagu, 24 December 2019 - 08:04 PM.


#25 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 25 December 2019 - 04:20 AM

Only changing palletes is not an option, cause I use different alternate maps for my Villages
(like open/closed houses, crowded/empty market place etc.)

No, tint doesn't change WHICH palette you are using, it actually EDITS THE PALETTE; so it will work regardless of what palette you are using. That's the entire point of Tint. You should check out 'Graphics->Tint()' in the 2.55 ZScript documentation, and my Tint.zh header, and as Zoria said, my updated day/night script for 2.55.



#26 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 25 December 2019 - 11:41 AM

Alright, now I understand.
But I really need the DMap Switches, because of the alternate Village Maps.
It's tricky But I'm very happy with the Daynight Script I use by now.
I just need a script to check dmaps or dayLength on warp return.

Best would be a ffc or screen script, I guess.

Thanks for you help.
Very nice guys here!

I love this forum!!!

#27 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 25 December 2019 - 11:43 AM

Alright, now I understand.
But I really need the DMap Switches, because of the alternate Village Maps.
It's tricky But I'm very happy with the Daynight Script I use by now.
I just need a script to check dmaps or dayLength on warp return.

Best would be a ffc or screen script, I guess.

Thanks for you help.
Very nice guys here!

I love this forum!!!

? What do you mean by needing dmap switches for alternate village maps? The new tint script doesn't have anything to do with dmaps. You can do anything you want with dmaps, and the script doesn't care or use them.



#28 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 25 December 2019 - 11:51 AM

For example, I have one village map (24) on Dmap 24 and a copy (map 25) (with some changes) on Dmap25. Doors (Tile Warp Combos) replaced by unwalkable None Types,
Crowded Screens are empty, entrances lead to alternate interior, Midi/ambient Sound Changes etc.

Modifying the palette of DMap 24 wouldn't lead to DMap 25, where the alternative map 25 is used.

Edited by Bagu, 25 December 2019 - 11:53 AM.


#29 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 25 December 2019 - 12:03 PM

For example, I have one village map (24) on Dmap 24 and a copy (map 25) (with some changes) on Dmap25. Doors (Tile Warp Combos) replaced by unwalkable None Types,
Crowded Screens are empty, entrances lead to alternate interior, Midi/ambient Sound Changes etc.

Modifying the palette of DMap 24 wouldn't lead to DMap 25, where the alternative map 25 is used.

No, the tint modifications isn't tied to the dmap. It changes with the dmap.


Think of tint as like, you are putting a tinted lens in front of the screen.


  • Bagu likes this

#30 Bagu

Bagu

    Fandomizer

  • Members
  • Real Name:A.I. Bot Bottomheimer
  • Location:Germany

Posted 25 December 2019 - 12:06 PM

Oh, that's great

So this is the number of DayNight Maps, I use by now.

Might be a bit confuse, but it's because I often made backward changes, when I found/got new scripts

DMap 0 = Hyrule Northwest Day
DMap 1 = Hyrule Northwest Night
DMap 11 = Hyrule Northeast Day
DMap 12 = Hyrule Northeast Night
DMap 13 = Hyrule Southwest Day
DMap 14 = Hyrule Southwest Night
DMap 24 = Seeheim Day
DMap 25 = Seeheim Night
DMap 26 = Hyrule Southeast Day
DMap 27 = Hyrule Southeast Night

Can you help me modifying your script, to use this Dmaps


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users