Creating a Sound Object via script or otherwise looping a sound effect?

Hello everyone,

This may sound rather simple but I’ve not been able to find anything in the lexicon or my google searches. I’m trying to create a looping sound for a player placed campfire. Since we’ll never know where the players will put it, I want to create it on the placeable, so a static sound object won’t work.

I’ve had success triggering PlaySound through scripts, but is there some way to have it continuously play or to spawn a custom Sound Object on top of the campfire? If not, it’s not the end of the world, but it felt like a cool ambience thing.

Thanks in advance for any thoughts!

yes, you can do this, but it’s not a one-liner. one approach :

  1. import the sound file you want to use
  2. create a sound object using it. the easiest way to do this is to use the sound wizard to create a positional sound.
  3. paint down an instance of your new blueprint in the area you want your players to explore. make sure you set it to ‘inactive’.
  4. write scripts to turn on/off the sound and position it. the operative part for this could be, for example :

    object oSound = GetObjectByTag("bubbling");
    object oFire = GetObjectByTag("campfire");
    vector newloc = GetPosition(oFire);
    SoundObjectSetPosition(oSound, newloc);

@TSilverwolf You do realise that there is already a campfire sound object don’t you? It’s under Sounds/Civilisation. If you are going to have a different sound I would follow most of what @xorbaxian says with the following addition.

2a. On the Advanced tab under Play Style, select Seamlessly looping.


I realize that Sound Objects exist and can be placed in the world, even inactive, but my camping system allows you to place your camp wherever you want so just blanketing the area in them would be really time consuming for the return on investment.

If its not possible to spawn a sound object, is it possible to do a looping PlaySound function?

You could have the HB play the sound. Or start a pseudo-HB for more irregularity.

For the other suggestion you would not need to blanket the area. Just one per area where you could spawn campfires. Or if you expect more than one in an area then several per camping enabled area.

How is your campfire created? Are the camping placeables later cleaned up? Why not use a HB and PHB script from the placeables heart beat event?

Make a script for the fire’s heartbeat that calls a psuedo heartbeat as a “do once” only. The PHB script would then simply play a sound file on itself. Play and time a few of the core sound files. Most are 2-3 seconds in duration. Time the duration and set your PHB to simply refire itself after a delay equal to the track’s length.

1 Like

This is something I hadn’t considered! I didn’t know you could do a PHB or even an HB on a placeable. This actually opens up a lot of possibilities… They clean themselves up after a time, but the player is strongly incentivized to destroy it (to get their camping gear back for later use), so PHB/HB is totally reasonable. Even in multiplayer, the players would share 1 fire. Not much of a worry.

What a great idea, @kalbaern!

I need to turn in right now, but I will have a crack at this in the morning and report back.

Thank you!

Heh, you’re welcome?

1 Like

Oddness abounds. Your post didn’t show up for me when I made mine earlier, yet yours was 6 hours previous … board issues here maybe?

The board seems to be working fine. As it happens,when I last looked at this thread, only @meaglyn’s post was visible. @TSilverwolf’s post was added later, which is consistent with the time stamps.

No worries - it’s very easy to miss a post, in my experience.