ZScript Weapon Problem (SOLVED)

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
Exosphere
Posts: 168
Joined: Sun Jun 11, 2017 11:42 am
Location: New England, US

ZScript Weapon Problem (SOLVED)

Post by Exosphere »

Hello Again forums,

I have been having an unusually hard time trying to get one of my weapons to work. I can't seem to pick up my BFG weapon and I can't seem to find what is wrong with it, but I have a feeling it must be something very obvious. Everything in my code seems to be fine, but it isn't working no matter what I do. When I try to add it to inventory using console commands, it doesn't appear.

https://pastebin.com/bS5VCC1k
this is the main weapon code.
Last edited by Exosphere on Sat Jul 14, 2018 12:30 pm, edited 1 time in total.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: ZScript Weapon Problem

Post by Matt »

Do you have the BFGK* sprites loaded when you run this? That's the only issue I can see just looking at this code.

EDIT:

Code: Select all

BFGK A 1 A_Raise;
This is wrong and should be "...A_Raise();". If you're not getting an error message then this code isn't even being loaded. How are you running this?
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: ZScript Weapon Problem

Post by Blue Shadow »

Matt wrote:EDIT:

Code: Select all

BFGK A 1 A_Raise;
This is wrong and should be "...A_Raise();"
That's acceptable actually.
User avatar
Exosphere
Posts: 168
Joined: Sun Jun 11, 2017 11:42 am
Location: New England, US

Re: ZScript Weapon Problem

Post by Exosphere »

Matt wrote:Do you have the BFGK* sprites loaded when you run this? That's the only issue I can see just looking at this code.

EDIT:

Code: Select all

BFGK A 1 A_Raise;
This is wrong and should be "...A_Raise();". If you're not getting an error message then this code isn't even being loaded. How are you running this?
The weapon is model based. Thats why there is only is BFGK. Also, I can successfully summon it with the summon command, and it appears but thats it. Another thing, I can confirm that A_Raise; can be written without the parentheses.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: ZScript Weapon Problem

Post by Matt »

Has it always been like that? I remember this being one of the first things I had to learn when anonymous functions first came out.

In that case I see nothing else that could prevent the BFG from working.

Do give or IDFA work?
Blue Shadow
Posts: 4949
Joined: Sun Nov 14, 2010 12:59 am

Re: ZScript Weapon Problem

Post by Blue Shadow »

Exosphere wrote:The weapon is model based. Thats why there is only is BFGK.
I pretty much know nothing about models. But usually, if you can't receive or pick a weapon up, it's because the engine can't find the sprite used by the Ready state.
Matt wrote:Has it always been like that?
Yes. The parentheses are required only inside functions, anonymous or otherwise. They appear to be optional if you're calling the function directly from a state.
User avatar
Exosphere
Posts: 168
Joined: Sun Jun 11, 2017 11:42 am
Location: New England, US

Re: ZScript Weapon Problem

Post by Exosphere »

Blue Shadow wrote:
Exosphere wrote:The weapon is model based. Thats why there is only is BFGK.
Blue Shadow wrote: I pretty much know nothing about models. But usually, if you can't receive or pick a weapon up, it's because the engine can't find the sprite used by the Ready state.
Solved it. It was a sprite problem. Fixed it by adding the BFGK to my TEXTURES file. I knew it was going to be something relatively minor that I would forget.
Post Reply

Return to “Scripting”