Having issues getting a custom weapon to work.

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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!)
Post Reply
User avatar
simploo
Posts: 93
Joined: Mon Jun 26, 2017 2:17 am
Graphics Processor: nVidia with Vulkan support
Location: Argent D'nur

Having issues getting a custom weapon to work.

Post by simploo »

Hey, so I've been making some custom weapons for a map I've been working on and one weapon in particular is giving me a massive headache, I've had no issues with my other weapons, and looked over this code so much I still cant spot whats wrong.
Essentially, I cannot pick up the weapon, nor can I switch to it when I give it to myself via console. Can anybody with experience when it comes to custom weapons spot what I'm doing wrong?

Code: Select all

Actor 8CUltraShotgun : Weapon 12666
{
   obituary "%o was obliterated by %k's Ultra-Shotgun!"
   Inventory.pickupmessage "You picked up the Ultra Shotgun"
   Radius 20
   Height 16
   Weapon.SelectionOrder 2600
   Weapon.SlotNumber 3
   Weapon.kickback 75
   Weapon.AmmoType1 "Shell"
   Weapon.AmmoGive 8
   Weapon.AmmoUse1 1
   +WEAPON.NOAUTOAIM
   Decal BulletChip
   States
{
Ready:
   D4QA A 1 A_WeaponReady
   Loop
Spawn:
   D4QW A -1
   Stop
Deselect:
   D4QB A 1 A_Lower
   Loop
Select:
   D4QB A 1 A_Raise
   Loop
Fire:
   D4QB A 2
   D4QB A 0 A_CheckReload
   D4QB A 0 A_FireCustomMissile("GunFlash",-5,0,-85,0,random(-10,10))
   D4QB A 0 A_FireCustomMissile("SparkFlash",0,0,0,0)
   D4QB AAAAAAAAAAAAAAAA 0 A_FireCustomMissile("BulletTracer", random(-14,14), 0, 0, -12, 0, random(-6,6))
   D4QB AAAAAAAAAAAAAAAA 0 A_FireCustomMissile("BulletTracer", random(-14,14), 0, 0, -12, 0, random(-6,6))
   D4QB A 0 A_PlaySound("D4QuadBarrel/fir", 1)
   D4QB A 2 A_GunFlash
   D4QB B 0 A_FireBullets (14, 6, 10, 11, "BulletPuff", FBF_USEAMMO|FBF_NORANDOM)
   D4QB B 0 A_FireBullets (14, 6, 10, 11, "BulletPuff", FBF_USEAMMO|FBF_NORANDOM)
   D4QB B 0 A_FireBullets (14, 6, 10, 11, "BulletPuff", FBF_USEAMMO|FBF_NORANDOM)
   D4QB B 0 A_FireBullets (14, 6, 10, 11, "BulletPuff", FBF_USEAMMO|FBF_NORANDOM)
   D4QB B 2 A_setpitch(pitch-12.0)
   D4QB A 1 A_setpitch(pitch+8.0)
   D4QB A 1 A_CheckReload
   D4QB CDEF 2 A_setpitch(pitch-0.2)
   D4QB GHI 2 A_setpitch(pitch+0.2)
   D4QB J 2 A_PlaySound("D4Reload1/ssg", 1)
   D4QB J 0 A_setpitch(pitch-0.2)
   D4QB KL 2 A_setpitch(pitch+0.2)
   D4QC L 2 A_setpitch(pitch+0.2)
   D4QB M 2 A_setpitch(pitch+0.2)
   D4QB NOP 2 A_setpitch(pitch+0.2)
   D4QB Q 2 A_PlaySound("D4Reload2/ssg", 1)
   D4QB Q 0 A_setpitch(pitch+0.2)
   D4QC Q 2 A_setpitch(pitch+0.2)
   D4QB RS 2 A_setpitch(pitch+0.2)
   D4QB T 2 A_PlaySound("D4Reload3/ssg", 1)
   D4QB T 0 A_setpitch(pitch-0.2)
   D4QB UVW 2 A_setpitch(pitch-0.2)
   D4QB X 2 A_PlaySound("D4Reload2/ssg", 1)
   D4QB X 0 A_setpitch(pitch-0.2)
   D4QB YZ 2 A_setpitch(pitch-0.2)
   D4QC AB 2 
   D4QB EDC 2 A_setpitch(pitch+0.2)
   D4QB A 0 A_Refire
   Goto Ready
Flash:
   D4QF B 1 Bright A_Light2
   D4QF A 1 Bright A_Light1
   Goto LightDone
   }
}
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Having issues getting a custom weapon to work.

Post by Blue Shadow »

Assuming the sprites exist and they're in the correct [wiki]namespace[/wiki] (between SS_START and SS_END markers for WADs, and in the sprites directory for PK3s/ZIPs), are you referencing their name correctly in your code?
User avatar
simploo
Posts: 93
Joined: Mon Jun 26, 2017 2:17 am
Graphics Processor: nVidia with Vulkan support
Location: Argent D'nur

Re: Having issues getting a custom weapon to work.

Post by simploo »

As far as I can tell, I do have everything in the correct namespaces, and like I've said, I've gone over it quite a few times already and cant spot anything, It's probably something stupid I'm sure, but hell if I know.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Having issues getting a custom weapon to work.

Post by Blue Shadow »

Okay. I'm going to have to see the mod, then, to figure out what's wrong. Could you upload it?
User avatar
simploo
Posts: 93
Joined: Mon Jun 26, 2017 2:17 am
Graphics Processor: nVidia with Vulkan support
Location: Argent D'nur

Re: Having issues getting a custom weapon to work.

Post by simploo »

I'll get to you tomorrow via PM, thanks.
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: Having issues getting a custom weapon to work.

Post by Blue Shadow »

To whoever comes across this thread, this turned out to be a case of a missing sprite (for the Ready state).
Post Reply

Return to “Scripting”