Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → more shotgun probs
more shotgun probs
2003-07-25, 11:37 AM #1
K, Well I made the shotgun fine, and I started the supershotgun, it works great, but with one problem..When it fires it makes a sound like I'm under water 8 times over. Heres the cog

Code:
symbols

model       povModel=BowV.3do                   local
model       weaponMesh=BowG.3do                 local

keyframe    mountAnim=BowVmnt.key               local
keyframe    dismountAnim=BowVdis.key            local
keyframe    povfireAnim=BowVpst1.key            local
keyframe    holsterAnim=kyhlstr.key             local

sound       mountSound=df_bry_ready.wav         local
sound       dismountSound=PutWeaponAway01.wav   local

sound       chargeSound=BCChargeUp.wav          local
sound       fireSound1=BCFire01.wav             local
sound       fireSound2=BCFire02.wav             local
sound       outSound=trprout.wav                local

template    projectile=+crossbowbolt            local
template    projectile2=+crossbowbolt2          local
template    projectile3=+crossbowbolt3          local

flex        fireWait=0.6                        local
flex        delayTime                           local
flex        error                               local
flex        autoAimFOV=30                       local
flex        autoAimMaxDist=10                   local
flex        powerBoost                          local
flex        holsterWait                         local

vector      fireOffset                          local
vector      adjOffset                           local
vector      shakePos                            local
vector      shakeAngle                          local

thing       player                              local

int         trackID=-1                          local
int         channel=-1                          local
int         holsterTrack                        local

message     startup
message     activated
message     deactivated
message     selected
message     deselected
message     newplayer
message     autoselect
message     fire
message     killed
message     timer

end

# ========================================================================================

code

startup:
   player = GetLocalPlayerThing();

   Return;

# ........................................................................................

activated:
   mode = GetSenderRef();

   jkSetWaggle(player, '0.0 0.0 0.0', 0);

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
      if((GetAutoSwitch() & 1))
         SelectWeapon(player, AutoSelectWeapon(player, 1));
      else
         PlaySoundThing(outSound, player, 1.0, -1, -1, 0x80);

      Return;
   }

   if(mode == 0)
   {
      ActivateWeapon(player, 0, mode);

      if(channel == -1)
      {
         channel = PlaySoundThing(chargeSound, player, 0.0, -1, -1, 0x181);

         if(channel != -1)
         {
            ChangeSoundPitch(channel, 0.3, 0.01);
            Sleep(0.03);

            // looks stupid... but if the user taps quickly deactivated:
            // gets called during the sleep, and channel becomes invalid !
            if(channel != -1)
            {
               ChangeSoundVol(channel, 1.0, 0.6);
               ChangeSoundPitch(channel, 1.0, 1.2);
            }
         }
      }
   }
   else
   {
      powerBoost = GetInv(player, 63);
      ActivateWeapon( player, fireWait/powerBoost, mode);
   }

   Return;

# ........................................................................................

fire:
   // Check that the player is still alive.
   if(GetThingHealth(player) <= 0) Return;

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
      SelectWeapon(player, AutoSelectWeapon(player, 1));
      Return;
   }
  
   
   SetPOVShake('0.0 -.01 0.0', '2.0 0.0 0.0', .05, 80.0);
   dummy = FireProjectile(player, projectile3, fireSound, 8, fireOffset, '3.5 3.0 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '3.0 3.4 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '2.0 2.5. 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '2.5 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '1.8 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '-1.0 3.4 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '-1.5.0 2.5. 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '-0.5.5 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile3, -1, 8, fireOffset, '-0.0 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
   ChangeInv(player, 12, -2.0);
   jkPlayPOVKey(player, povfireAnim, 1, 0x38);

   
   powerBoost = GetInv(player, 63);
   ChangeFireRate(player, fireWait/powerBoost);

   Return;


# ........................................................................................

deactivated:
   mode = GetSenderRef();

   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   if(mode == 0)
   {
      delayTime = DeactivateWeapon(player, mode);

      if(channel != -1)
      {
         StopSound(channel, 0);
         channel = -1;
      }

      // Set a delay, even if we don't fire here.
      SetMountWait(player, fireWait/powerBoost);

      // Make sure both keys are up before continuing.
      if (GetCurWeaponMode() != -1) Return;

      // make sure we still have ammo
      if(GetInv(player, 12) < 2.0) Return;

      // Always fire one projectile straight-ahead
      SetPOVShake('0.0 -.01 0.0', '2.0 0.0 0.0', .05, 80.0);
      FireProjectile(player, projectile, fireSound2, 18, '0.0207 0.0888 0.00', '0 0 0', 0, 0, autoAimFOV, autoAimFOV*2);

      ChangeInv(player, 12, -2.0);

      if(delayTime > 0.0)
      {
         if(GetInv(player, 12) > 0.0)
         {
            dummy = FireProjectile(player, projectile, fireSound, 8, fireOffset, '3.5 3.0 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '3.0 3.4 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '2.0 2.5. 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '2.5 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '1.8 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-1.0 3.4 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-1.5 2.5. 0', 2.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-0.5 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-0.0 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
         }
      }

      if(delayTime > 1.2)
      {
         if(GetInv(player, 12) > 0.0)
         {
            dummy = FireProjectile(player, projectile, fireSound, 8, fireOffset, '3.5 3.0 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '3.0 3.4 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '2.0 2.5. 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '2.5 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '1.8 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-1.0 3.4 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-1.5 2.5. 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-0.5 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
      dummy = FireProjectile(player, projectile, -1, 8, fireOffset, '-0.0 3.1 0', 1.0, 0, autoAimFOV, autoAimMaxDist );
         }
      }

      // Play animation and set delay.
      jkPlayPOVKey(player, povfireAnim, 1, 0x38);
      powerBoost = GetInv(player, 63);
   }
   else
   {
      DeactivateWeapon(player, mode);
   }

   Return;

# ........................................................................................

selected:
   // Play external animation
   PlayMode(player, 41);

   // Set up meshes and models.
   jkSetPOVModel(player, povModel);
   SetArmedMode(player, 1);
   jkSetWeaponMesh(player, weaponMesh);
   jkSetWaggle(player, '10.0 7.0 0.0', 350);

   // Play sound and animation.
   PlaySoundThing(mountSound, player, 1.0, -1, -1, 0x80);
   trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
   SetMountWait(player, GetKeyLen(mountAnim));

   // Set flags, etc.
   jkClearFlags(player, 0x5);
   SetCurWeapon(player, 5);

   // Check Ammo - If we are out, autoselect best weapon.
   if(GetInv(player, 12) < 2.0)
   {
      if((GetAutoSwitch() & 1))
         SelectWeapon(player, AutoSelectWeapon(player, 1));
   }

   Return;

# ........................................................................................

deselected:
   PlaySoundThing(dismountSound, player, 1.0, -1, -1, 0x80);
   jkPlayPOVKey(player, dismountAnim, 0, 18);


[edit] fixed the code tags. [http://forums.massassi.net/html/wink.gif]

Can anyone help? Nothing turns up on syntax checking

------------------
Ping (peeng) n. The number of milliseconds it takes between the time my conc bullet has blown you to hell and the time you realize it.

[This message has been edited by SaberMaster (edited July 25, 2003).]
2003-07-26, 7:07 PM #2
hmm well you have 8 projectiles so i would assume that is has something to do with that. are you sure that the splash noise isn't the crossbow fire noise? i would check the soundclass in your template

------------------
roses are red, violets are blue, I am schizophrenic, and I am too!
roses are red, violets are blue, I am schizophrenic, and I am too!

↑ Up to the top!