Announcement

Collapse
No announcement yet.

Trigger music?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trigger music?

    I've finally started working on some things in Quake that I'm happy enough to continue forward with however, I have a question that I'm not sure has been particularly answered before.

    Is it possible to have triggers about the map that cue a certain music track within a pkg file and either have it trigger once or however many times a certain area is entered?

    What about a cue for when the player dies?

    I've been playing Tomb Raider 2 a lot lately on my PSP and I have to say it's been more inspiring for my current Quake maps than I thought.

    I kinda sorta know this guy who is also a fan of Quake and Tomb Raider and I asked him if he'd like to do a Quake soundtrack for my levels. Originally I was going to use full tracks but I found that Quake is pretty much fine most of the time WITHOUT music. But I thought It'd be cinematic and interesting to just have little music cues here and there to add a bit of charm.

    Obviously, all of the Tomb Raider games (minus the latest, haven't had a chance to play it yet) have inspired this decision.

    Is it possible?

    The only level I plan to have a solid track to play throughout is the start map and its nothing fancy. Pretty simple and mysterious.

    The cue for dying is leave or take, though it would be cool to be able to have one, it isn't a deal breaker.

    Thanks in advance guys n' gals!

  • #2
    I don't know the answer, but I can make it happen.

    Triggers work against targets, a track is not a target BUT that doesn't mean you can't make a custom trigger. Want me to make it for you?

    note: Chances are I will be done before you even reply. Cause, that's how I roll.
    http://www.nextgenquake.com

    Comment


    • #3
      Okey doke... It took me a minute to figure it out, but I have all the answers I need. You say "go" and I'll write the mod. You can have 1 of 2 flavors...

      enhanced trigger once or a unique trigger just for this.

      We'll worry about player death stuff next.
      http://www.nextgenquake.com

      Comment


      • #4
        That's interesting, ha! I know little about triggers so I'll just have to ask what the difference is =P

        Whichever is easiest for you I'd be willing to go with. I always manage to figure out how to use stuff even if it takes me a year.

        Comment


        • #5
          Dump the below into the end of triggers.qc and recompile your source

          Code:
          .float track_start;
          .float track_end;
          
          void() music_use
          {	//play track
          	WriteByte(MSG_ALL, SVC_CDTRACK);
          	WriteByte(MSG_ALL, self.track_start); // CD start track
          	WriteByte(MSG_ALL, self.track_end);
          
          	//remove trigger
          	self.touch = SUB_Null;
          	self.nextthink = time + 0.1;
          	self.think = SUB_Remove;
          };
          
          void() trigger_music
          {
          	if(!self.track_start) self.track_start = 1;
          	if(!self.track_end) self.track_end = 2;
          
          	InitTrigger(); //link to world
          	
          	self.touch = music_use;
          };
          If you are using radiant, dump the below in entities.ent (before </classes>). If you are using worldcraft just say so and I'll write the fgd for you.
          Code:
          <group name="trigger_music" color="0.5 0.0 0.5">
          	<integer key="track_start" name="track number"/>
          	<integer key="track_end" name="end on this track"/>
          </group>
          how to use:

          1) drop a brush in the world
          2) with it selected, right click and choose trigger_music
          3) open the entities inspector (N)
          4) for start track write the number of the track that you want to play
          5) for end track write the track you want to end on

          so if you want track 1 to play

          start: 1
          end: 2

          if you want tracks 1 through 3 to play

          start:1
          end:4

          Does this even work: In theory it certainly should, but I honestly never tested it. I wrote this in 2 minutes using microsoft notepad. If it don't work, I'll write it again and actually test it. This is not going to take a year for you to figure it out. Do exactly what I said and if it doesn't work, I'll test it and MAKE it work. The "install" steps will never be any different.
          Last edited by MadGypsy; 08-22-2013, 10:17 PM.
          http://www.nextgenquake.com

          Comment


          • #6
            Awesome, thanks! I'll be sure to see if I can give it a shot! It might be a bit before I can actually test it myself as well so I'll keep ya posted =D

            EDIT

            I'm actually using Toetag in OS X at the moment for all of the mapping so I'm not sure if I'll need to install windows or find something else to compile this with. It may take me a bit longer than expected to test it.
            Last edited by DimensionalWitch; 08-22-2013, 09:55 PM.

            Comment


            • #7
              Yup! change self.use to self.touch and you're good!

              tested and it works fully.

              You have regular Qc so far? I'll give you a compiled source with your trigger in it.

              Can you send me the equivalent of an entities.ent for toetag? If so, I can decipher it and write your mod inclusion in....


              ohh shit, apparently it will just keep playing the track lol. I need to find out how to turn it off.
              http://www.nextgenquake.com

              Comment


              • #8
                What the fuck! :mad face:

                I can't get this shit to stop! I have a legitimate track01 and track02. I told it to start on 1 and end on 2, but that shit is not ending. Hmmm, maybe I misunderstand the svc.

                I'm trying to help you DW and I'm really close but it isn't like there is a lot of code to change here (cause there is none to change). Imma figure this crap out.

                [[if R00k, Spike, Seven, Anyone that knows what the hell they are talking about want to chime in here, it would be great, cause I've hit a wall.]]
                http://www.nextgenquake.com

                Comment


                • #9
                  Yup, totally stumped. I have tried a number of things that I knew wouldn't work, and they didn't. On a side note, I went to the toe tag site to grab their entity definitions file and they are still too green to provide me with that. Although I could learn how to rotate a brush (fascinating). Anyway, I don't have a mac so I can't install it and rip it apart.

                  I was trying to close in all the details that I am capable of, but unfortunately I guess we are already at that point. I haven't given up, but I can't work on this any longer tonight. I have a feeling this is either a darkplaces thing or some deep engine thing I have no clue about...like, you can't start a cd track with a touch function or some bullshit like that.

                  Do me a favor and dig around in toe tag for an entity definition file. Beyond this mod I am curious as to the language. Plus once I ace the language I can start releasing toetag definitions with my radiant and worldcraft ones. These definition files are generally a lot of unnecessary fluff. If you know how to "who cares" your way through it, it is generally really easy to pick apart.

                  If I ever build a map editor (yup I could...in AIR), my def files are gonna be hella simple. I already laid all the groundwork for this with my parsing delimiters work.
                  http://www.nextgenquake.com

                  Comment


                  • #10
                    I agree. Most everything is pretty complicated in a lot of the editors so far.

                    I'll be sure to dig around in Toetag sometime tomorrow hopefully. I could look into dark places and see what can be done that's custom about it since I'm using that engine to test anyway. my vanilla copy decides when and when it doesn't want to load something, even id maps so I haven't been using it.

                    if it turns out i can only do this sort of thing in dark places, i wont really complain much.

                    Comment


                    • #11
                      Tomb Raider was one of my main inspirations for making games, as well. Awesome series.

                      To play musical cues, you need to place triggers in your levels that are connected to custom sound player entities.

                      Mods such as Quoth or ExtrasR4 include such sound player entities; vanilla Quake does not have this, it must be added via a QuakeC mod.

                      To stop a sound playing, simply play null.wav on the same entity and the same channel. Quake has various audio channels, like a mixing desk. For example, CHAN_BODY, CHAN_WEAPON and so on.

                      If you play a sound on an entity's CHAN_BODY, you can play misc/null.wav (an empty soundfile) on the same channel to stop the first sound.

                      Most Quake engines support only mono sound files, hence they will be directional in the game. However, Darkplaces and FTE also support stereo sounds.
                      Scout's Journey
                      Rune of Earth Magic

                      Comment


                      • #12
                        I thought about the sound way, but he said music. To me, that means "cd tracks". If he just wants to play a sound, I can make that happen but he will have to precache every last one of them. That's not ideal for a guy that obviously is just starting out.

                        Also, I want this to work (the way I started it). All this post did was remind me of a mod that I already wanted to make. I can get the music to play...I can't get it to stop. There is no way to target null.wav unless I know if the track is finished. I haven't explored those possibilities yet.
                        http://www.nextgenquake.com

                        Comment


                        • #13
                          The kind of musical cues that are so typical for Tomb Raider (triggered when you pick up a keyitem, etc) are best done with .wav files, not with CD tracks.
                          Scout's Journey
                          Rune of Earth Magic

                          Comment


                          • #14
                            there's no support for cross fading in any engine I know of.
                            this means that any music changes will be harsh abrupt changes.
                            (the only way to do cross-fading with cd tracks is to somehow read/rip the audio data off the cd in advance... cd playback apis are all single-track affairs).
                            also, changing cd tracks often results in engine stalls.
                            so yeah, can't be done with cd tracks.

                            starting sounds with level-wide attenuation can work, but again no cross-fading. You might be able to do some trick with sounds and distances to dynamically adjust volumes, but you'll still likely have issues with spacialisation (left+right speakers being different volumes based upon which direction you're looking in).
                            a couple of engines do support moving sounds by moving the entity that they are attached to, but this can be problematic with pvs culling (especially if the entities are tightly culled), but otherwise you have no control over sounds once they are spawned, other than to replace them.
                            (adding csqc, all you gain is the ability to move the player's listening position, which isn't useful).
                            if you want to 'change' the music when grabbing items etc, all I can really recommend is to have no background music at all, have some sort of timeout on pickup etc music, and to carefully plan where you put your audio triggers so that they don't compete with each other too much.
                            due to various sorts of latency, you won't be able to sync rhythms.

                            actually, thinking about it, you might be able to come up with some clever hack of the ambient_level stuff built into bsps, but that would require a total conversion, tools, and would still be limited.
                            Some Game Thing

                            Comment


                            • #15
                              Originally posted by Spike View Post
                              if you want to 'change' the music when grabbing items etc, all I can really recommend is to have no background music at all, have some sort of timeout on pickup etc music, and to carefully plan where you put your audio triggers so that they don't compete with each other too much.

                              Exactly. I have done this earlier. What this comes down to is having a completely dynamic soundtrack, ie no CD tracks at all.

                              Then place sound triggers cleverly around the map, predicting where the player will pass at what point.

                              Plus you can have ambient sounds, obviously.

                              So you're creating the game's audio by a combination of wav files playing in various parts of the level, some always playing, some triggered.

                              We're talking about musical cues, too, not about unchangeable "music" as in "Quake soundtrack". The two are rather different. Thus, "no background music" is a given when working like this.

                              Also, I don't see how this is "too difficult" for a beginner. Not at all. All you need are triggers, sound playing entities, and wav files.
                              Scout's Journey
                              Rune of Earth Magic

                              Comment

                              Working...
                              X