Raised This Month: $51 Target: $400
 12% 

[L4D2] How to determine if Grenade Launcher has special ammo?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 12-09-2020 , 13:09   [L4D2] How to determine if Grenade Launcher has special ammo?
Reply With Quote #1

Using SDKHook_OnTakeDamage, I have already determined that the inflictor is "grenade_launcher_projectile". What I want to do next is determine if the grenade_launcher_projectile is using special ammo, like incendiary or explosive. With regular weapons I can do this using...

GetEntProp(weapon, Prop_Send, "m_upgradeBitVec")

Of course, with the grenade launcher, the weapon is -1, so the above command will not work. If I try the same command above but use inflictor (the projectile) instead of weapon...

GetEntProp(inflictor, Prop_Send, "m_upgradeBitVec")

...it fails with...

Property "m_upgradeBitVec" not found (entity 148/grenade_launcher_projectile)

How do I determine whether the damage from grenade_launcher_projectile includes incendiary/explosive special ammo?
Mystik Spiral is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 12-09-2020 , 16:03   Re: [L4D2] How to determine if Grenade Launcher has special ammo?
Reply With Quote #2

Maybe you can check the damage type, I'm not certain but the incendiary may have the flags of "DMG_BURN" and the explosive "DMG_BLAST".

But may have another way to find this.
__________________
Marttt is offline
BRU7US
Member
Join Date: Jul 2020
Location: Tatarstan, Kazan
Old 12-09-2020 , 16:41   Re: [L4D2] How to determine if Grenade Launcher has special ammo?
Reply With Quote #3

Try to use m_nUpgradedPrimaryAmmoLoaded. This must return amount of upgraded ammo, but not type of ammo.
BRU7US is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 12-09-2020 , 19:40   Re: [L4D2] How to determine if Grenade Launcher has special ammo?
Reply With Quote #4

Quote:
Originally Posted by Marttt View Post
Maybe you can check the damage type, I'm not certain but the incendiary may have the flags of "DMG_BURN" and the explosive "DMG_BLAST".

But may have another way to find this.
Thank you Marttt! This mostly worked. That is, after I know the inflictor is "grenade_launcher_projectile" and I do a check like this for incendiary...

if (damagetype & DMG_BURN)

...it correctly evaluates true with incendiary ammo. However, if I check like this for explosive...

if (damagetype & DMG_BLAST)

...it evaluates true for both explosive explosive ammo and regular explosive ammo.

It does seem rather redundant that a grenade launcher could use regular explosive ammo or explosive explosive ammo, but there must be some reason why explosive explosive ammo can be loaded. My tests seem to indicate explosive explosive ammo does not cause any more damage than regular explosive ammo. Maybe it just expands the kill/stumble zone?
Mystik Spiral is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 12-09-2020 , 20:34   Re: [L4D2] How to determine if Grenade Launcher has special ammo?
Reply With Quote #5

Hm try to output to the chat the damagetype as int without explosive ammo, and with explosive ammo, check if any flag is added. Maybe not, since grenade launcher already "explodes" as default. I use the damage type do detect if the damage is from spit, but may not work properly for explosive ammo in grenade launcher.

I usually use some other plugins to help me to detect what is changing,
Check this plugin:

https://forums.alliedmods.net/showthread.php?p=1349107

I usually output the entity (activeWeapon) to the chat, and by using this I type !ted_selectid (entity id) then !ted_watch

And you can detect what is being changed
__________________
Marttt is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode