Sound clip when Picking up a gun
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.
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.
Sound clip when Picking up a gun
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?
and I want the super shotty (the double barrel) gun to have the sound clip.
How can I do that?
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: Sound clip when Picking up a gun
[wiki=Actor_properties#Inventory.PickupSound]Inventory.PickupSound[/wiki]
Re: Sound clip when Picking up a gun
Thanks, were in the code would I put that?Blue Shadow wrote:[wiki=Actor_properties#Inventory.PickupSound]Inventory.PickupSound[/wiki]
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: Sound clip when Picking up a gun
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
}
}
Re: Sound clip when Picking up a gun
so would this be were i'd insert it?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 } }
Code: Select all
ACTOR NewMarine : Doomplayer
{
Inventory.PickupSound "coolsound"
Player.StartItem "clip", 13
Player.StartItem "colt45"
Player.StartItem "Fist"
}
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: Sound clip when Picking up a gun
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.
Re: Sound clip when Picking up a gun
okay, so.. here is a code for a custom weapon, where would i insert it?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.
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
}
}
-
- Posts: 5043
- Joined: Sun Nov 14, 2010 12:59 am
Re: Sound clip when Picking up a gun
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
}
}
Re: Sound clip when Picking up a gun
Thanks, man! and this will be solely for this one gun? like It won't apply to any others?