+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: E2 sound problem

  1. #1
    Wire Noob Hunter Normandy's Avatar
    Join Date
    Aug 2009
    Location
    America
    Posts
    4

    Default E2 sound problem

    hello everyone, i have been having trouble trying to get my e2 to work.
    it makes it so when i die(or my health is zero^_^) it plays the left 4 dead death song

    i have tried several different ways to make this work..but so far nothing

    e2 v1:
    @name l4d sounds
    @inputs
    @outputs
    @persist
    @trigger

    if (owner():health() == 0) {
    owner():soundPlay(0,0,"leftfordeath.wav") soundVolume(1,300)
    }

    e2 v2:
    @name
    @inputs
    @outputs
    @persist
    @trigger

    O = owner()
    HP = owner():health()

    if (HP == 0)
    {
    O:soundPlay(1,0,"leftfordeath.wav") soundVolume(1,300)
    }

    and last but not least e2 v3:
    @name
    @inputs
    @outputs
    @persist
    @trigger

    O = owner()


    if (O:isAlive() == 0) {
    O:soundPlay(1,0,"leftfordeath.wav") soundVolume(1,300)
    }



    if anyone knows the solution to my problem that would be great!
    Last edited by Hunter Normandy; 12-10-2009 at 05:53 PM.

  2. #2
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,651

    Default Re: E2 sound problem

    Well 1) I suggest putting your code in code tags.
    2) You can't just type the name of the song in, you have to put the song in your garrysmod/garrysmod/sound folder, and then type in the filepath from there. Example: You have a song named "song". It is an mp3. You would put it in garrysmod/garrysmod/sound, then in the expression you would put in, as the filepath, "song.mp3".

    Sound volume 100 is the max, and it defaults to that so no need to set it.
    You may want to change if(HP==0) to if(HP<=0)

    Oh and also, it needs something triggering it. Put an interval(10) in there.
    Last edited by mattwd0526; 12-10-2009 at 05:51 PM.

  3. #3
    Wire Noob Hunter Normandy's Avatar
    Join Date
    Aug 2009
    Location
    America
    Posts
    4

    Default Re: E2 sound problem

    i know ...the sound is called left for death, and it is a .wav and it is also in the garrysmod/garrysmod/sound folder

  4. #4
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,651

    Default Re: E2 sound problem

    Ok, I suggest you put interval(10) in there, otherwise it won't run.

  5. #5
    Wire Sofaking Ehmmett's Avatar
    Join Date
    Sep 2009
    Posts
    595

    Default Re: E2 sound problem

    but then with the interval, it's going to be playing the song at an interval.
    So it'll just make a skipping sound.

  6. #6
    Wire Sofaking N00bDud3's Avatar
    Join Date
    Jul 2009
    Location
    Error: Unknown Location
    Posts
    1,252

    Default Re: E2 sound problem

    First, I believe that the max volume is 1, not 100.
    Second, that code should pretty much work, though for HP I would use < 1
    and for the alive just do
    Code:
    @persist O:entity Alive
    if(first()){O = owner()}
    Alive = O:isAlive()
    if(changed(Alive) & ! Alive){ sound code here }



  7. #7
    has a custom title mattwd0526's Avatar
    Join Date
    Apr 2009
    Location
    Born Bostonian
    Posts
    2,651

    Default Re: E2 sound problem

    Quote Originally Posted by fireeater67 View Post
    First, I believe that the max volume is 1, not 100.
    Second, that code should pretty much work, though for HP I would use < 1
    and for the alive just do
    Code:
    @persist O:entity Alive
    if(first()){O = owner()}
    Alive = O:isAlive()
    if(changed(Alive) & ! Alive){ sound code here }
    But it still won't trigger, the expression won't be running so it won't check changes in alive-ness.

  8. #8
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: E2 sound problem

    Quote Originally Posted by fireeater67 View Post
    First, I believe that the max volume is 1, not 100.
    Second, that code should pretty much work, though for HP I would use < 1
    and for the alive just do
    Code:
    @persist O:entity Alive
    if(first()){O = owner()}
    Alive = O:isAlive()
    if(changed(Alive) & ! Alive){ sound code here }
    That's correct. However, I don't see the point of having "O" in there as you are only using owner once. You also forgot interval.

    Fix:
    Code:
    interval(10)
    Alive = owner():isAlive()
    if (changed(Alive) & !Alive) {
        owner():soundPlay(1,0,"leftfordeath.wav")
    }
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  9. #9
    Wire Noob Hunter Normandy's Avatar
    Join Date
    Aug 2009
    Location
    America
    Posts
    4

    Default Re: E2 sound problem

    Quote Originally Posted by Divran View Post
    That's correct. However, I don't see the point of having "O" in there as you are only using owner once. You also forgot interval.

    Fix:
    Code:
    interval(10)
    Alive = owner():isAlive()
    if (changed(Alive) & !Alive) {
        owner():soundPlay(1,0,"leftfordeath.wav")
    }
    It works! thanks Divran because when i use the code you put as fixed ... not only did it play the music when i died ...but it was good volume no matter where i was even if i was far away from the e2 chip. Thanks everyone for you help you all deserve cookies! but does anyone know how to make it so that when i re-spawn or (arent dead anymore) that it stops the music....because if i respawn it is still playing the music?
    Last edited by Hunter Normandy; 12-11-2009 at 01:55 PM.

    Im one of those people were God looks down and says "I didn't make that!"

  10. #10
    Wire Noob Hunter Normandy's Avatar
    Join Date
    Aug 2009
    Location
    America
    Posts
    4

    Default Re: E2 sound problem

    There is one other thing...
    i would like to use this sound code again but for a different purpose.
    does anyone know how to make it play a certain song/music when the owners health is under a certain point? Like if the owners health is under 15 play this sound but then stop when it becomes 0.

    Also, you know how your screen goes a slight red when you die... does anyone know how to make the screen turn a color negative white,like when you become in the "white zone" or about to die in left 4 dead?

    Im one of those people were God looks down and says "I didn't make that!"

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Index /sound problem
    By SGT_KILL in forum Expression 2 Discussion & Help
    Replies: 7
    Last Post: 10-11-2009, 12:15 AM
  2. Adding sound files to sound emitter
    By Dragonheart in forum Installation and Malfunctions Support
    Replies: 2
    Last Post: 07-04-2009, 10:33 PM
  3. Sound Emitter Sound level.
    By ICDWILL117 in forum Installation and Malfunctions Support
    Replies: 5
    Last Post: 11-18-2008, 05:06 PM
  4. advanced sound emitter emits only 1 sound
    By rickumans in forum Installation and Malfunctions Support
    Replies: 0
    Last Post: 02-27-2008, 06:41 AM
  5. Is It Possible To End A Looping Sound From The Sound Emitter?
    By hizzeh in forum Installation and Malfunctions Support
    Replies: 0
    Last Post: 05-06-2007, 09:13 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots