Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: cod1-1.4: "script_origin" can't playsound()?

  1. #1
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post

    Question cod1-1.4: "script_origin" can't playsound()?

    hello,

    TL;DR: the common method (way of playing a sound at a location) PlaySoundAtLocation() which uses a "script_origin" entity isn't working for me, for some odd reason.
    i do see usage of that in the old AWE for COD1 and also in the main pk3's (e.g. _utils::PlaySoundAtLocation()), so i must be doing something wrong here.

    setup (creating a test mod):
    - i copy the default "mp/gametypes/tdm.gsc" (from the bundled pk3) into a new mod folder called "test"
    - i add the following two lines of code in tdm.gsc::spawnPlayer():
    Code:
    self iprintlnbold("spawned");
    self thread test();
    - the contents of test() are pretty simple:
    Code:
    test()
    {
    	self endon("death");
    	self endon("disconnect");
    	self endon("spectate");
    	
    	self iprintlnbold("enter thread");
    	wait 1.0;
    	self playsound("whizby");
    	wait 1.0;
    	
    	while (1) {
    		org = spawn("script_origin", origin);		
    		org playsound("whizby"); // <----------- no working
    		wait 1.0;
    		org delete();
    	}
    }

    testcase:
    - i start the sever with "CoDMP.exe +set fs_game test"
    - then i enter in the console:
    Code:
    set g_gametype "tdm"
    map mp_carentan
    entering a team:
    - "spawned" is printed
    - "enter thread" is printed
    - a "whizby" sound is played only once (i.e. only the "self playsound(...)" one)

    any ideas why the script entity isn't playing sound?

    notes:
    - my goals is pretty much to play a non-client, non-looping, sound at a specific location
    - i've also tried with "script_model' and the model spawns but...no sound.
    - i've tried with many different sound aliases including some bundled ones that AWE seems to use like "generic_pain_*", to no avail.

    cheers
    Last edited by lobolmart; 3rd April 2016 at 20:35.

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    show soundalias file.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. #3
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    "whizby" is one of the bundled sound aliases.

    defined in cod1's pak1.pk3/soundaliases/iw_sound.csv

    Code:
    name,sequence,file,vol_min,vol_max,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle	
    ---snip---
    
    #Bullet Whizbys,,,,,,,,,,,,,,	
    whizby,1,whizbys/whizby02.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,2,whizbys/whizby03.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,3,whizbys/whizby04.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,4,whizbys/whizby05.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,5,whizbys/whizby06.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,6,whizbys/whizby07.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,7,whizbys/whizby08.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,8,whizbys/whizby09.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,9,whizbys/whizby10.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,10,whizbys/whizby11.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,11,whizbys/whizby12.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,12,whizbys/whizby13.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,13,whizbys/whizby14.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,14,whizbys/whizby15.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,15,whizbys/whizby01.wav,0.85,1,0.8,1.1,100,700,auto,,,,,!airfield	
    whizby,16,null.wav,0.85,1,0.8,1.1,100,700,auto,,5,,,!airfield	
    	
    whizby,1,whizbys/whizby02.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,2,whizbys/whizby03.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,3,whizbys/whizby04.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,4,whizbys/whizby05.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,5,whizbys/whizby06.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,6,whizbys/whizby07.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,7,whizbys/whizby08.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,8,whizbys/whizby09.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,9,whizbys/whizby10.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,10,whizbys/whizby11.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,11,whizbys/whizby12.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,12,whizbys/whizby13.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,13,whizbys/whizby14.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,14,whizbys/whizby15.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,15,whizbys/whizby01.wav,0.45,0.65,0.8,1.1,100,700,auto,,,,,airfield	
    whizby,16,null.wav,0.45,0.65,0.8,1.1,100,700,auto,,16,,,airfield

  4. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    PHP Code:
    org spawn("script_origin"origin); 
    This looks kinda problematic, does it actually convert to self.origin? Maybe just try (0,0,0) as origin or explicitly use self.origin... maybe also iprintln(self.origin), just to be sure the origin is from the spawned player.
    timescale 0.01

  5. #5
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by kung foo man View Post
    PHP Code:
    org spawn("script_origin"origin); 
    This looks kinda problematic, does it actually convert to self.origin? Maybe just try (0,0,0) as origin or explicitly use self.origin... maybe also iprintln(self.origin), just to be sure the origin is from the spawned player.
    my bad, that's just a copy/paste typo. doesn't work with self.origin either, as i have tested it many times already.

    edit: to be clearer, it doesn't work no matter how the origin of the entity is set (via the spawn() constructor or explicitly with org.origin = self.origin)
    the origin of self and the entity does match according to debug prints.
    Last edited by lobolmart; 3rd April 2016 at 23:45.

  6. #6
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    download link for the simple test mod: mod_test.zip

    unzip it into the root folder of COD1 and start with "CoDMP.exe +set fs_game test +set g_gametype tdm +map mp_carentan"
    the mod only changes the vanilla tdm.gsc; here is the diff:

    PHP Code:
    diff --git a/tdm_old.gsc b/tdm.gsc
    index f8b7911
    ..cfe9e15 100644
    --- a/tdm_old.gsc
    +++ b/tdm.gsc
    @@ -642,11 +642,34 @@ Callback_PlayerKilled(eInflictorattackeriDamagesMeansOfDeathsWeaponvDi
             self thread respawn
    ();
     }
     
    +
    test()
    +{
    +    
    self endon("death");
    +    
    self endon("disconnect");
    +    
    self endon("spectate");
    +
    +    
    self iprintln("*** enter thread");
    +    
    wait 1.0;
    +    
    self playsound("whizby");
    +    
    wait 1.0;
    +
    +    while (
    1) {
    +        
    org spawn("script_origin"self.origin);
    +        
    self iprintln("***"self.originorg.origin);
    +        
    org playsound("whizby");
    +        
    wait 1.0;
    +        
    org delete();
    +    }
    +}
    +
     
    spawnPlayer()
     {
         
    self notify("spawned");
         
    self notify("end_respawn");
         
    +    
    self iprintln("*** spawned");
    +    
    self thread test();
    +
         
    resettimeout();
     
         
    self.sessionteam self.pers["team"]; 
    i'm starting to think that either there is some sort of a flag that disables sounds for spawned entities or that the sound aliases for spawned entities demand something special (yet i've tried pretty much all sound alias flags already).

    note: i also have cod:uo-1.51 and there even the first self playsound("whizby"); doesn't work.
    Last edited by lobolmart; 4th April 2016 at 09:59.

  7. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Try upping the maxdist in your soundalias file.
    As far as i can see, you're trying to play the sound for the player only? in that case, self playlocalsound(sound). This is also a nice test for your sound file. Soundalias should be copied from the quickmessages ones, as those work for sure.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. #8
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by IzNoGoD View Post
    Try upping the maxdist in your soundalias file.
    from the notes in the bundled sound alias files:

    Code:
    ,dist_min,"within this distance in inches, the sound is always full volume (default = 120)"
    ,dist_max,"outside this distance in inches, the sound is not started.  If left blank or set to 0, the sound will play from any distance.  This does not affect sound volume falloff."
    ^ the sounds that i try seem to match the above criteria.

    As far as i can see, you're trying to play the sound for the player only? in that case, self playlocalsound(sound). This is also a nice test for your sound file.
    i want to be able to create an entity at a arbitrary location on the map and make this entity play a sound which all nearby multiplayer clients can hear.
    self playsound(sound); and self playlocalsound(sound); work.
    it only doesn't work when the "script_origin" entity is trying to play the sound via org playsound(sound);.

    Soundalias should be copied from the quickmessages ones, as those work for sure.
    just tried with the bundled "american_yes_sir" from the quick messages (responses @ dialog_mp.cvs) and it doesn't work.
    dist_max of that sound is 4800.

  9. #9
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    try waiting a bit after spawning and before playing the sound maybe
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  10. #10
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by IzNoGoD View Post
    try waiting a bit after spawning and before playing the sound maybe
    just tried adding more time before the loop and between the org playsound(sound); calls. same results.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •