Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Crossfade (https://forums.graalonline.com/forums/showthread.php?t=134264935)

Elk 10-31-2011 10:36 PM

Crossfade
 
If I have an URL loopplayed on an overworld, and I want it to crossfade into the Inn theme once I enter the Inn, is there a possability to do so with a script? Please let me know!

fowlplay4 10-31-2011 11:15 PM

Might be able to rig something together using gani sounds (good luck). Other than that, no.

0PiX0 10-31-2011 11:24 PM

Rather than streaming the file from a webserver every time, try downloading it as a game file.
HTML Code:

requesturlasgamefile(str, str, int, bool) - returns object - works similar to redirects in the folder configuration: you can use this function to download files from the web and treat them like files downloaded from the server; parameters are the url, the download filename, modification time (0 for current), and if the you want to force download (true/false), otherwise it will only download if the web server file changed
I know file size limitations are often exceeded with mp3 files. If you set up grattpd and have the music file available on your server, you should be able to download it to the client with requesturlasgamefile after setting serverr.ip and serverr.port from grattpd. Alternatively see if Stefan will enable large file downloads on your server.

As for the crossfade effect, that might be possible if you use 2 animations that play 2 different songs, and moved them to positions relative to the screen focus. But, then you would have to base your entire music system on animations. x_x

I did a bit of fiddling with $pref::audio::mp3volume to see if it was possible to fade out one song, and fade into a new one, but it seems that the actual audio volume output doesn't update until you open the Options window (at least on v6). People probably don't want their options messed with anyway.

oo_jazz_oo 10-31-2011 11:31 PM

Quote:

Originally Posted by Elk (Post 1672524)
If I have an URL loopplayed on an overworld, and I want it to crossfade into the Inn theme once I enter the Inn, is there a possability to do so with a script? Please let me know!

Could do something like this when entering a new level.
PHP Code:

//#CLIENTSIDE
function onPlayerEnters() {
  for(
temp.1temp.0temp.-= .1) {
    
setmusicvolume(temp.itemp.i);
    
sleep(.05);
  }
  
stopmidi();
  
playlooped("newsong");


Then could always use do another small loop to increase the volume of the second song. Not exactly crossfade, but, close. :D

0PiX0 10-31-2011 11:36 PM

I didn't know setmusicvolume existed. :o Cool.


All times are GMT +2. The time now is 03:09 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.