Weapon Strip (HUD question) Created 5 years ago2018-10-24 09:20:33 UTC by PeterBrev PeterBrev

Created 5 years ago2018-10-24 09:20:33 UTC by PeterBrev PeterBrev

Posted 5 years ago2018-10-24 09:20:33 UTC Post #341063
Yo,

Straight to the point - when the player_weaponstrip strips your weapon away, a (small) issue that occurs is that the ammo hud does not disappear. How would you go to fix this?

Peter
PeterBrev PeterBrevLevel Designer
Posted 5 years ago2018-11-17 07:00:58 UTC Post #341260
I'm guessing it could be fixed in code - are you just making a map or making your own mod?
Posted 5 years ago2018-11-18 00:20:53 UTC Post #341263
It's a mod. We're using regular GoldSrc I have been searching for a solution to this bug for so many years and I just can't figure out what to look for. I know Spirit and the PS2 version of Half-Life have this fixed, but there are so many things I just don't like with Spirit (or maybe I'm just not looking at it right). We're using regular GoldSrc using the SDK on Github. Seeing as Spirit has it fixed, I really want to know what to look for so that it's an easy copy paste or something that I can ask a programmer to look for and fix.

Peter
PeterBrev PeterBrevLevel Designer
Posted 5 years ago2018-11-18 00:35:03 UTC Post #341264
i think after stripping give player a crowbar. then strip again. i think this may solve the problem. only if this can be made using hammer editor.
Posted 5 years ago2018-11-18 09:27:21 UTC Post #341265
This is a cheap trick that only works in certain situations, which I'm not interested in. What I'm looking for is code fix.
PeterBrev PeterBrevLevel Designer
Posted 5 years ago2018-11-18 15:45:21 UTC Post #341266
Strip the suit like SoHL does.
Posted 5 years ago2018-11-18 18:04:40 UTC Post #341267
So to remove the ammo HUD hereSo to remove the ammo HUD here
and end up without the ammo HUD like this screenshot of SoHL 1.8 when stripped of your weaponsand end up without the ammo HUD like this screenshot of SoHL 1.8 when stripped of your weapons
,
I have to strip the entire suit?I have to strip the entire suit?
Even when I spawn a new HEV suit,  the ammo HUD is still thereEven when I spawn a new HEV suit, the ammo HUD is still there
So how does that work?

And just so we're clear, I'm not taking "Use SoHL" or "Deal with it" as answers.

So what am I supposed to look for in the code of SoHL 1.8 that got this fixed? I don't want to have the entire suit stripped like SoHL 1.9 is doing. Makes no sense because if I wanted to strip the suit, it's just a matter of changing pPlayer->RemoveAllItems( FALSE ); to true, which is not what I'm asking.
PeterBrev PeterBrevLevel Designer
Posted 5 years ago2018-11-18 18:17:38 UTC Post #341268
In this if check: https://github.com/ValveSoftware/halflife/blob/5d761709a31ce1e71488f2668321de05f791b405/cl_dll/ammo.cpp#L579

Add m_pWeapon = NULL;

You may also want to set it to NULL a bit lower if the retrieved WEAPON* is NULL so the last weapon's ammo HUD isn't left visible if no definition exists.

I haven't tested it but this should work.
Posted 5 years ago2018-11-18 19:23:57 UTC Post #341270
Unbelievable. 6 years I have been trying to hunt this down and it was simply a small thing to do... and that worked perfectly...

Can you confirm this is correct?

https://pastebin.com/dM1p9ejP (cause Markdown doesn't format it right here - haven't pasted the whole code either, just the bit that got edited but it compiled without any issue)
PeterBrev PeterBrevLevel Designer
Posted 5 years ago2018-11-18 20:36:35 UTC Post #341271
Yeah that looks good.

If you want to paste blocks of code you should use pre tags: https://twhl.info/wiki/page/TWHL:_WikiCode_Syntax#wiki-heading-16
You must be logged in to post a response.