lfnetwork.com mark read register faq members calendar

Thread: Questions Concerning Music
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 08-02-2005, 01:27 AM   #1
Mono_Giganto
Giant Monkey of Doom™
 
Mono_Giganto's Avatar
 
Join Date: Dec 2003
Location: Florida
Posts: 2,478
Current Game: Baldur's Gate EE
Veteran Modder Helpful! 
Questions Concerning Music

I've been playing around with music files lately, and I just had a few questions.

1. Is it possible to play a song via script? I think it is, but I'm not sure. If so, how "overriding" is the song played by script? For example, if I played a song via script, then entered battle, would it continue playing my song, or would it switch to the default battle music?

2. Is it possible to edit a module so that a single music track is played constantly regardless of fighting, rather than the normal In Battle/Out Of Battle switch?

3. This one is somewhat specific. Would it be possible to edit the bridge module on the Ravager so that Nihilus has a separate battle theme from the other fights that take place on the bridge?




Mono_Giganto is offline   you may: quote & reply,
Old 08-02-2005, 01:40 AM   #2
Doc Valentine
Ha-Ha Kotor Modding
 
Doc Valentine's Avatar
 
Join Date: Sep 2003
Location: In the eye of the beholder.
Posts: 1,133
Veteran Modder Helpful! 
As for your first question, I believe that there is a script line in the nwnscript.nss called Change BGM Music that should work out for you. As for the second, I too need to be able do do that for one of my levels in my mod. Perhaps we can work together to figure this out.


I don't need you no more in this world. I'll meet you in the next one, and don't be late.
Doc Valentine is offline   you may: quote & reply,
Old 08-02-2005, 04:13 AM   #3
Det. Bart Lasiter
obama.png
 
Det. Bart Lasiter's Avatar
 
Join Date: Mar 2005
Location: `(•.°)~
Posts: 7,997
Current Game: all
Forum Veteran LF Jester 
Try:
Code:
void main()
{
    PlaySound("sound_name");
}
I've never used this function before, but it looks very straight forward, and it's the only function I can see that contains a reference to sound-related stuff.
Then try:
Code:
void main()
{
    object oNih = GetObjectByTag("DarthNihilus");
    object oAttackee = GetLastHostileTarget(GetFirstPC());

    if (oNih == oAttackee)
    {
        PlaySound("sound_name");
    }
}
Again I'm not sure about the 'PlaySound()' function.

***edit***
I can't find a function of file that sets the background music though, just to play the music or get the music But perhaps there's a new K2 function I've overlooked (it's 4:31 AM here...)



"No, Mama. You can bet your sweet ass and half a titty whoever put that hit on you already got the cops in their back pocket." ~Black Dynamite

Last edited by Det. Bart Lasiter; 08-02-2005 at 04:31 AM.
Det. Bart Lasiter is offline   you may: quote & reply,
Old 08-02-2005, 05:18 AM   #4
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by Mono_Giganto
1. Is it possible to play a song via script? I think it is, but I'm not sure. If so, how "overriding" is the song played by script? For example, if I played a song via script, then entered battle, would it continue playing my song, or would it switch to the default battle music?
1) Yes, there are a set of functions that changes the ambient and battle music through scripts. For example, this script...

Code:
void main() {
    object oArea = GetArea(OBJECT_SELF);
    
    // Index in ambientmusic.2da
    int nAmbientMusic = 3;
    int nBattleMusic = 47;
    
    MusicBattleStop(oArea);
    MusicBattleChange(oArea, nBattleMusic);
    // MusicBattlePlay(oArea);

    MusicBackgroundStop(oArea);
    MusicBackgroundChangeDay(oArea, nAmbientMusic);
    MusicBackgroundChangeNight(oArea, nAmbientMusic);
    MusicBackgroundPlay(oArea);
}
...would change the ambient (non-combat) music in the current area to Darth Sion's theme, and the battle music to the Dxun Jungle battle track. Use MusicBackgroundPlay() to play the background new music or MusicBattlePlay() to play the battle music again.

The numbers you specify are indexes in the ambientmusic.2da file (for both ambient and combat music).

2) You can use those functions to set the ambient and battle music to play the same track in the AreaEnter script or somewhere else suitable. Unless you want to repackage the whole module just to change the music in the GIT file, which IMHO is slight overkill.

While you might still get the transition part played, it will just transition to more battle music when the fight ends.

3) You can use those functions in the trigger script that runs the "Nihilus dazes the player" cutscene when you reach the end of the bridge catwalk, to change the area's battle/ambient music to Nihilus theme.

Last edited by stoffe -mkb-; 08-13-2005 at 08:23 AM.
stoffe is offline   you may: quote & reply,
Old 08-02-2005, 06:32 AM   #5
Doc Valentine
Ha-Ha Kotor Modding
 
Doc Valentine's Avatar
 
Join Date: Sep 2003
Location: In the eye of the beholder.
Posts: 1,133
Veteran Modder Helpful! 
Quote:
2) You can use those functions to set the ambient and battle music to play the same track in the AreaEnter script or somewhere else suitable. Unless you want to repackage the whole module just to change the music in the GIT file, which IMHO is slight overkill.
Actually I have tried it this way myself. Unfortunately whenever you leave a battle the song restarts and I’m a bit of a stickler for that.

-Gsccc


I don't need you no more in this world. I'll meet you in the next one, and don't be late.
Doc Valentine is offline   you may: quote & reply,
Old 08-02-2005, 10:23 AM   #6
Darth333
Administraterror
 
Darth333's Avatar
 
Status: Administrator
Join Date: Feb 2004
Location: In my secret dungeon...
Posts: 8,292
You could try to put something like this in the OnHeartbeat event:
Code:
void main()
{
int nTrack= MusicBackgroundGetDayTrack(oArea);
if nTrack!= 3
        {
	MusicBackgroundChangeDay(oArea, 3, FALSE));
        }
}
Another thing I use when I want to change the music temporarily during a cutscene per example, is this:
Code:
void main()
{
//Check what's currently playing - lazy method but it's usable in any module 
// and there is no need to manuallt check what's playing
    int nTrack = MusicBackgroundGetDayTrack(oArea);

//Play the track I want: 
    DelayCommand(3.0,MusicBackgroundChangeDay(oArea, 4, FALSE));

// Back to the old track:
    DelayCommand(45.0,MusicBackgroundChangeDay(oArea, nTrack)); 
}
Darth333 is offline   you may: quote & reply,
Old 08-02-2005, 12:10 PM   #7
Mono_Giganto
Giant Monkey of Doom™
 
Mono_Giganto's Avatar
 
Join Date: Dec 2003
Location: Florida
Posts: 2,478
Current Game: Baldur's Gate EE
Veteran Modder Helpful! 
Quote:
Originally Posted by Gsccc
Actually I have tried it this way myself. Unfortunately whenever you leave a battle the song restarts and I’m a bit of a stickler for that.

-Gsccc

Yeah, I was hoping to avoid that too.

Thanks for the tips everyone, I'll look into it.




Mono_Giganto is offline   you may: quote & reply,
Old 08-02-2005, 06:56 PM   #8
Mono_Giganto
Giant Monkey of Doom™
 
Mono_Giganto's Avatar
 
Join Date: Dec 2003
Location: Florida
Posts: 2,478
Current Game: Baldur's Gate EE
Veteran Modder Helpful! 
Oh, I do have one other question. I'm not familiar with cinematics, so I want to ask. If I edit a track played during a cinematic, will it change for that cinematic? I'm not sure if the music is part of the cinematic itself or not.




Mono_Giganto is offline   you may: quote & reply,
Old 08-02-2005, 11:31 PM   #9
Det. Bart Lasiter
obama.png
 
Det. Bart Lasiter's Avatar
 
Join Date: Mar 2005
Location: `(•.°)~
Posts: 7,997
Current Game: all
Forum Veteran LF Jester 
Quote:
You could try to put something like this in the OnHeartbeat event:
On a related note, what is the 'OnHeartbeat' event?



