Results 1 to 4 of 4

Thread: add Sound Headshot

  1. #1
    Private EnergY's Avatar
    Join Date
    Jul 2012
    Posts
    34
    Thanks
    32
    Thanked 2 Times in 2 Posts

    add Sound Headshot

    Hi all,

    I use script/picture/sound by ER for test and he don't work in game :/ help me pls ^^

    PHP Code:
    if(sMeansOfDeath == "MOD_HEAD_SHOT")
                    {
                        
    attacker.premier_exp+=10;
                        
    attacker.head+=1;
                        
    attacker.plusscore+=20;
                        
    attacker.scoretoshow=20;
                        
    self thread cod4\check::checkHead();        
                    } 
    PHP Code:
    checkHead()
    {
            
    thread precache();
        
        if(
    isDefined(self.hud_head))self.hud_head destroy();
        
    self.hud_head newClientHudElem(self);
        
    self.hud_head.280;
        
    self.hud_head.390;
        
    self.hud_head.alpha 0.50;

        
            
    self PlayLocalSound("headshot");
            
    self.hud_head setShader("x2_headshot"100100);
            
        
        
    }

    precache()
    {    

    precacheShader("x2_headshot");


    Xfire: romain88120 and energyfun !!

  2. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by EnergY View Post
    Hi all,

    I use script/picture/sound by ER for test and he don't work in game :/ help me pls ^^

    PHP Code:
    if(sMeansOfDeath == "MOD_HEAD_SHOT")
                    {
                        
    attacker.premier_exp+=10;
                        
    attacker.head+=1;
                        
    attacker.plusscore+=20;
                        
    attacker.scoretoshow=20;
                        
    self thread cod4\check::checkHead();        
                    } 
    PHP Code:
    checkHead()
    {
            
    thread precache();
        
        if(
    isDefined(self.hud_head))self.hud_head destroy();
        
    self.hud_head newClientHudElem(self);
        
    self.hud_head.280;
        
    self.hud_head.390;
        
    self.hud_head.alpha 0.50;

        
            
    self PlayLocalSound("headshot");
            
    self.hud_head setShader("x2_headshot"100100);
            
        
        
    }

    precache()
    {    

    precacheShader("x2_headshot");


    You can't do a precache of assets after the gametype has started. So, that is probably the problem for the shader/image not showing. You need to move the precache function to callback_startgametype().

    As for the sound, do you have a soundalias file for it? If so, please post it.

    Also, where is this function ( checkHead() ) being called from? It should be in callback_playerkilled(). If it isn't in there, then that might explain why there is no sound.

  3. The Following User Says Thank You to Tally For This Useful Post:

    EnergY (13th August 2013)

  4. #3
    Private EnergY's Avatar
    Join Date
    Jul 2012
    Posts
    34
    Thanks
    32
    Thanked 2 Times in 2 Posts
    here is soudaliase

    PHP Code:
    ,,"If the first column for a row is blank, then the row is ignored",,,
    ,
    "If the first column for a row is blank, then the row is ignored",,,,
    # The first non-comment line of a sound alias file specifies the key name for all values appearing in this column.,,,,,"# If the text in the first column of a row starts with a # character, the row is ignored"
    "# This means it is safe to swap entire columns around, though you should never swap partial columns.",,,,,
    "# You can invent new keys, but the game will ignore them if it doesn't know about them.",,,,,
    "# You can leave out keys, but the ""name"" and ""file"" keys must always be present.",,,,,

    ,
    name,name of the alias that is used to play this sound (required),,,
    ,
    sequence,"used to uniquely identify alias entries when more than one sound goes to an alias, used only to catch unwanted duplicates (default = 0)",,,
    ,
    file,the name of the file that contains the sound data (required),,,
    ,
    vol_min,"0 is silent, 1 is full volume (default = 1)",,,
    ,
    vol_max,"0 is silent, 1 is full volume (default = same as vol_min)",,,
    ,
    vol_mod,"blank causes no effect on vol_min and vol_max, otherwise the string must match a string in the volumemodgroups.def file and the value in that file corresponding to that string will be used to adjust vol_min and vol_max, clamped to the valid range",,,
    ,
    pitch_min,"1 is normal playback, 2 is twice as fast, 0.5 is half as fast (default = 1)",,,
    ,
    pitch_max,"1 is normal playback, 2 is twice as fast, 0.5 is half as fast (default = same as pitch_min)",,,
    ,
    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.",,,,,,,,,,,,,,,,,,,,,
    ,
    channel,"auto, menu, weapon, voice, item, body, local, music, announcer (default = auto)",,,,,,,,,,,,,,,,,,,,,
    ,
    type,primed (a streamed sound which gets primed on some platforms) / streamed loaded (default = loaded),,,,,,,,,,,,,,,,,,,,,
    ,
    probability,weight to use for the weighted probability of playing this sound instead of another sound (default = 1),,,,,,,,,,,,,,,,,,,,,
    ,
    loop,"whether this sound is ""looping"" or ""nonlooping"" (default = ""nonlooping"")",,,,,,,,,,,,,,,,,,,,,
    ,
    masterslave,"if ""master"", this is a master sound.  If a number, then this sound's volume will be multiplied by that number (a percentage between 0 and 1) any master sound is playing.  If blank, then neither master nor slave.",,,,,,,,,,,,,,,,,,,,,
    ,
    loadspec,"space-separated list of which maps should use this alias; eg, ""burnville dawnville"".  If blank, the alias is used on all maps.",,,,,,,,,,,,,,,,,,,,,
    ,
    compression,"a string corresponding to an entry in ""XMAUpdate.tbl"" which is used to determine compression by XMAUpdate.exe",,,,,,,,,,,,,,,,,,,,,
    ,
    secondaryaliasname,"defined the name of an additional sound alias to play in addition to the current alias being played. Note that it is an error for the secondaryalias to also define a secondaryaliasname (eg, if B is a secondaryalias of A, B is not allowed to have its own secondaryalias).",,,,,,,,,,,,,,,,,,,,,
    ,
    volumefalloffcurve,if blank uses the linear curve which can not be changedA string 'XXXX' corresponds to the curve defined by the file 'soundaliases/XXXX.vfcurve',,,,,,,,,,,,,,,,,,,,,
    ,
    startdelay,defaults to no delayThe value is the number of milliseconds to delay starting the sound by,,,,,,,,,,,,,,,,,,,,,
    ,
    speakermap,if blank uses the default speakermappings which cannot be changedA string 'XXXX' corresponds to the speakermap defined by the file 'soundaliases/XXXX.spkrmap'. ,,,,,,,,,,,,,,,,,,,,,
    ,
    reverb,"blank means the alias is affected normally by wet and dry levels, ""fulldrylevel"" forces the alias to use a full drylevel (ignoring the global drylevel), ""nowetlevel"" forces the alias to use no wetlevel (ignoring the global wetlevel)",,,,,,,,,,,,,,,,,,,,,
    ,
    lfe percentage,this determines what percentage of the highest calculated spatialized speaker volume should be passed to the LFEblank means no LFE for the sound,,,,,,,,,,,,,,,,,,,,,

    name,sequence,file,vol_min,vol_max,vol_mod,pitch_min,pitch_max,dist_min,dist_max,channel,type,probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,volumefalloffcurve,startdelay,speakermap,reverb,lfe percentage


    # test!!! name,,misc/name.wav,1,,,,,,,announcer,streamed,,,,,,,,,,

    headshot,,ER_zombie/headshot.mp3,1,1,,,,1000000,,auto,streamed


    # auto, menu, weapon, voice, item, body, local, music, announcer 

    Now i changed but he don't work again :/

    PHP Code:
    Callback_PlayerKilled(eInflictorattackeriDamagesMeansOfDeathsWeaponvDirsHitLocpsOffsetTimedeathAnimDuration)
    {
        
    guid self getGuid();
        
        
    self endon("spawned");
        
    self notify("killed_player");

    ///////////////////////////////////////////////////        
        
    if(isDefined(self.hud_head))self.hud_head destroy();
        
    self.hud_head newClientHudElem(self);
        
    self.hud_head.280;
        
    self.hud_head.390;
        
    self.hud_head.alpha 0.50;

        
            
    //////////////////////////////////////////////////////////// 
    PHP Code:
    if(sMeansOfDeath == "MOD_HEAD_SHOT")
                    {
                        
    attacker.premier_exp+=10;
                        
    attacker.head+=1;
                        
    attacker.plusscore+=20;
                        
    attacker.scoretoshow=20;
                        
    self PlayLocalSound("headshot");
                        
    self.hud_head setShader("x2_headshot"100100);        
                    } 
    Last edited by EnergY; 13th August 2013 at 11:08.
    Xfire: romain88120 and energyfun !!

  5. #4
    Private EnergY's Avatar
    Join Date
    Jul 2012
    Posts
    34
    Thanks
    32
    Thanked 2 Times in 2 Posts
    Help me please ^^
    Xfire: romain88120 and energyfun !!

Posting Permissions

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