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

Weapon disappears after switching?

Post by The Struggler »

For some reason, my Auto Shotgun disappears after switching...
Heres the script:
Spoiler:
Also, it dosen't appear if i use IDKFA.
HELP ME WEAPON DECORATE GODS! :violin:
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

Holy shit, im so goddamn stupid.
I fixed it, turns out the numbers too high.
Welp, that was it folks!
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Turns out. still not done.

Post by The Struggler »

Ok, thought this was over. Sorry but, now ingame it appears as a red exclamation error thingy, and still dosent appear if i give all.
Basically, i changed it out of the map in a separate wad and i thought i worked since I typed in IDFKA and it appeared, but when I tried it in the map itself, it became that, so yeah.
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

Also, I dont know if this is related but.... in GZDoom Builder it says that "DECORATE warning in "MAP01.wad\DECORATE:1696", line 45. Unable to find "Weapon" class to inherit from, while parsing "AutoShotgun:19073"." I really need help. Badly.
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: Turns out. still not done.

Post by Blue Shadow »

The Struggler wrote:now ingame it appears as a red exclamation error thingy, and still dosent appear if i give all.
This could either mean that the weapon is not loaded into the game, or it is loaded, but it has somehow ended up with a different [wiki]editor number[/wiki]. Have you changed its editor number after you moved it out into its own WAD file?
Also, I dont know if this is related but.... in GZDoom Builder it says that "DECORATE warning in "MAP01.wad\DECORATE:1696", line 45. Unable to find "Weapon" class to inherit from, while parsing "AutoShotgun:19073"."
That warning shouldn't have any effect on the weapon. You can silence it by loading the gzdoom.pk3 file as a resource when working on the map.
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

I did update it, and i replaced the old decorate with the new one.
Here it is:
Actor AutoShotgun : Weapon 19073
{
Inventory.PickupMessage "Feel the pain with this badass Auto Shotgun! Atleast thats what the commercials said."
Weapon.AmmoType "Shell"
Weapon.AmmoUse 3
Weapon.SlotNumber 3
Weapon.AmmoGive 20
AttackSound "Weapons/autoshoot"
States
{
Spawn:
AHOT E -1
Loop
Ready:
AHTG A 1 A_WeaponReady
Loop
Select:
TNT1 A 0
TNT1 AAAAAAAA 0 A_Raise
ABTG ABCDE 1 A_WeaponReady
Loop
Deselect:
AHTG A 1 A_Lower
Loop
Fire:
AHTG B 0 A_Gunflash
AHTG A 1 A_FireBullets (5.5, 2, 10, 3, "BulletPuff", 1)
AHTG A 1 Offset (0,48)
AHTG A 1 Offset (0,39)
AHTG A 1 Offset (0,38)
AHTG A 1 Offset (0,29)
AHTG A 1 Offset (0,30)
AHTG A 1 Offset (0,32)
AHTG A 4
Goto Ready
Flash:
AHTG B 2 BRIGHT A_Light2
AHTG C 2 BRIGHT A_Light1
AHTC D 2 BRIGHT A_Light1
TNT1 A 1 A_Light0
Goto LightDone
}
}
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: Weapon disappears after switching?

Post by Blue Shadow »

Yeah, between the old and new code, the editor number is different:

Code: Select all

Actor AutoShotgun : Weapon 27018 // Old code   

Code: Select all

Actor AutoShotgun : Weapon 19073 // New code   
Go to your map in the editor and replace the old weapon pickup thing with the new one.
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

Well, i already did that, but the weapon still disappears after switching.
Blue Shadow
Posts: 5039
Joined: Sun Nov 14, 2010 12:59 am

Re: Weapon disappears after switching?

Post by Blue Shadow »

After switching from the weapon, drop the [wiki]console[/wiki] and execute this:

Code: Select all

use autoshotgun
Are you able to switch back to the weapon?
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed

Re: Weapon disappears after switching?

Post by wildweasel »

What I'm confused by, is that Struggler hasn't really defined what he means by "disappears" - does it switch away correctly, but never appear in the weapon slots again? Does the weapon lower, but lock up, so you can never wield a weapon again? Does the weapon simply become invisible under certain circumstances?

Basically, what I should be asking: can you post your WAD/PK3 file that you're working on?
User avatar
Cherno
Posts: 1334
Joined: Tue Dec 06, 2016 11:25 am

Re: Weapon disappears after switching?

Post by Cherno »

I had this problem a few times and it was always due to me not setting up the player class' weapon slots correctly. You would still have a weapon after switching to another one, but since it wouldn't be assigned to a weapon slot you wouldn't be able to select it again, so check if that's the case.
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

Well, what im saying is that after switching it just never appears again. Imma try to post it tom. Got lots of stuff to do.
Sorry for the weird reply sched. I'm from the Philippines.
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed

Re: Weapon disappears after switching?

Post by wildweasel »

Cherno wrote:I had this problem a few times and it was always due to me not setting up the player class' weapon slots correctly. You would still have a weapon after switching to another one, but since it wouldn't be assigned to a weapon slot you wouldn't be able to select it again, so check if that's the case.
Considering the code does define a Weapon.SlotNumber, I wonder if something else isn't overriding that. I'd guess at it being some rogue KEYCONF lump clearing the weapon slots to redefine them with SetSlot, but again, I would need to see the project file to tell for sure.
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

Where could I upload files?
User avatar
The Struggler
Posts: 15
Joined: Sat Sep 22, 2018 12:46 pm

Re: Weapon disappears after switching?

Post by The Struggler »

I FINALLY GODDAMN FIXED IT!
Found a KEYCONF lump that comes from a SSG replacement which has a setslot in it.
Thanks for all those who actually tried to help me out.
;)

Return to “Scripting”