Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Ingame Music.
Ingame Music.
2002-01-29, 4:35 PM #1
I want to have ingame music in my mod and I was told in the chat room to go here and get a cog. Thanks in advance.

------------------
Next question!!

[This message has been edited by Darth Hal (edited January 29, 2002).]
"Love is long-suffering and kind. Love is not jealous, it does not brag, does not get puffed up, does not behave indecently, does not look for its own interests, does not become provoked. It does not keep account of the injury. It does not rejoice over unrighteousness, but rejoices with the truth. It bears all things, believes all things, hopes all things, endures all things. Love never fails."

-1 Corinthians 13:4-8.

"Neither the sword of popes...nor the image of death will halt the march of truth."
-Francis David, 1579, written on the wall of his prison cell.
2002-01-29, 5:14 PM #2
Well, is this for a mod or a level? Cause it if it's for a level, here's a cog, and it should work.
Code:
# Jedi Knight Cog Script
#
# music.cog
#
# Plays music on the user's computer localy.

symbols

thing		player			

sound	musicSound=music.wav	local
int     channel=-1		local

message	startup
message newplayer
message killed

end

# ========================================================================================

code 

startup:

   player = GetLocalPlayerThing();
   channel = PlaySoundlocal(musicSound, 1.0, 0, 0x181);

       Return;
#=======================================================================================
newplayer:

channel = PlaySoundlocal(musicSound, 1.0, 0, 0x181);

       Return;
#=======================================================================================
killed:

if(channel != -1)
   {
      StopSound(channel, 0.1);
      channel = -1;
   }

   	 Return;

end

That should do it. [http://forums.massassi.net/html/biggrin.gif]
"The world is neither black nor white but differing shades of gray."
-By me.
2002-01-29, 5:29 PM #3
So do I specify what level the music is to be used in that cog? If so, what line of code will I need to edit?

------------------
Next question!!
"Love is long-suffering and kind. Love is not jealous, it does not brag, does not get puffed up, does not behave indecently, does not look for its own interests, does not become provoked. It does not keep account of the injury. It does not rejoice over unrighteousness, but rejoices with the truth. It bears all things, believes all things, hopes all things, endures all things. Love never fails."

-1 Corinthians 13:4-8.

"Neither the sword of popes...nor the image of death will halt the march of truth."
-Francis David, 1579, written on the wall of his prison cell.
2002-01-29, 5:34 PM #4
Theres a few problems I will point out with this cog:


You cannot change the sound without hacking the cog. (NEVER make a sound 'local'...)

The sound plays globally (As in non-positioned). It never stops, it never slows down, it just keeps playing in the background....

After awhile, a 30 second loop would get quite boring and annoying...



------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.
2002-01-29, 5:44 PM #5
So how does this cog work exactly? Is it part of a gob file? Could you point me to a tutorial that will help me because I can't seem to find one...

------------------
Next question!!
"Love is long-suffering and kind. Love is not jealous, it does not brag, does not get puffed up, does not behave indecently, does not look for its own interests, does not become provoked. It does not keep account of the injury. It does not rejoice over unrighteousness, but rejoices with the truth. It bears all things, believes all things, hopes all things, endures all things. Love never fails."

-1 Corinthians 13:4-8.

"Neither the sword of popes...nor the image of death will halt the march of truth."
-Francis David, 1579, written on the wall of his prison cell.
2002-01-30, 8:37 AM #6
Quote:
<font face="Verdana, Arial" size="2">You cannot change the sound without hacking the cog. (NEVER make a sound 'local'...)</font>


This cog is for a mod, so what's wrong with that?

The music should be left up to the level, and not a patch. But if you really want your mod to play music, here's a simple cog that does it:

Code:
# playmusic.cog
#
# Play custom music.
#
# [SM]
#======================================================================#
symbols

sound	music=yourSound.wav		local

message	startup

end
#======================================================================#
code
#----------------------------------------------------------------
startup:
	PlaySoundLocal(music, 1, 0, 0x1);

Return;
#----------------------------------------------------------------
end


Replace 'yourSound.wav' with the name of your .wav file. And to get this cog to run, you'll have to list it in a .jkl or the items.dat. Do you know how to do that?

[This message has been edited by SaberMaster (edited January 30, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-01-30, 12:22 PM #7
I guess, I just have to know which directory the file is in. Isn't there a tutorial that will explain the elementary use of cogs?

------------------
Next question!!
"Love is long-suffering and kind. Love is not jealous, it does not brag, does not get puffed up, does not behave indecently, does not look for its own interests, does not become provoked. It does not keep account of the injury. It does not rejoice over unrighteousness, but rejoices with the truth. It bears all things, believes all things, hopes all things, endures all things. Love never fails."

-1 Corinthians 13:4-8.

"Neither the sword of popes...nor the image of death will halt the march of truth."
-Francis David, 1579, written on the wall of his prison cell.
2002-02-01, 4:28 AM #8
No tutorial that I know of. Anyways, I'll explain:

Create a folder in your JK directory. Call it something like the name of your patch. Then create a shortcut to jk.exe. Right-click on the shortcut and click properties. On the target line, add path dirName. JK recognizes the path command and it will search the directory that the path command gives it for resources before it looks in the episode and resource dirs.

Now you have a patch folder. Create directories in this folder as they appear in the Res2 gob. To get your cog to run, create a folder called cog and a folder called jkl. Put your music cog in the cog directory. Open up the res2.gob and extract the static.jkl and put that in your jkl folder.

Now open up the static.jkl, and scroll to the bottom. Up the world cogscripts and world cogs limit by one and add your cog into the world cogs list. Like this:
Code:
########## COG scripts #########
Section: cogscripts
World scripts 51
end
################################


######### COG placement ########
Section: cogs
World cogs 51
#Num	Script          Symbol values

0: playmusic.cog

end
################################


Listing your cog there will let JK find the cog and run its system messages - startup in this case.

Now there's a tutorial. [http://forums.massassi.net/html/biggrin.gif]

Good luck [http://forums.massassi.net/html/wink.gif]

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-01, 7:53 AM #9
So then I put my music.wav in the same folder that the directory "cog" is in?

------------------
Next question!!
"Love is long-suffering and kind. Love is not jealous, it does not brag, does not get puffed up, does not behave indecently, does not look for its own interests, does not become provoked. It does not keep account of the injury. It does not rejoice over unrighteousness, but rejoices with the truth. It bears all things, believes all things, hopes all things, endures all things. Love never fails."

-1 Corinthians 13:4-8.

"Neither the sword of popes...nor the image of death will halt the march of truth."
-Francis David, 1579, written on the wall of his prison cell.
2002-02-01, 10:23 AM #10
SM,

Shouldn't it be "Each cog better than the last"?

------------------
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

-Tazz
-There are easier things in life than finding a good woman, like nailing Jello to a tree, for instance

Tazz
2002-02-04, 6:14 AM #11
Hal: Put your wav files in the sound folder. If you don't know what folder something is supposed to go into, open up the appropriate res gob in the resource folder with conman and see what directory the gob stores that file in. Then create that directory in your mod's folder.

Res1hi.gob (or Res1low.gob) stores the .wav files in a gob-folder called sound. So you create the sound folder in your mod's directory and JK will check there for .wav files.

Quote:
<font face="Verdana, Arial" size="2">Shouldn't it be "Each cog better than the last"?</font>


It should be, but that would spoil the humor. [http://forums.massassi.net/html/smile.gif] [http://forums.massassi.net/html/biggrin.gif]


------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!