"No, Mama. You can bet your sweet ass and half a titty whoever put that hit on you already got the cops in their back pocket." ~Black Dynamite
Det. Bart Lasiter is offline   you may: quote & reply,
Old 08-03-2005, 05:08 AM   #10
Tupac Amaru
Junior Member
 
Tupac Amaru's Avatar
 
Join Date: Mar 2005
Location: Tahuantinsuyu
Posts: 273
Quote:
Originally Posted by Mono_Giganto
Oh, I do have one other question. I'm not familiar with cinematics, so I want to ask. If I edit a track played during a cinematic, will it change for that cinematic? I'm not sure if the music is part of the cinematic itself or not.
The music played during a cinematic can be specified in the AmbientTrack field of the .dlg. If you modify the sound file, the music should change in the cinematics as well.
Tupac Amaru is offline   you may: quote & reply,
Old 08-03-2005, 09:36 AM   #11
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by jmac7142
On a related note, what is the 'OnHeartbeat' event?
The Heartbeat is an event that usually triggers once every round (every 6 seconds) for some types of objects. The Module, areas, placeables, creatures, triggers, doors etc all have Heartbeat events, while some objects, like items, waypoints and stores/merchants, do not.

The objects that have heartbeat events can be assigned a script that will be run whenever their heartbeat event is triggered.

Heartbeat scripts are useful for things that must be done (or checked for) continually. The creature AI uses them for playing ambient animations (looking around, scratching head etc) and for following you around, for example.
stoffe is offline   you may: quote & reply,
Old 08-03-2005, 03:07 PM   #12
The_Maker
Veteran
 
The_Maker's Avatar
 
Join Date: Mar 2005
Posts: 966
Lightbulb

