Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

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

  1. #21
    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
    Sounds retarded, but this remembers me on an old bug which I had. I figured a script_origin first started to work after settings the angles.

    Try:

    PHP Code:
    org spawn("script_origin"origin);
    org.angles = (0,0,0); // add this
    org playsound("whizby"); // <----------- no working 
    I used it back then for this: https://github.com/kungfooman/cod2_s...utils.gsc#L131
    timescale 0.01

  2. #22
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by kung foo man View Post
    Sounds retarded, but this remembers me on an old bug which I had. I figured a script_origin first started to work after settings the angles.

    Try:

    PHP Code:
    org spawn("script_origin"origin);
    org.angles = (0,0,0); // add this
    org playsound("whizby"); // <----------- no working 
    I used it back then for this: https://github.com/kungfooman/cod2_s...utils.gsc#L131
    i saw the use of .angles for "script_origin" somewhere when googling for this issue and i have tried it already.
    also changing the sound to "bomb_tick" or the "american_yes_sir" instead of "whizby", while testing angles doesn't work.

    maybe a script entity only plays sounds if it's linked to a client entity. will try again later.

  3. #23
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by lobolmart View Post
    maybe a script entity only plays sounds if it's linked to a client entity. will try again later.
    nope, this doesn't help either:
    org linkto(self, "tag_helmet", (0, 0, 0), (0, 0, 0));

  4. #24
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    why not just playsound on the client? You're playing the sound on his origin anyway...
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  5. #25
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    Quote Originally Posted by IzNoGoD View Post
    why not just playsound on the client? You're playing the sound on his origin anyway...
    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.
    i.e. like the bomb in S&D.

    i can hack a way to play the sound on all nearby clients, but it's going to be always at full volume and this is an ugly hack as it doesn't make much sense in the context of 3d space.

  6. #26
    Private
    Join Date
    Mar 2016
    Posts
    18
    Thanks
    0
    Thanked 2 Times in 1 Post
    while messing about with the mg42's included in mp_carentan i was able to play a sound through them and then after more trial and error i was able to spawn() a script_model that plays a sound.
    will report back, to complete this thread.

    EDIT:
    alright, so after days of testing my conclusion is that i can't get "script_origin" to play a sound in COD1-1.4 - i.e. this doesn't work:

    PHP Code:
    org spawn("script_origin"somePosition);
    wait someTime1;
    org playSound(someSound); // even if the playSound() is in a separate thread long time after the spawn()...
    wait someTime2;
    ... 
    i've tried everything including different sounds, sounds aliases, wait timings, setting explicit .angles, .origin and so on.
    maybe there is a way, but who knows.

    "script_model" on the other hand does work as expected and there is no need to setModel(), set .angles, etc. something in the lines of this in your spawnPlayer() in tdm.gsc should do it:
    PHP Code:
    org spawn("script_model"somePosition);
    wait someTime1;
    org playSound(someSound); // make sure that someTime1 is enough!
    wait someTime2
    the downside of course, is that "script_model" is a heavier struct than "script_origin".

    i still can't figure out exactly why it didn't work in my while() loop, but i think it has to do with timings and concurrency. if i maintain a single "script_model" per spawned player and only update the origin of said model on demand, it can playSound() every time at a specific location, which is pretty much what i was looking for.

    thanks for the replies and suggestions.
    Last edited by lobolmart; 5th April 2016 at 14:41.

  7. The Following 2 Users Say Thank You to lobolmart For This Useful Post:

    kung foo man (6th April 2016),Ni3ls (6th April 2016)

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
  •