LocateWeapon() fails to return true

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

LocateWeapon() fails to return true

Post by Ed the Bat »

At an unknown point, LocateWeapon() seems to have stopped working for how I had been using it. What once returned true, when expected, now returns false in all conditions.

In the attached example, the EventHandler's PlayerEntered() function checks for LocateWeapon("Pistol"), which should return true in Doom. However, it returns false, as evidenced by the console.printf() called for each result.
Attachments
locateweapontest.pk3
(442 Bytes) Downloaded 38 times
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: LocateWeapon() fails to return true

Post by _mental_ »

Are you sure that it worked before? When PlayerEntered() is called weapon slots are empty.
Weapons are added later in PostBeginPlay() function, in APlayerPawn::PostBeginPlay() on C++ side to be precise.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: LocateWeapon() fails to return true

Post by Ed the Bat »

If that is the case, could you suggest a better place in an EventHandler to successfully run these operations?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49073
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: LocateWeapon() fails to return true

Post by Graf Zahl »

What are you trying to do?
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: LocateWeapon() fails to return true

Post by Ed the Bat »

I was dynamically building a list of ammotypes for my statusbar that would account for whatever weapons are available in the game.

For right now, I guess I can put this command in WorldTick and tell it to only run once for each player after waiting a few tics. It seems to be working, at least.
Post Reply

Return to “Closed Bugs [GZDoom]”