Weapon disappears after switching?

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!)
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

Ok, so sorry to bug again but,
Why is my new weapon locked?
I mean, you cant switch it.
Heres the script:

Actor ShotgunNew : Weapon replaces Shotgun
{
Inventory.PickupMessage "Do you suck dick"
Weapon.AmmoType "Shell"
Weapon.AmmoUse 1
Weapon.AmmoGive 16
Weapon.SlotNumber 3
Attacksound "weapon/shotgf"
States
{
Spawn:
SHOT A -1
Stop
Ready:
SHTN A 1 Offset(63, -29) A_WeaponReady
Loop
Select:
SHTN A 1 Offset(-114, 11)
SHTN A 1 Offset(-104, 2)
SHTN A 1 Offset(-72, -22)
SHTN A 1 Offset(-17, -46)
SHTN A 1 Offset(24, -54)
SHTN A 1 Offset(30, -46)
SHTN A 1 Offset(57, -31) A_Raise
Loop
Deselect:
SHTN A 1 Offset(49, -20)
SHTN A 1 Offset(65, -14)
SHTN A 1 Offset(90, 10)
SHTN A 1 Offset(113, 18)
SHTN A 1 Offset(139, 43)
SHTN A 1 Offset(157, 58) A_Lower
Loop
Fire:
SHTN B 3 Offset(78, -20) A_Firebullets (3, 4, 2, 4, "BulletPuff", 1)
SHTN C 2 Offset(102, -5)
SHTN C 2 Offset(146, 16)
SHTN C 1 Offset(120, -1)
SHTN C 1 Offset(88, -18)
SHTN E 2 Offset(72, -54)
SHTN E 2 Offset(106, -53)
SHTN D 3 Offset(78, -48)
SHTN D 3 Offset(92, -44)
SHTN D 1 Offset(63, -51)
SHTN A 3 Offset(72, -36)
SHTN A 1 Offset(55, -24)
SHTN A 3 Offset(30, -23)
Goto Ready
Ready:
SHTN A 3 Offset(63, -29)
Loop
}
}

Really, Really sorry to bug.
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: Weapon disappears after switching?

Post by Blue Shadow »

Your weapon has two Ready states, which is a problem. There is one at the top, and another at the bottom. You'll want to remove the one at the bottom, since it lacks a A_WeaponReady call, and I'd imagine, out of the two Ready states, it's the one being used.

Return to “Scripting”