attack sound does not start

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

attack sound does not start

Post by doommodder »

Hello everyone,
I don't know if it is the right place, but I have a problem, that is that I am creating a mod for doom 2, I added a couple of textures, I customized the game start and end level screens and I created a weapon with also a secondary fire that would replace the shotgun but the firing sound does not start with the main fire or with the secondary fire.
could you tell me where am i wrong?
and if you tell me how the damage inflicted on the weapon increases, you would do me a favor.

at this link you will find the .wad file of my mod
link<<https://drive.google.com/file/d/1465JhX ... sp=sharing
User avatar
Enjay
 
 
Posts: 27295
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: attack sound does not start

Post by Enjay »

I've had a very quick look and I don't see a [wiki]SNDINFO[/wiki] lump in your file. If you have added a new sound, you need to define its name in a SNDINFO lump and then use that name when you call it from your weapon.


Your SNDINFO lump could be as simple as

Code: Select all

Mycoolsound      DSMYCSND
Where Mycoolsound would be the name that you use in your weapon code and DSMYCSND would be the actual name of the sound lump in question. Obviously, you'd want to use better names than Mycoolsound and DSMYCSND. ;)
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

thank you very much,
now I will try and publish the answer
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

I tried to do as you said but it gave me an error when i start it.
The error is as follows "Script error, "prova 2.wad:SNDINFO" line 2: Missing string (unexpected end of file)."
I copied the SNDINFO file from your post, but I think I did something wrong.
The SNDINFO file is as follows
CODE: SELECT ALL
SUPERGUNFIRE SUPERGUN
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

I also tried this

CODE: SELECT ALL
Weapon\SUPERGUNFIRE SUPERGUN
but always the mistake
User avatar
Enjay
 
 
Posts: 27295
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: attack sound does not start

Post by Enjay »

I'm not sure what's wrong with what you are doing because none of the following give me the error that you quoted.

Code: Select all

SUPERGUNFIRE SUPERGUN

Code: Select all

Weapon\SUPERGUNFIRE SUPERGUN

Code: Select all

"Weapon\SUPERGUNFIRE" SUPERGUN
(BTW, if you want to use code tags you need to do something like this)

Code: Select all

[code]my code goes here
[/code]


Anyway, I've also had a look inside your DECORATE and you are using the AttackSound property for your weapon. I think that only works on enemies. To get your sound to play, your DECORATE should look something like this:

Code: Select all

actor Supergun : Weapon replaces Shotgun
{
  Scale 0.75
  Obituary "%o was splattered by %k pistol"
  Radius 20
  Height 16
  Inventory.pickupmessage "You got the SUPERGUN"
  Weapon.SelectionOrder 400
  Weapon.SlotNumber 3
  Weapon.kickback 200
  Weapon.ammotype1 "SHELL"
  Weapon.ammotype2 "SHELL"
  Weapon.ammouse1 1 
  Weapon.ammouse2 3
  Weapon.ammogive1 25
  Weapon.ammogive2 15
  States
{
  Spawn:
    2PIS E -1
    Loop
  Ready:
    2PIS A 2 A_WeaponReady
    Loop
  Deselect:
    2PIS D 1 A_Lower
    Loop
  Select:
    2PIS F 1 A_Raise
    Loop
  Fire:
    2PIS A 1    
    2PIS B 0 bright A_PlaySound("weapon/SUPERGUNFIRE", CHAN_WEAPON)
	2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
    2PIS C 4 
    2PIS F 4
    2PIS D 4 A_ReFire
    Goto Ready
   AltFire:
	2PIS A 1
	2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
	2PIS C 4
	2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
	2PIS C 4
	2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
	2PIS C 4
	2PIS F 4
    2PIS D 4 A_ReFire
	Goto Ready
	
  }
} 
I used that with a SNDINFO lump that had this in it:

Code: Select all

"weapon/SUPERGUNFIRE" SUPERGUN
and it worked just fine.

Files attached.
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

thank you,
I managed to make it work and now it works very well.
I would also have another question.
how do you increase weapon damage?
User avatar
Enjay
 
 
Posts: 27295
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: attack sound does not start

Post by Enjay »

You're using A_FireBullets. The wiki page for that tells you what the different parameters are - including the one for damage.

[wiki]A_FireBullets[/wiki]
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

in the code it is already present but it is not as strong as the hunting rifle
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

my code is

Code: Select all

