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.
LocateWeapon() fails to return true
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.
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.
- 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
- Attachments
-
- locateweapontest.pk3
- (442 Bytes) Downloaded 38 times
Re: LocateWeapon() fails to return true
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.
Weapons are added later in PostBeginPlay() function, in APlayerPawn::PostBeginPlay() on C++ side to be precise.
- 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
If that is the case, could you suggest a better place in an EventHandler to successfully run these operations?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: LocateWeapon() fails to return true
What are you trying to do?
- 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
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.
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.