[SOLVED] Custom weapon causing freezes?

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!)
Post Reply
Alexagon
Posts: 74
Joined: Mon Apr 22, 2019 2:58 am
Graphics Processor: nVidia (Modern GZDoom)

[SOLVED] Custom weapon causing freezes?

Post by Alexagon »

So I just finished my custom weapon, but it seems like it is causing some freezes. I'm playing Plutonia 2 on map 14 and I pick up the weapon, then the game crashes a few seconds later randomly. The weird thing is I tried it with map 2 on doom 2 since i can get the pistol there but I have no issues on that map so idk what's going on.

EDIT: Disregard that map 2 part. It's doing in in all cases I've tested it with.

I'll post the code for the weapon. But if anyone can help me I'd be very grateful.
Spoiler:
Last edited by Alexagon on Wed Jun 12, 2019 1:49 am, edited 1 time in total.
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom weapon causing freezes?

Post by _mental_ »

You need to post a minimal runnable sample that causes the problem.
Alexagon
Posts: 74
Joined: Mon Apr 22, 2019 2:58 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom weapon causing freezes?

Post by Alexagon »

_mental_ wrote:You need to post a minimal runnable sample that causes the problem.
What exactly do you mean?
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom weapon causing freezes?

Post by _mental_ »

Runnable sample means a .wad/.pk3/.pk7 file that anyone can load with GZDoom in order to reproduce this issue.
The most obvious problem with your code is missing definition of base class ModWeapon. Nobody can read your mind to figure out what this class is.
Alexagon
Posts: 74
Joined: Mon Apr 22, 2019 2:58 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom weapon causing freezes?

Post by Alexagon »

_mental_ wrote:Runnable sample means a .wad/.pk3/.pk7 file that anyone can load with GZDoom in order to reproduce this issue.
The most obvious problem with your code is missing definition of base class ModWeapon. Nobody can read your mind to figure out what this class is.
Here it is.

https://drive.google.com/file/d/10Ykaok ... sp=sharing
_mental_
 
 
Posts: 3820
Joined: Sun Aug 07, 2011 4:32 am

Re: Custom weapon causing freezes?

Post by _mental_ »

Well, minimal sample means everything required to reproduce the problem, not a whole mod.
Anyway, I loaded the mod, did summon FusionPistol in console, picked it up, ran around, killed some enemies. It works for me.
Alexagon
Posts: 74
Joined: Mon Apr 22, 2019 2:58 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom weapon causing freezes?

Post by Alexagon »

_mental_ wrote:Well, minimal sample means everything required to reproduce the problem, not a whole mod.
Anyway, I loaded the mod, did summon FusionPistol in console, picked it up, ran around, killed some enemies. It works for me.
It's easier just to post the whole thing. Doesn't really matter all that much.

Were you able to complete any levels? Last time I tried it I made it through Entryway, but then it froze when I went back and tried it in plutonia. I know it's not plutonia because it HAS frozen on the standard maps, it's just not consistent when and where it happens.
Alexagon
Posts: 74
Joined: Mon Apr 22, 2019 2:58 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom weapon causing freezes?

Post by Alexagon »

Turns out it as the takeinventory tag at the end of deselect causing the freeze. Took that out and it seems to be running fine.
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: Custom weapon causing freezes?

Post by Matt »

This is the takeinventory frame I see on the OP right now:

Code: Select all

   TNT1 A 0 A_TaKeInventory ("givefire", 999)
   Wait
"Wait" means basically "loop just that last frame". This mean you've got a zero-length loop right there.

This would fix it:

Code: Select all

   TNT1 A 1{ //make sure this is at least 1 tick
    A_TaKeInventory ("givefire") //if you don't specify a # it takes all
    A_Lower
   }
   Wait
Alexagon
Posts: 74
Joined: Mon Apr 22, 2019 2:58 am
Graphics Processor: nVidia (Modern GZDoom)

Re: Custom weapon causing freezes?

Post by Alexagon »

Matt wrote:This is the takeinventory frame I see on the OP right now:

Code: Select all

   TNT1 A 0 A_TaKeInventory ("givefire", 999)
   Wait
"Wait" means basically "loop just that last frame". This mean you've got a zero-length loop right there.

This would fix it:

Code: Select all

   TNT1 A 1{ //make sure this is at least 1 tick
    A_TaKeInventory ("givefire") //if you don't specify a # it takes all
    A_Lower
   }
   Wait
Thank you. I appreciate the help.
Post Reply

Return to “Scripting”