actor Supergun : Weapon replaces Shotgun
{
  Scale 0.75
  Obituary "%o was splattered by %k pistol"
  Radius 20
  Height 16
  AttackSound "SUPERGUNFIRE"
  Inventory.pickupmessage "You got the SUPERGUN"
  Weapon.SelectionOrder 400
  Weapon.SlotNumber 3
  Weapon.kickback 200
  Weapon.ammotype1 "SHELL"
  Weapon.ammotype2 "SHELL"
  Weapon.ammouse1 1
  Weapon.ammouse2 3
  Weapon.ammogive1 25
  Weapon.ammogive2 15
  States
{
  Spawn:
    2PIS E -1
    Loop
  Ready:
    2PIS A 2 A_WeaponReady
    Loop
  Deselect:
    2PIS D 1 A_Lower
    Loop
  Select:
    2PIS F 1 A_Raise
    Loop
  Fire:
    2PIS A 1   
    2PIS B 0 bright A_PlaySound("weapon/SUPERGUNFIRE", CHAN_WEAPON)
   2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
    2PIS C 4
    2PIS F 4
    2PIS D 4 A_ReFire
    Goto Ready
   AltFire:
   2PIS A 1
   2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
   2PIS C 4
   2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
   2PIS C 4
   2PIS B 4 bright A_FireBullets(3, 3, 1, 5, "BulletPuff")
   2PIS C 4
   2PIS F 4
   2PIS D 4 A_ReFire
   Goto Ready
   
  }
} 
User avatar
Enjay
 
 
Posts: 27295
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: attack sound does not start

Post by Enjay »

Yeah, I know. That's why I linked you to the Wiki page. It tells you how to use A_FireBullets and which numbers/parameters do what.

If you want to increase damage, increase the damage value in your code or make each shot fire more bullets. You currently have A_FireBullets set to fire 1 bullet with a damage a 5 every time the function is called. To increase the damage, increase the relevant numbers to whatever you want.

Look at the bottom of the Wiki page for an example of a powerful, accurate single shot.
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

Ok thank you
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

hi
now I've got another question.
I want change the pistol with another gun but my every attempt did not work, how should i do?
this is my code:

Code: Select all

ACTOR PSRevolver : Weapon replaces Pistol
{
Weapon.Ammotype "clip"
Weapon.Ammouse 1
Weapon.Ammogive 10
Weapon.SlotNumber 2
Weapon.kickback 200
Weapon.ammouse 1
inventory.pickupsound "misc/w_pkup"
scale 0.6
AttackSound "REVOFIR"
Inventory.Pickupmessage "You got the a pistol!"
States
{
Spawn:
HGUN A 1
loop
Ready:
RVLV A 1 A_WeaponReady
loop
Select:
RVLV A 1 A_RAISE
NULL AA 0 A_RAISE
Loop
Deselect:
RVLV A 1 A_Lower
NULL AA 0 A_Lower
Loop
Fire:
NULL A 0 A_GunFlash
RVLV B 2 Bright A_FireBullets(0,0,1,7,"BulletPuff")
RVLV CDEFGHIJKLM 1
RVLV A 2
Goto ready
}
} 
Jarewill
 
 
Posts: 1855
Joined: Sun Jul 21, 2019 8:54 am

Re: attack sound does not start

Post by Jarewill »

Just replacing the pistol won't work, as it only replaces the pistol pickup.
Have you defined a custom playerclass?
If not, then that's what you need to do.
Here's some wiki pages that might help:
PlayerPawn Creating new player classes
Something as simple as:

Code: Select all

ACTOR DoomPlayer2 : DoomPlayer
{
  Player.StartItem "PSRevolver"
  Player.StartItem "Fist"
  Player.StartItem "Clip", 50
}
Should work. Just don't forget to add the playerclass in either KEYCONF or GAMEINFO. (Which I didn't even know was possible until now)
Creating new player classes wiki page I just linked should tell you how to do that.
doommodder
Posts: 26
Joined: Mon Dec 23, 2019 12:50 pm

Re: attack sound does not start

Post by doommodder »

I tried as you said but it doesn't work.
here I put the code I used and below the wad.

Code: Select all

ACTOR DoomPlayer2 : DoomPlayer
{
  Player.StartItem "PSRevolver"
  Player.StartItem "Fist"
  Player.StartItem "Clip", 50
}
ACTOR PSRevolver : Weapon replaces Pistol
{
Weapon.Ammotype "clip"
Weapon.Ammouse 1
Weapon.Ammogive 10
Weapon.SlotNumber 2
Weapon.kickback 200
Weapon.ammouse 1
inventory.pickupsound "misc/w_pkup"
scale 0.6
AttackSound "REVOFIR"
Inventory.Pickupmessage "You got the a pistol!"
States
{
Spawn:
HGUN A 1
loop
Ready:
RVLV A 1 A_WeaponReady
loop
Select:
RVLV A 1 A_RAISE
NULL AA 0 A_RAISE
Loop
Deselect:
RVLV A 1 A_Lower
NULL AA 0 A_Lower
Loop
Fire:
NULL A 0 A_GunFlash
RVLV B 2 Bright A_FireBullets(0,0,1,7,"BulletPuff")
RVLV CDEFGHIJKLM 1
RVLV A 2
Goto ready
}
}
P.s. this wad must be inserted in another wad to create a total conversion of doom
Post Reply

Return to “Scripting”