Advertisement
skroton

New tsp flavor pickup code

May 30th, 2016
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.33 KB | None | 0 0
  1. /* string array for holding names of flavor pickup sounds; [class][gender][sound] */
  2. str flav_pickup_s[2][2][7] = { { /* [0][0][#} */ { "melflavpickup/Pistol",     "melflavpickup/ZekeShotgun",     "melflavpickup/Crossbow",     "melflavpickup/Ammobox50",     "melflavpickup/RocketNailgunLauncher",     "NULL", "melflavpickup/RocketLauncher1"     },
  3.                                  /* [0][1][#} */ { "melflavpickuprobo/Pistol", "melflavpickuprobo/ZekeShotgun", "melflavpickuprobo/Crossbow", "melflavpickuprobo/Ammobox50", "melflavpickuprobo/RocketNailgunLauncher", "NULL", "melflavpickuprobo/RocketLauncher1" } },
  4.                                { /* [1][0][#} */ { "vexflavpickup/Pistol",     "vexflavpickup/ZekeShotgun",     "vexflavpickup/Crossbow",     "vexflavpickup/Ammobox50",     "vexflavpickup/RocketNailgunLauncher",     "NULL", "vexflavpickup/RocketLauncher1"     },
  5.                                  /* [1][1][#} */ { "vexflavpickuprobo/Pistol", "vexflavpickuprobo/ZekeShotgun", "vexflavpickuprobo/Crossbow", "vexflavpickuprobo/Ammobox50", "vexflavpickuprobo/RocketNailgunLauncher", "NULL", "vexflavpickuprobo/RocketLauncher1" } } };
  6.  
  7. /* if you make the pickup sound names smaller I can organize this like a regular 3d array instead of sqeezing them in like this */
  8.  
  9. /* array for holding delays for flavor pickup sounds; [class][gender][sound] */
  10. int flav_pickup_i[2][2][7] = { { /* [0][0][#} */ { 41, 49, 35, 123, 67, 0, 67 },
  11.                                  /* [0][1][#} */ { 46, 60, 53, 144, 69, 0, 69 }, },
  12.                                { /* [1][0][#} */ { 41, 49, 35, 123, 67, 0, 67 },
  13.                                  /* [1][1][#} */ { 46, 60, 53, 144, 69, 0, 69 } } };
  14.  
  15. /* scrip to play flavor pickup sounds */
  16. script "TSPPickupSounds" (int which) /* which weapon the sound is being played for */
  17. {
  18.   int gender, class; /* gender group of player, class of player */
  19.  
  20.   if(CheckInventory("PlayingPickupSound") > 0){ terminate; } /* if another pickup sound is playing, terminate */
  21.  
  22.   GiveInventory("PlayingPickupSound", 1); /* give dummy item that tells other scripts that pickup sound is currently playing */
  23.  
  24.   if(CheckActorClass(0,"Vexler")){ class = 1; } /* check actor class, if vexler set to corresponding array value */
  25.   /* note that we don't check for mel's class, this is because class is initialized at 0 and mel value is 0 */
  26.   /* we would need to check if there were more than these two classes, however */
  27.   /* and if there were enough, we might even put class names into an array and loop through those to find the class */
  28.  
  29.   if(GetPlayerInfo(PlayerNumber(),PLAYERINFO_GENDER) == 2){ /* if the player has their gender set to OTHER */
  30.     gender = 1; } /* set the gender group to the corresponding array value */
  31.    
  32.   /* now using the above, play the sound */
  33.   LocalAmbientSound(flav_pickup_s[class][gender][which],127);
  34.  
  35.   /* and now delay for number of tics corresponding to sound */
  36.   Delay(flav_pickup_i[class][gender][which]);
  37.  
  38.   /* and now take from player all possible copies of the dummy item that tells scripts that pickup sound is currently playing */
  39.   TakeInventory("PlayingPickupSound", MAX_SIGNED_LONG);
  40. }
  41.  
  42. script "TSPHUDHealthNumberColor" ENTER
  43. {
  44.   if(GetActorProperty( 0, APROP_Health) >= 101){ GiveInventory("Over100Health",1); }
  45.   else{ TakeInventory("Over100Health",1); }
  46.   Delay(6);
  47.   Restart;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement