UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Radio sounds not playing in game

broken avatar :(
Created 4 years ago
by ERAWEX
0 Members and 1 Guest are viewing this topic.
1,071 views
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links
Hi there,

I have recently added radios to my map and for some reason the sound/music will not play after activating the radio trigger.

I have converted the sounds correctly, ticked them in the IWD file list  etc.

This is the script in the mapname.gsc
Code Snippet
Plaintext
radio1()
{
    radio = getEnt("radio1", "targetname"); //this is the radio model that the sound will come from
    radio_trigger = getEnt("radio1_trigger", "targetname"); //the trigger that you will use to start the sound

    radio_trigger setCursorHint("HINT_NOICON");
        radio_trigger UseTriggerRequireLookAt();
        radio_trigger setHintString("Press &&1 to activate radio"); //remove this if you don't want a hintstring
   
    for(;;)
    {
        radio_trigger waittill("trigger");

        if( level.radio_playing == 0 )
        {
            level.radio_playing = 1;
            radio_trigger disable_trigger();

            radio playsound("radio1");

            wait 330; //change this to the length of your sound
         
            radio_trigger enable_trigger();
            level.radio_playing = 0;
        }

        if( level.radio_playing == 1 )
        {
            iprintln("Please wait until other radios have finished playing");
            wait 5;
        }
    }
}
This is the soundalias
Code Snippet
Plaintext
name,file,platform,sequence,vol_min,vol_max,dist_min,dist_max,limit_count,limit_type,entity_limit_count,entity_limit_type,bus,volume_min_falloff_curve,volumefalloffcurve,reverb_send,dist_reverb_max,reverb_min_falloff_curve,reverb_falloff_curve,pitch_min,pitch_max,randomize_type,spatialized,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,chainaliasname,startdelay,speakermap,lfe percentage,center percentage,envelop_min,envelop_max,envelop percentage,occlusion_level,occlusion_wet_dry,real_delay,distance_lpf,move_type,move_time,min_priority,max_priority,min_priority_threshold,max_priority_threshold,,isbig

#2d sounds
radio1,radios\radio1.wav,,,1,1,,,,,,,music,,,0,,,,,,,2d,streamed,,,master,,,,,,,music_all,,,,,,,,,,,,90,90,0.25,1,,
radio2,radios\radio2.wav,,,1,1,,,,,,,music,,,0,,,,,,,2d,streamed,,,master,,,,,,,music_all,,,,,,,,,,,,90,90,0.25,1,,


#3d sounds
#radio1,radios\radio1.wav,,,1,1,50,200,,,,,music,,,0.8,1800,,curve0,1,1,,3d,streamed,,,,,,,,,,,,,100,200,0.5,0.25,,,,,,90,90,0.25,1,,
#radio2,radios\radio2.wav,,,1,1,50,200,,,,,music,,,0.8,1800,,curve0,1,1,,3d,streamed,,,,,,,,,,,,,100,200,0.5,0.25,,,,,,90,90,0.25,1,,


#full_vol - for sound effects
#music - for music
#voice - for dialog
Would anyone know what is wrong?
Any assistance is greatly appreciated
- ERAWEX
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 12 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
Signature
My published cod maps:

Subzero
Djinncaves
Enclosed (a.k.a baconcube)
Bayern
Snowblind
Furtrelock

Black Ops Perks: https://www.ugx-mods.com/forum/scripts/55/call-of-duty-world-at-war-black-ops-perks/22180/
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
Hi there,

I have recently added radios to my map and for some reason the sound/music will not play after activating the radio trigger.

I have converted the sounds correctly, ticked them in the IWD file list  etc.

This is the script in the mapname.gsc
Code Snippet
Plaintext
radio1()
{
    radio = getEnt("radio1", "targetname"); //this is the radio model that the sound will come from
    radio_trigger = getEnt("radio1_trigger", "targetname"); //the trigger that you will use to start the sound

    radio_trigger setCursorHint("HINT_NOICON");
        radio_trigger UseTriggerRequireLookAt();
        radio_trigger setHintString("Press &&1 to activate radio"); //remove this if you don't want a hintstring
   
    for(;;)
    {
        radio_trigger waittill("trigger");

        if( level.radio_playing == 0 )
        {
            level.radio_playing = 1;
            radio_trigger disable_trigger();

            radio playsound("radio1");

            wait 330; //change this to the length of your sound
         
            radio_trigger enable_trigger();
            level.radio_playing = 0;
        }

        if( level.radio_playing == 1 )
        {
            iprintln("Please wait until other radios have finished playing");
            wait 5;
        }
    }
}
This is the soundalias
Code Snippet
Plaintext
name,file,platform,sequence,vol_min,vol_max,dist_min,dist_max,limit_count,limit_type,entity_limit_count,entity_limit_type,bus,volume_min_falloff_curve,volumefalloffcurve,reverb_send,dist_reverb_max,reverb_min_falloff_curve,reverb_falloff_curve,pitch_min,pitch_max,randomize_type,spatialized,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,chainaliasname,startdelay,speakermap,lfe percentage,center percentage,envelop_min,envelop_max,envelop percentage,occlusion_level,occlusion_wet_dry,real_delay,distance_lpf,move_type,move_time,min_priority,max_priority,min_priority_threshold,max_priority_threshold,,isbig

#2d sounds
radio1,radios\radio1.wav,,,1,1,,,,,,,music,,,0,,,,,,,2d,streamed,,,master,,,,,,,music_all,,,,,,,,,,,,90,90,0.25,1,,
radio2,radios\radio2.wav,,,1,1,,,,,,,music,,,0,,,,,,,2d,streamed,,,master,,,,,,,music_all,,,,,,,,,,,,90,90,0.25,1,,


#3d sounds
#radio1,radios\radio1.wav,,,1,1,50,200,,,,,music,,,0.8,1800,,curve0,1,1,,3d,streamed,,,,,,,,,,,,,100,200,0.5,0.25,,,,,,90,90,0.25,1,,
#radio2,radios\radio2.wav,,,1,1,50,200,,,,,music,,,0.8,1800,,curve0,1,1,,3d,streamed,,,,,,,,,,,,,100,200,0.5,0.25,,,,,,90,90,0.25,1,,


#full_vol - for sound effects
#music - for music
#voice - for dialog
Would anyone know what is wrong?
Any assistance is greatly appreciated
- ERAWEX
may I see your mod.csv plus I want to know if that "iprintln" is showing you text.
Last Edit: April 06, 2020, 08:20:41 pm by gympie6
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links
may I see your mod.csv plus I want to know if that "iprintln" is showing you text.
Sure, this is the mod.csv
Code Snippet
Plaintext
// Zombie Mode Stuff
include,zombiemode
include,zombiemode_dogs
sound,_round_template,template
sound,radios,,all_sp
// Zombie Mode Strings
localize,zombie
// Mod Strings
localize,mod
stringtable,maps/mapsTable.csv
// Edited Loadout For Zombie Heroes
rawfile,maps\_loadout.gsc
// Edited LastStand For Deep Water Like Sumpf
rawfile,maps\_laststand.gsc
// Edited For Developer_Script
rawfile,maps\_debug.gsc
fx,env/fire/fx_fire_brush_smolder_sm
fx,env/fire/fx_fire_detail_fade_14
fx,env/fire/fx_fire_blown_md_blk_smk_distant_w
fx,env/fire/fx_fire_oil_md
fx,env/fire/fx_fire_campfire_small
fx,env/fire/fx_fire_player_torso
fx,env/light/fx_glow_hanginglamp
fx,env/light/fx_glow_emergency_red_blink
fx,env/light/fx_lights_candle_flame
fx,env/light/fx_light_flicker_slow
fx,env/electrical/fx_elec_player_md
fx,env/electrical/fx_elec_wire_spark_burst_blue
fx,env/electrical/fx_elec_wire_spark_burst
fx,maps/zombie/fx_zombie_wire_spark
fx,env/smoke/fx_smoke_smolder_sm_blk
fx,env/smoke/fx_smoke_smolder_md_gry
fx,env/smoke/fx_smoke_smolder_lg_gry
fx,env/smoke/fx_smoke_wood_chimney_med
fx,system_elements/fx_blood_drips_looped_decal
fx,explosions/fx_default_explosion
fx,explosions/tank_impact_dirt
fx,maps/zombie/fx_zombie_wire_spark
fx,fx,env/light/fx_glow_hanginglamp
fx,env/smoke/fx_fog_zombie_amb
fx,env/smoke/fx_fog_rolling_thick_slow
fx,env/electrical/fx_elec_wire_spark_burst_blue
fx,env/electrical/fx_elec_wire_spark_burst
fx,env/light/fx_lights_candle_flame
fx,env/light/fx_light_flicker_slow
fx,env/light/fx_lights_lantern_on
fx,system_elements/fx_blood_drips_looped_decal
fx,env/fire/fx_static_fire_md_anim
fx,env/fire/fx_fire_barrel_pm
fx,env/light/fx_light_godray_overcast_sm
fx,env/fire/fx_fire_barrel_d_light
sound,character,,all_sp
fx,misc/fx_zombie_treasure_box_light
material,mtl_ghillie
material,mtl_marine_sniper_hands
xmodel,viewhands_marine_sniper
weapon,sp\ak47
weapon,sp\ak47_upgraded
sound,mw1_guns,,all_mp
weapon,sp\deserteagle
weapon,sp\deserteagle_upgraded
weapon,sp\g36
weapon,sp\g36_upgraded
weapon,sp\p90
weapon,sp\p90_upgraded
weapon,sp\mp5
weapon,sp\mp5_upgraded
weapon,sp\rpd
weapon,sp\rpd_upgraded
weapon,sp\g3
weapon,sp\g3_upgraded
weapon,sp\m14
weapon,sp\m14_upgraded
weapon,sp\skorpion
weapon,sp\skorpion_upgraded
weapon,sp\m4
weapon,sp\m4_upgraded
// mortar strike
sound,mortar_strike,,,
weapon,sp\mortar_strike
material,hud_icon_m8_white_smoke
xmodel,projectile_us_smoke_grenade
xmodel,mortar_shell
fx,weapon/satchel/fx_explosion_satchel_generic
fx,blst_custom/streak_marker_smoke
fx,misc/fx_ui_airstrike_smk_green
fx,fm/napalm_head
fx,explosions/fx_explosion_charge_large
fx,env/water/fx_water_single_leak
fx,env/fire/fx_fire_blown_md_light_blk_smk_w
fx,bio/insects/fx_insects_lantern_1
fx,env/light/fx_glow_hanginglamp_dim
Regarding if the iprintIn, the text does show if I try to play a radio while the other one is playing.
- ERAWEX
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 12 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
Is your radio a scriptmodel?
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links
Yes it is with the kvp "targetname" "radio1/2".
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 6 September 2019
Last active: 2 years ago
Posts
10
Respect
Forum Rank
Legless Crawler
Primary Group
Community Mapper
My Groups
More
×
Vertasea's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Vertasea's Contact & Social Links
Step one don't follow ZK tutorials lol he had some bad habits with scripting :)
================================================================

In radiant add a trigger_use give it this kvp
Code Snippet
cs
targetname - radio_trigger
Also give it this kvp ( radio1 is the sound alias name for the sound you want to play )
Code Snippet
cs
script_sound - radio1 
You can copy paste as many of these as you want and give them all different script_sound kvp's
SCRIPT:
Open mapname.gsc and thread this in main()
Code Snippet
cs
level thread get_radio_triggers();
At the bottom of mapname.gsc add this
Code Snippet
cs
get_radio_triggers() {

    trigs = GetEntArray("radio_trigger", "targetname");

    for( i=0; i < trigs.size; i++ ) {
        trigs[i] thread radio_trigger_setup();
    }
}

radio_trigger_setup() {
    radio_is_playing = false;
    self SetCursorHint("HINT_NOICON");
    self UseTriggerRequireLookAt();

    while(true) {
       
        self SetHintString("Press ^3&&1^7 to activate radio");
        self waittill("trigger", player);
        self SetHintString("This radio is currently playing");

        if(radio_is_playing == false) {
            radio_is_playing = true;
            self PlaySound(self.script_sound);
            wait(9); // sound playback time in seconds
            radio_is_playing = false;
        }
        else if(radio_is_playing == true) {
            self SetHintString("Another radio is currently playing!");
            wait(1.5);
        }
    }
}
Make sure you have your sound converted correctly if you have to just reconvert it if this doesn't work, I just tested it and it works 100%. If you have any questions please let me know.
 
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 12 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
Alright but in your code it's:
Code Snippet
Plaintext
radio = getEnt("radio1", "targetname");
and in radiant it's actually:
Code Snippet
Plaintext
radio = getEnt("radio1/2", "targetname");
Check your kvp's and scripts again if something doesn't work.
Or use this to check if your radio can be found:
Code Snippet
Plaintext
if ( !IsDefined(radio1) )
{
    iPrintLnBold("Radio not found!");
}
Last Edit: April 06, 2020, 09:41:17 pm by gympie6
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links
Alright but in your code it's:
Code Snippet
Plaintext
radio = getEnt("radio1", "targetname");
and in radiant it's actually:
Code Snippet
Plaintext
radio = getEnt("radio1/2", "targetname");
Check your kvp's and scripts again if something doesn't work.
Or use this to check if your radio can be found:
Code Snippet
Plaintext
if ( !IsDefined(radio1) )
{
    iPrintLnBold("Radio not found!");
}
My bad, I meant that I have two differient radios. The first one has the kvp "radio1" and the second one "radio2".
The game does recognise the radios and the trigger can be activated but the sound/music does not play.
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 12 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
It can be a few things:
1, I am not sure if your soundalias is right, if you aren't using a default one then pick one or use the one below the reply.
2, The range is really low, set it to 8000 or something.
3, You can also try this:
Code Snippet
Plaintext
radio = getEnt("radio1", "targetname");
playsoundatposition("radio1", radio.origin);
For one of my maps I used this soundalias to make it working, you can copy it if you like:
Code Snippet
Plaintext
radio_song1,radio_songs\radio_song1.wav,,,0.8,0.8,125,500,,,,,music,,curve3,0.8,3200,,curve1,1,1,,3d,streamed,,,0.4,,,,,,,,,,,,,0.25,,,,,,50,50,0.15,0.85,,
I also got a fight before with sounds... Hard to say what it is.
I hope this will help you.
broken avatar :(
×
broken avatar :(
Location: ch
Date Registered: 28 March 2017
Last active: 1 year ago
Posts
51
Respect
Forum Rank
Rotting Walker
Primary Group
Member
×
ERAWEX's Groups
ERAWEX's Contact & Social Links
It can be a few things:
1, I am not sure if your soundalias is right, if you aren't using a default one then pick one or use the one below the reply.
2, The range is really low, set it to 8000 or something.
3, You can also try this:
Code Snippet
Plaintext
radio = getEnt("radio1", "targetname");
playsoundatposition("radio1", radio.origin);
For one of my maps I used this soundalias to make it working, you can copy it if you like:
Code Snippet
Plaintext
radio_song1,radio_songs\radio_song1.wav,,,0.8,0.8,125,500,,,,,music,,curve3,0.8,3200,,curve1,1,1,,3d,streamed,,,0.4,,,,,,,,,,,,,0.25,,,,,,50,50,0.15,0.85,,
I also got a fight before with sounds... Hard to say what it is.
I hope this will help you.
Will give that a try!
Thank you very much for your help it is greatly appreciated.
ERAWEX

 
Loading ...