need a hand


(x0flatline0x) #1

Hi, I am wondering how I would be able to accomplish passing sounds from game to client. I have something in g_combat.c that i would like to play a sound to the client only, not a global sound. How would i go about doing that ?

Please go easy on me i am a newbie at this :slight_smile:


(=>ETK<=Elite) #2

I am pretty new to this as well, so hopefully I am not off by much on this one. I think you just use scripts for playing sounds though, and place them inside a .pak file. I know from when I was working on maps, there was just a single command to play a .wav file, can’t remember it at the moment, but it was a fairly self explanatoy command. I would probably just open up a mappscript, or some type of script that does play a sound and see how they do it. Do a search for ‘playsound’ and variations of that.


(kamikazee) #3

Playsound still generates a global sound, and I guess he doesn’t want to work with map-specific scripts.

To play a specific sound file, you would rather need to send a client command. Problem is that I don’t know if there is a command you are looking for in plain W:ET.


(nUllSkillZ) #4

I guess the promotion sounds (ranks) are clientside.
And also the hitsounds (you could have a look for these in the et-pub source).


(x0flatline0x) #5

right how would i get cgs.media to be playable from qagame to cgame ?

i have hitsounds but they are client only, i just need to find out how to get sounds from the game to the client, (( i will look at the ranking thing a little more to see if i overlooked a possible solution there))

thnx guys.


(Jaquboss) #6

erm…
It is old code already … Q3 Way … you have stored number of hits in ps->persistant ( PERS_HITS ), every damage increases it and team damage decreases it
very simple way is just to check for change of this value, there is already code to track playerstate changes, guess it is cg_playerstate.c, you should find it


(x0flatline0x) #7

here this might help a little more with what it is i really want to accomplish, i have some code i found here that would post doublekills etc, it was set to just show the text and i wanted to make it to add sound to each one, here is the altered code for it, it is set to play global sounds but maybe not all want to hear them so i want to make it play to the person who got it only, if that is possible.

/*
==================
doublekills, multikills, monsterkills, etc
==================
*/
static void G_DoubleKill(gentity_t *ent) {
   char   *message;

   if(!ent || !ent->client) {
      return;
   }
   if(!g_doublekill.integer) {
      return;
   }
   message = "";
   if((level.time - ent->client->lastKillTime) > 1000) {
      ent->client->doublekill = 0;
      ent->client->lastKillTime = level.time;
      return;
   } else {
      ent->client->doublekill++;
      ent->client->lastKillTime = level.time;
   }
   switch(ent->client->doublekill) {
   case 1:
      message = "^z>>^?DOUBLE^z-^?KILL^z<<";
           G_globalSound("sound/misc/doublekill.wav");
      break;
   case 2:
      message = "^z>>^?MULTI^z-^?KILL^z<<";
           G_globalSound("sound/misc/multikill.wav");
      break;
   case 3:
      message = "^z>>^?MONSTER^z-^?KILL^z<<";
           G_globalSound("sound/misc/monsterkill.wav");
      break;
   case 4:
      message = "^z>>^?ULTRA^z-^?KILL^z<<";
           G_globalSound("sound/misc/ultrakill.wav");
      break;
   case 5:
      message = "^z>>^?LUDICROUS^z-^?KILL^z<<";
           G_globalSound("sound/misc/ludicrouskill.wav");
      break;
   }
	if( ent->client->doublekill >= 1 && 
		ent->client->doublekill <= 5 ) {
         CP(va("cp \"^1%s\"", message ));
   }
}

thnx shadow commander for the original code:
http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=13612

is there a way i can do it ??