Jump to content
The Dark Mod Forums

Different ambient sound when reading a book etc


Bikerdude

Recommended Posts

No, you can change ambient sounds in real time but you need to change locations before the sound change starts playing. So in my FMs I changed the ambient, teleported the player to another location, then teleported them back to the original location. Outside of that I don't think it's possible.

But you should walk having internal dignity. Be a wonderful person who can dance pleasantly to the rhythm of the universe.

-Sun Myung Moon

 

My work blog: gfleisher.blogspot.com

Link to comment
Share on other sites

1 - Is the readable one you can carry around with you and read later? Or are you forced to stand and read it where you found it?

 

2 - Is it acceptable that the music you want playing while the readable is being read be played over the top of the current ambient music? Perhaps the ambient is soft and the reading music is louder?

Link to comment
Share on other sites

What I'd do is just copy the location_settings.script, make a FM pk4 version, and add a new case at the top to check a dummy variable that reading changes, and have it either force the reading ambient directly or force a special location with that ambient assigned so the fading still operates, and it keeps it until the reading stops. The problem is if the tdm version of that script changes your FM is out of date.

 

Or a more straightforward and failsafe route would be to just have the reading trigger a custom script that setKey's in null values to the appropriate location_settings or info_location entity properties that silences the location ambient, then trigger a speaker that plays the reading ambient, then when it's done, a script setKeys back in the values that make the location ambient work again. That would be an easy and clean way to do it.

 

Edit. Hmm, but maybe it doesn't take effect until the location change like Moonbo said. Well the location_settings entity is the speaker playing it. Can you have a script kill the entity then later spawn a new one with the right properties to play again? That's what I'd try next. Then, if no dice, I'd go back to my first solution.

 

Edit2. Another sneaky hack approach would be to have a custom script setKey in new location names for all the info_locations, to trick the script into thinking you actually have changed locations and it shuts off, or even better assign the readable ambient to that new name. Then later setKey them back.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Is it possible to pause the ambient sound? If you stop the ambient sound for reading the document, it would start at zero again. This can get quite annoying, if you open the document a couple of time. Maybe you could set the ambient volume to zero or at least very low and play the reading sound, then turn the ambient volume back to its former value.

Link to comment
Share on other sites

Thief used a low constant hum so there was no real 'beginning'. But if you used a speaker, yes, you could definitely just let it run and have a script raise and lower volume. But the solution I gave above would also keep it running for a while so it'd continue if you reopened it quickly.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

One could alter the location script so it allows such a feature. Not really hard to implement me thinks.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Not sure what you mean.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Since it's my script. I could put in a spawnarg check that allows a mapper to override the location ambient at any time and play another designated ambient while the condition holds.

But what's easiest for mappers? Targeting the entity? (The problem with that is the location entity does not only do sound, it also handles ambient lighting and script calls. But granted targeting is a very simple mechanism for mappers.) I think it'd be easiest to just have an "override" "0/1" argument you can set in-game by script, but that's because scripts are natural for me.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

On this, is there a way to setKey a propery just with an entity from DR targeting it or something without a script? Or is the script command $n.setKey(p,k) the only way?

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

target_setkey iirc

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Ok. What I can do is a simple "override" property check at the head. If it's set to anything but zero or I guess null with this entity, the current playing ambient fades out and stops, even in the same location.

 

If you plug in the name of an ambient as the key, it plays that (fade in). If you set it back to zero or null, it fades the override ambient out and the location ambient back in. Set a new override ambient, and it fades to that. This is easier than Moonbo's way, I think.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Now we can have dramatic musical interludes to accompany plot twists. :smile:

 

target_setkey iirc

target_setkeyval is what I can find in DR. For whatever reason, it and target_endlevel are at the bottom of the /darkmod/ listing rather than in /darkmod/Targets.

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

Ok, I have updated the location_settings system to allow for easy overrides.

 

Here's the files & a test map for interested parties to see it in action and beta-test it:

http://s000.tinyupload.com/?file_id=08316476051897568443

 

There's a readme inside the zip folder that explains everything.

 

I've tested it a lot and haven't seen it break yet, but I invite you all to test it too, both in the test map and in any past FM to see that ambients are not affected (they shouldn't be). But also you can look at it to see how it's done, and of course if you think of a better way to do something feel free to suggest it here.

 

If people like this update, then you can discuss if you want to make it official, or I suppose the regular coders can discuss it in the Developer's Forum or over PM, since I'm not a regular coder. This is just the code I originally did, so I have some attachment to it & want to make it work for people.

 

@Demagoge, so am I right in saying my original question could be done by a simple script..?

 

Not with the existing system no. You'd have to do what Moonbo did & teleport the player in and out for the change to register.

 

But, with the new system I just made linked above, yes. You can do it with one simple setKey to the "override" property on the location_settings, which you can do with either a script or if you trigger a target_setkeyval entity. Just copy what the test map does. It's very simple.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Just a little update to expedite things.

 

If people still want to test and comment on the above test map, great.

This is the final version we'd want to actually go into the game though: http://s000.tinyupload.com/?file_id=02573802787199245667

 

This is exactly the same, it just takes out some of the console spam, which is useful for testing the system, but I don't think mappers need it in the final version.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Just to make sure it doesn't get overlooked: the version of tdm_location_settings.script you've built on (presumably the current release version from 2.03) is missing the fix to http://bugs.thedarkmod.com/view.php?id=4213

 

Is there an elegant way for scripts to handle playing an ambient track without looping - e.g. to react to some dramatic event by changing the ambient to darkmod_teaser.ogg, then fade the normal ambient back in after it finishes - or would one just have to call sys.wait(<duration of non-looping track>) before removing the override?

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

I built off 2.03, yes. I was worried about missing a newer version on the svn, too. Thanks for checking that. I can only get my laptop online at work, so it might be easier if someone just gives a link to an uploaded svn version of the script & I can re-integrate it (since it might be tricky to update the whole svn).

 

As for the one-shot sound issue, I don't know what signal, if any, a speaker gives that a sound has finished playing, or that it's currently playing. If you find either one of those signals, the mapper would have a script that checks it and triggers the cancel-override when it changes. And I could add a 'oneshot_override' property that does it automatically. It's not inconceivable, I just can't think what the check would be for offhand.

 

But aside from that, the sys.wait is the only one I can think of too. Be nice if there were an automatic way to get the duration.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

  • 3 weeks later...

Alrighty, absent any hijinx, it's in for 2.04.

I wrote up instructions in the wiki.

http://wiki.thedarkmod.com/index.php?title=Location_Settings#Sound_Override

 

To those interested, let me know if you don't understand something or think something might be potentially confusing in my explanation.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 3 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 7 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...