Quote:
Originally Posted by Mono_Giganto
Oh, I do have one other question. I'm not familiar with cinematics, so I want to ask. If I edit a track played during a cinematic, will it change for that cinematic? I'm not sure if the music is part of the cinematic itself or not.
I opened up a .bik file from my Kotor movie directory and it played the sound you hear when in game so I am thinking the sound is part of the cinematic itself and not an individual file. could be wrong though but I am pretty sure the sound and the .bik file are joined together.


The_Maker is offline   you may: quote & reply,
Old 08-03-2005, 05:58 PM   #13
Doc Valentine
Ha-Ha Kotor Modding
 
Doc Valentine's Avatar
 
Join Date: Sep 2003
Location: In the eye of the beholder.
Posts: 1,133
Veteran Modder Helpful! 
Well I guess that depends on which cinematic you are talking about, in the bik movies you cant change it unless you use RAD video tools to decompress it and edit it then bink it back to the original file.

In an in game cutscene all you have to do is change the ambient track in the .dlg file, and yes if you change the track in the StreamMusic file that plays in the cinematic the cinematic music will change too. Though just changing the ambient track is much less messy.

If you want to add a new musical track completely without hurting any of the old ones, you have to do a bit of 2da edititng. PM me if you have any questions on that as I do it all the time for my mod.


I don't need you no more in this world. I'll meet you in the next one, and don't be late.
Doc Valentine is offline   you may: quote & reply,
Old 08-03-2005, 07:03 PM   #14
Darth333
Administraterror
 
Darth333's Avatar
 
Status: Administrator
Join Date: Feb 2004
Location: In my secret dungeon...
Posts: 8,292
In fact adding your new custom track is pretty easy: just add a line to ambientmusic.2da and drop a mp3 file in the streammusic folder
Darth333 is offline   you may: quote & reply,
Old 08-13-2005, 03:49 AM   #15
stingerhs
Follow the Wolves
 
stingerhs's Avatar
 
Status: Moderator
Join Date: May 2004
Location: between my ears
Posts: 4,641
Current Game: Dead Space
Forum Veteran Roleplayer LFN Staff Member Helpful! 
okay, i have a quicky: i've been using stoffe's script to change the area music to a special cutscene track that i made. the problem is that i've also included another script to revert the area music back to the module's original track, and it cuts the cutscene music short.

is there a way to extend the length of the cutscene in the script to make it so that the cutscene won't end until the music does??


See the struggle of the faithless lot as they negate their time
How low to sink to the depths of their frame of mind

stingerhs is offline   you may: quote & reply,
Old 08-13-2005, 07:50 AM   #16
darkwarrior
Rookie
 
Join Date: Feb 2005
Posts: 30
I'm struggling with the same problem. I'm restoring a cutscene between Nihilus and Sion and think it would look amazing to have Nihilus attack as his theme tune plays but I can't seem to make it override the background theme.
darkwarrior is offline   you may: quote & reply,
Old 08-13-2005, 11:20 PM   #17
stingerhs
Follow the Wolves
 
stingerhs's Avatar
 
Status: Moderator
Join Date: May 2004
Location: between my ears
Posts: 4,641
Current Game: Dead Space
Forum Veteran Roleplayer LFN Staff Member Helpful! 
okay, well, let me rephrase the question a bit (with a bit of creativity, hehe). anyways, would it be possible to have the cutscene slowly fade to black and pause for a specified amount of time (theoretically until the music quits playing)??


See the struggle of the faithless lot as they negate their time
How low to sink to the depths of their frame of mind

stingerhs is offline   you may: quote & reply,
Old 08-13-2005, 11:30 PM   #18
stoffe
Network Caretaker
 
stoffe's Avatar
 
Status: Administrator
Join Date: Apr 2002
Posts: 5,833
Helpful! 10 year veteran! Notable contributor 
Quote:
Originally Posted by stingerhs
okay, well, let me rephrase the question a bit (with a bit of creativity, hehe). anyways, would it be possible to have the cutscene slowly fade to black and pause for a specified amount of time (theoretically until the music quits playing)??
That should be possible. I think this example should work like that:
Code:
void main() {
    SetGlobalFadeOut(0.0, 5.0);
    DelayCommand(5.0, MusicBackgroundStop(GetArea(OBJECT_SELF)));
    SetGlobalFadeIn(6.0, 0.5);  
}
That should fade to black for 5 seconds. When it reaches black after 5 seconds, it stops the ambient music and fades back in.

You'd have to tweak the timing for when the music stops manually, since there is no way of checking in a script if the music has stopped yet.

stoffe is offline   you may: quote & reply,
Old 08-14-2005, 12:05 AM   #19
stingerhs
Follow the Wolves
 
stingerhs's Avatar
 
Status: Moderator
Join Date: May 2004
Location: between my ears
Posts: 4,641
Current Game: Dead Space
Forum Veteran Roleplayer LFN Staff Member Helpful! 
i kinda figured i'd have to do some tweaking by going that route. at least it'll get the job done. thanx.


See the struggle of the faithless lot as they negate their time
How low to sink to the depths of their frame of mind

stingerhs is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Questions Concerning Music

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:17 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.