Sound clip when Picking up a gun

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
rummy00
Posts: 68
Joined: Tue Sep 03, 2013 5:05 pm

Sound clip when Picking up a gun

Post by rummy00 »

I am trying to have a soundclip play when I pickup a certain gun. For this example, I want to say my soundclip is named PickupSuperShotty

and I want the super shotty (the double barrel) gun to have the sound clip.

How can I do that?
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Sound clip when Picking up a gun

Post by Blue Shadow »

[wiki=Actor_properties#Inventory.PickupSound]Inventory.PickupSound[/wiki]
rummy00
Posts: 68
Joined: Tue Sep 03, 2013 5:05 pm

Re: Sound clip when Picking up a gun

Post by rummy00 »

Blue Shadow wrote:[wiki=Actor_properties#Inventory.PickupSound]Inventory.PickupSound[/wiki]
Thanks, were in the code would I put that?
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Sound clip when Picking up a gun

Post by Blue Shadow »

It is an actor property like health, mass, speed, etc..., so it goes in an actor's definition:

Code: Select all

ACTOR MyGun : Weapon
{
  // Properties and flags

  Inventory.PickupSound "coolsound"

  // Other properties and flags

  States
  {
    // States are here
  }
}
rummy00
Posts: 68
Joined: Tue Sep 03, 2013 5:05 pm

Re: Sound clip when Picking up a gun

Post by rummy00 »

Blue Shadow wrote:It is an actor property like health, mass, speed, etc..., so it goes in an actor's definition:

Code: Select all

ACTOR MyGun : Weapon
{
  // Properties and flags

  Inventory.PickupSound "coolsound"

  // Other properties and flags

  States
  {
    // States are here
  }
}
so would this be were i'd insert it?

Code: Select all

ACTOR NewMarine : Doomplayer
{
  Inventory.PickupSound "coolsound"
    Player.StartItem "clip", 13
    Player.StartItem "colt45"
    Player.StartItem "Fist"
}
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Sound clip when Picking up a gun

Post by Blue Shadow »

Yes, in an actor's definition and outside of the States block. But since you want the sound to play when picking up the weapon, you should put it in the weapon's code, not the player's.
rummy00
Posts: 68
Joined: Tue Sep 03, 2013 5:05 pm

Re: Sound clip when Picking up a gun

Post by rummy00 »

Blue Shadow wrote:Yes, in an actor's definition and outside of the States block. But since you want the sound to play when picking up the weapon, you should put it in the weapon's code, not the player's.
okay, so.. here is a code for a custom weapon, where would i insert it?

Code: Select all

actor Colt45 : Weapon 5757
{
  Weapon.SelectionOrder 1900
  Weapon.AmmoUse 1
  Weapon.AmmoGive 20
  Weapon.AmmoType "Clip"
  AttackSound "Weapon/COLTFIRE"
  Weapon.SlotNumber 2
  Obituary "%o was Killed by %k's Kimber."
  +WEAPON.WIMPY_WEAPON
+Weapon.Ammo_Optional
  Inventory.Pickupmessage "Picked up a Kimber Warrior."
  States
  {
  Ready:
    COLT A 1 A_WeaponReady
    Loop
  Deselect:
    COLT A 1 A_Lower
    Loop
  Select:
    COLT A 1 A_Raise
    Loop
  Fire:
    COLT A 0 A_JumpIfNoAmmo("Click")
   COLF A 1 A_FireBullets(5.2,1,1,7.5)
   COLF A 1 A_Light2
   COLF A 1 A_Light1
   COLT B 3 A_Light0
    COLT CDE 3
    COLT B 3 A_ReFire
    Goto Ready
  Flash:
    COLF A 3 Bright A_Light1
    COLF A 3 Bright A_Light0
    Goto LightDone
  Spawn:
    COLP A -1
    Stop
   Click:
COLT A 0 A_PlayWeaponSound("ammo/out")
COLT A 4
Goto Ready
  }
}
Blue Shadow
Posts: 5043
Joined: Sun Nov 14, 2010 12:59 am

Re: Sound clip when Picking up a gun

Post by Blue Shadow »

You can put it anywhere as long as it is outside the States block:

Code: Select all

actor Colt45 : Weapon 5757
{
  Weapon.SelectionOrder 1900
  Weapon.AmmoUse 1
  Weapon.AmmoGive 20
  Weapon.AmmoType "Clip"
  AttackSound "Weapon/COLTFIRE"
  Weapon.SlotNumber 2
  Obituary "%o was Killed by %k's Kimber."
  +WEAPON.WIMPY_WEAPON
+Weapon.Ammo_Optional
  Inventory.Pickupmessage "Picked up a Kimber Warrior."
  Inventory.PickupSound "coolsound" // <----
  States
  {
  Ready:
    COLT A 1 A_WeaponReady
    Loop
  Deselect:
    COLT A 1 A_Lower
    Loop
  Select:
    COLT A 1 A_Raise
    Loop
  Fire:
    COLT A 0 A_JumpIfNoAmmo("Click")
   COLF A 1 A_FireBullets(5.2,1,1,7.5)
   COLF A 1 A_Light2
   COLF A 1 A_Light1
   COLT B 3 A_Light0
    COLT CDE 3
    COLT B 3 A_ReFire
    Goto Ready
  Flash:
    COLF A 3 Bright A_Light1
    COLF A 3 Bright A_Light0
    Goto LightDone
  Spawn:
    COLP A -1
    Stop
   Click:
COLT A 0 A_PlayWeaponSound("ammo/out")
COLT A 4
Goto Ready
  }
}
rummy00
Posts: 68
Joined: Tue Sep 03, 2013 5:05 pm

Re: Sound clip when Picking up a gun

Post by rummy00 »

Thanks, man! and this will be solely for this one gun? like It won't apply to any others?
Locked

Return to “Editing (Archive)”