Modme Forums

Make sound play from multiple structs?

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


ModmeBot:

Thread By: Exofile
I got some help to set up a script <em>( Figure 1. )</em> that plays one of 5 songs from a struct <em>( Figure 2. )</em>
I need it to play from two structs that I have, but upon testing ingame it'll only play from one struct, then upon next activation from another, never really playing the same song on both structs at once.
My question is, what am I doing wrong? Could it have something to do with the soundalias settings? <em>( Figure 3. )</em>

Figure 1.

function amb_radio()
{
    radio = struct::get_array("ambient_radio", "targetname"); //can be any "physical" entity type (struct included)
	trigger = getEnt("exo_bio_radio_1", "targetname");
	possible_songs = StrTok(radio[0].script_string, ",");
    for(;;)
	{
		trigger waittill("trigger", player);
		IPrintLn( "Player Entered" );
		wait(0.1);
		song = possible_songs[RandomIntRange(0, possible_songs.size)];
		IPrintLn( song );
		foreach(struct in radio)
        {
            struct PlaySound( song );
        }
		wait(204);
		IPrintLn( "Song done" );
        wait(RandomIntRange(30, 60));
		IPrintLn( "Wait done" );
    }
}



Figure 2.




Figure 3.

Name,Behavior,Storage,FileSpec,FileSpecSustain,FileSpecRelease,Template,Loadspec,Secondary,SustainAlias,ReleaseAlias,Bus,VolumeGroup,DuckGroup,Duck,ReverbSend,CenterSend,VolMin,VolMax,DistMin,DistMaxDry,DistMaxWet,DryMinCurve,DryMaxCurve,WetMinCurve,WetMaxCurve,LimitCount,LimitType,EntityLimitCount,EntityLimitType,PitchMin,PitchMax,PriorityMin,PriorityMax,PriorityThresholdMin,PriorityThresholdMax,AmplitudePriority,PanType,Pan,Futz,Looping,RandomizeType,Probability,StartDelay,EnvelopMin,EnvelopMax,EnvelopPercent,OcclusionLevel,IsBig,DistanceLpf,FluxType,FluxTime,Subtitle,Doppler,ContextType,ContextValue,ContextType1,ContextValue1,ContextType2,ContextValue2,ContextType3,ContextValue3,Timescale,IsMusic,IsCinematic,FadeIn,FadeOut,Pauseable,StopOnEntDeath,Compression,StopOnPlay,DopplerScale,FutzPatch,VoiceLimit,IgnoreMaxDist,NeverPlayTwice,ContinuousPan,FileSource,FileSourceSustain,FileSourceRelease,FileTarget,FileTargetSustain,FileTargetRelease,Platform,Language,OutputDevices,PlatformMask,WiiUMono,StopAlias,DistanceLpfMin,DistanceLpfMax,FacialAnimationName,RestartContextLoops,SilentInCPZ,ContextFailsafe,GPAD,GPADOnly,MuteVoice,MuteMusic,RowSourceFileName,RowSourceShortName,RowSourceLineNumber
test_sound,,,tst\test_sound.wav,,,UIN_MOD,,,,,,,,,,,80,80,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
exo_bio_radio_0,,,exo_bio\exo_bio_radio_0.wav,,,UIN_MOD,,,,,bus_music,,,,0,0,100,100,0,800,801,,,,,0,none,,,,,,,,,,3d,,,NONLOOPING,,,0,0,0,0,,,,,,,,,,,,,,,,,yes,,,,yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
exo_bio_radio_1,,,exo_bio\exo_bio_radio_1.wav,,,UIN_MOD,,,,,bus_music,,,,0,0,100,100,0,800,801,,,,,0,none,,,,,,,,,,3d,,,NONLOOPING,,,0,0,0,0,,,,,,,,,,,,,,,,,yes,,,,yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
exo_bio_radio_2,,,exo_bio\exo_bio_radio_2.wav,,,UIN_MOD,,,,,bus_music,,,,0,0,100,100,0,800,801,,,,,0,none,,,,,,,,,,3d,,,NONLOOPING,,,0,0,0,0,,,,,,,,,,,,,,,,,yes,,,,yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
exo_bio_radio_3,,,exo_bio\exo_bio_radio_3.wav,,,UIN_MOD,,,,,bus_music,,,,0,0,100,100,0,800,801,,,,,0,none,,,,,,,,,,3d,,,NONLOOPING,,,0,0,0,0,,,,,,,,,,,,,,,,,yes,,,,yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
exo_bio_radio_4,,,exo_bio\exo_bio_radio_4.wav,,,UIN_MOD,,,,,bus_music,,,,0,0,100,100,0,800,801,,,,,0,none,,,,,,,,,,3d,,,NONLOOPING,,,0,0,0,0,,,,,,,,,,,,,,,,,yes,,,,yes,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


ModmeBot:

Reply By: Exofile
Got it working thanks to some help from Ege115.

I switched my script_structs into script_origins, keeping the same KVP's and edited the function a tad bit to fit script_origi.

Working function

function amb_radio()
{
    radio = getEntArray("ambient_radio", "targetname");
	trigger = getEnt("exo_bio_radio_1", "targetname");
	possible_songs = StrTok(radio[0].script_string, ",");
    for(;;)
	{
		trigger waittill("trigger", player);
		IPrintLn( "Player Entered" );
		wait(0.1);
		song = possible_songs[RandomIntRange(0, possible_songs.size)];
		IPrintLn( song );
		for(i=0;i&lt;radio.size;i++) {="" radio[i]="" playsound(song);="" }="" wait(204);="" iprintln(="" "song="" done"="" );="" wait(randomintrange(30,="" 60));="" iprintln(="" "wait="" done"="" );="" }=""&gt;&lt;/radio.size;i++)&gt;