Modme Forums

Playing audio on a model?

Game Modding | Call of Duty: Black Ops 3 | Scripting


ModmeBot:

Thread By: The Black Death
In my map I have a script_model with targetname "aldwych_table_urn". Before a trigger is activated I want it to be playing a looping 3d sound, and after it'll play another sound (that won't loop).

To achieve this I've tried to use the functions:

// to start the looping audio
<entity> PlayLoopSound(<aliasname>)

// to end the looping audio
<entity> StopLoopSound(<aliasname>)

// to play the one-time sound
<entity> PlaySound(<aliasname>)</aliasname></entity></aliasname></entity></aliasname></entity>


(obviously not that code exactly, I have them set up with the script_model and the correct aliases.)

However, when in-game they are not playing the sounds.

Any ideas?


ModmeBot:

Reply By: mathfag
This should work. Make sure that the alias is 3d, looping and loud enough.

Also add iprintlnbold(); to make sure that the script is actually running


ModmeBot:

Reply By: The Black Death

mathfag
This should work. Make sure that the alias is 3d, looping and loud enough. Also add iprintlnbold(); to make sure that the script is actually running

I'll double check everything :)


ModmeBot:

Reply By: The Black Death

The Black Death
mathfag This should work. Make sure that the alias is 3d, looping and loud enough. Also add iprintlnbold(); to make sure that the script is actually running I'll double check everything :)

Okay, checked everything and found that the code is definitely running. Turned up the sounds to 90 volume and checked they were 3d, they still weren't playing.

these are the aliases I'm trying to use:
# after trigger is used:
activate,,,tbd_custom\zm_aldwych\quest_sfx\activate.wav,,,uin_mod,,,,,bus_fx,,,,,,90,90,50,700,701,,,,,3,oldest,,,1,1,,,,,,3d,wpn_all,,nonlooping,,,,,,,,,,,,,,,,,,,,,,,,,,,yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

# looping sound before trigger is used:
amb_electro_magnet_left,,,tbd_custom\zm_aldwych\quest_sfx\amb_electro_magnet_left.wav,,,uin_mod,,,,,bus_fx,,,,,,90,90,50,300,450,,,,,3,oldest,,,1,1,,,,,,3d,wpn_all,,looping,,,,,,,,,,,,,,,,,,,,,,,,,,,yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


And this is my code:
function mainQuestline() {
	iprintlnbold("function called");
	ritualTableUrn = GetEnt("aldwych_table_urn", "targetname");
	ritualTableUrn PlayLoopSound("amb_electro_magnet_left");
	
	ritualTableTrigger = GetEnt("aldwych_table_communicate", "targetname");
	ritualTableTrigger SetHintString("Hold ^3&&1 ^7to Communicate with the Spirit");
	
	ritualTableTrigger waittill("trigger", player);
	iprintlnbold("trigger called");
	ritualTableUrn StopLoopSound("amb_electro_magnet_left");
	ritualTableUrn PlaySound("activate");
	ritualTableTrigger TriggerEnable(false);
	
	wait(5);
	players = getPlayers();
	for(i = 0; i < players.size; i++) {
		players[i] PlayLocalSound("vox_antagonist_quest1");
	}
}

the PlayLocalSound works fine. it's just amb_electro_magnet_left and activate.


ModmeBot:

Reply By: ZombieKid164

The Black Death
In my map I have a script_model with targetname "aldwych_table_urn". Before a trigger is activated I want it to be playing a looping 3d sound, and after it'll play another sound (that won't loop). To achieve this I've tried to use the functions: // to start the looping audio PlayLoopSound() // to end the looping audio StopLoopSound() // to play the one-time sound PlaySound() (obviously not that code exactly, I have them set up with the script_model and the correct aliases.) However, when in-game they are not playing the sounds. Any ideas?

StopLoopSound() or stop loops of anything never seem to work for me. I would spawn a seperate model (like tag_origin) at the models origin then play the loop sound there, the. Delete the model when you are done


ModmeBot:

Reply By: The Black Death

ZombieKid164
The Black Death In my map I have a script_model with targetname "aldwych_table_urn". Before a trigger is activated I want it to be playing a looping 3d sound, and after it'll play another sound (that won't loop). To achieve this I've tried to use the functions: // to start the looping audio <entity> PlayLoopSound(<aliasname>) // to end the looping audio <entity> StopLoopSound(<aliasname>) // to play the one-time sound <entity> PlaySound(<aliasname>) (obviously not that code exactly, I have them set up with the script_model and the correct aliases.) However, when in-game they are not playing the sounds. Any ideas? StopLoopSound() or stop loops of anything never seem to work for me. I would spawn a desperate model (like tag_origin) at the models origin then play the loop sound there, the. Delete the model when you are done

I did give that a try (I found it in Nate's ambient sound code), but that also played no sounds. :/</aliasname></entity></aliasname></entity></aliasname></entity>


ModmeBot:

Reply By: ZombieKid164
Sounds like it's something with either your alias or your sound. Make sure your file path is correct, your sound is 48000htz, etc.


ModmeBot:

Reply By: The Black Death

ZombieKid164
Sounds like it's something with either your alias or your sound. Make sure your file path is correct, your sound is 48000htz, etc.

Yup, definitely is. I'm starting to think I've hit that stupid 2000 alias limit again, so I'll clean out some unneeded aliases.


ModmeBot:

Reply By: The Black Death

The Black Death
ZombieKid164 Sounds like it's something with either your alias or your sound. Make sure your file path is correct, your sound is 48000htz, etc. Yup, definitely is. I'm starting to think I've hit that stupid 2000 alias limit again, so I'll clean out some unneeded aliases.

Nope. I haven't hit the limit.

The sounds definitely should be fine - they're directly from zm_genesis and were pumped through Audacity to get them to wav.


ModmeBot:

Reply By: Harry Bo21

The Black Death
The Black Death ZombieKid164 Sounds like it's something with either your alias or your sound. Make sure your file path is correct, your sound is 48000htz, etc. Yup, definitely is. I'm starting to think I've hit that stupid 2000 alias limit again, so I'll clean out some unneeded aliases. Nope. I haven't hit the limit. The sounds definitely should be fine - they're directly from zm_genesis and were pumped through Audacity to get them to wav.

there certainly isnt a 2000 limit

it was 1400 over 9 years ago

theres a "overall size" limit of a sabl file only as far as i know


ModmeBot:

Reply By: The Black Death

Harry Bo21
The Black Death The Black Death ZombieKid164 Sounds like it's something with either your alias or your sound. Make sure your file path is correct, your sound is 48000htz, etc. Yup, definitely is. I'm starting to think I've hit that stupid 2000 alias limit again, so I'll clean out some unneeded aliases. Nope. I haven't hit the limit. The sounds definitely should be fine - they're directly from zm_genesis and were pumped through Audacity to get them to wav. there certainly isnt a 2000 limit it was 1400 over 9 years ago theres a "overall size" limit of a sabl file only as far as i know

Ah, okay


ModmeBot:

Reply By: The Black Death
Turns out it didn't like the idea of playing a sound with the urn. To solve this, I created a script_struct with a targetname I could call in GSC, then spawned a model there, set it to tag_origin and played sounds with that. Thread can be closed now.

Thanks to everyone who helped :)