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

The Specialists: Modifying Kill Weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-30-2016 , 03:09   The Specialists: Modifying Kill Weapon
Reply With Quote #1

I do not expect anyone will be able to help me with this, but I figured I would ask anyway.

Working in The Specialists, I have an issue where I need to modify which weapon a kill is attributed to. I found three offsets within the "weapon_tsgun" tied to a player, and I've tried to override those. One is straightforward, it's the weapon ID. If any weapon is equipped in the hand and this pdata int is changed, it will attribute the kill to whatever is set at this offset. However, if kung fu is equipped when the kill occurs, setting the weapon ID does nothing, it will register as a kung fu kill.

The data at the other two offsets seems to change every time I connect. Not by a lot, but it's definitely not consistent, even when I have an identical loadout between rejoins. I know these are relevant offsets because when I've copied them and forced their values on some kills, occasionally they did exactly what I wanted (which is to force kill attribution to a specific weapon even when kung fu is equipped), but more often than not they crashed the server. It seems to me like these two offsets contain some kind of pointer, but I'm not sure to what or even how I could utilize them properly to do what I want.

If there is another way of doing this, like a way of hooking the scoring system, that would be great, but what I am not interested in is simply changing death messages, because the weapons used in this mod have implications within the scoring system that I would like to preserve and not hack.

(Edit: I guess it might be worth noting the offsets are 46, 47, and 48. That is to say they're sequential, not arbitrary locations I'm pulling out of a hat as a guess. 46 is definitely a weapon id and the following two are also definitely related, which seems logical enough to me.)
__________________

Last edited by Bad_Bud; 08-30-2016 at 03:16.
Bad_Bud is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-30-2016 , 17:15   Re: The Specialists: Modifying Kill Weapon
Reply With Quote #2

Here's some data I collected...

Code:
46: 0,  47: 0,         48: 0
46: 1,  47: 141894108, 48: 147064828
46: 2,  47: 141894164, 48: 147065816
46: 3,  47: 141894220, 48: 147066804
46: 4,  47: 141894276, 48: 147067792
46: 5,  47: 141894332, 48: 147068780
46: 6,  47: 141894388, 48: 147069768
46: 7,  47: 141894444, 48: 147070756
46: 8,  47: 141894500, 48: 147071744
46: 9,  47: 141894556, 48: 147072732
46: 10, 47: 141894612, 48: 147073720
46: 11, 47: 141894668, 48: 147074708
46: 12, 47: 141894724, 48: 147075696
46: 13, 47: 141894780, 48: 147076684
46: 14, 47: 141894836, 48: 147077672
46: 15, 47: 141894892, 48: 147078660
46: 16, 47: 141894948, 48: 147079648
46: 17, 47: 141895004, 48: 147080636
46: 18, 47: 141895060, 48: 147081624
46: 19, 47: 141895116, 48: 147082612
46: 20, 47: 141895172, 48: 147083600
46: 21, 47: 141895228, 48: 147084588
46: 22, 47: 141895284, 48: 147085576
46: 23, 47: 141895340, 48: 147086564
46: 24, 47: 141895396, 48: 147087552
46: 25, 47: 141895452, 48: 147088540
46: 26, 47: 141895508, 48: 147089528
46: 27, 47: 141895564, 48: 147090516
46: 28, 47: 141895620, 48: 147091504
46: 30, 47: 141895732, 48: 147093480
46: 31, 47: 141895788, 48: 147094468
46: 32, 47: 141895844, 48: 147095456
46: 33, 47: 141895900, 48: 147096444
46: 34, 47: 141895956, 48: 147097432
46: 35, 47: 141896012, 48: 147098420
46: 36, 47: 141896068, 48: 147099408
46: 37, 47: 141896124, 48: 147100396
The resulting patterns:

Offset 46 is given by WPNID
Offset 47 is given by (C1 + WPNID * 56) where C1 is a mystery
Offset 48 is given by (C2 + WPNID * 988) where C2 is a mystery

I messed around and reconnected and picked up a few weapons again to confirm the patterns which did hold:

Code:
46: 1,  47: 141893500, 48: 147064828
46: 2,  47: 141893556, 48: 147065816
46: 35, 47: 141895404, 48: 147098420
It's possible this is somehow related to Ham_Items but I don't know how those work at all. So far it seems like the most logical approach would be to save these offsets for each player when a particular weapon is equipped (if that is possible to hook). In particular I am only interested in saving when it is a grenade, seal knife, combat knife, or katana.
__________________
Bad_Bud is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-31-2016 , 11:10   Re: The Specialists: Modifying Kill Weapon
Reply With Quote #3

Well, what are you trying to do exactly?
__________________
Arkshine is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 08-31-2016 , 15:03   Re: The Specialists: Modifying Kill Weapon
Reply With Quote #4

I had a theory that deaths caused by non-player inflictors would sometimes cause the server to crash. So I was experimenting with rerouting damage from non-player inflictors to player sources, which would cause instances where grenades and throwing knives would cause kung fu kills.

Capturing the mystery variable on Ham_Item_Deploy (when a player switches weapons), and saving the values at the offsets 47 and 48 if the weapon is a grenade or other thrown weapon did work, but it was a pretty massive hack overall. I wasn't able to reliably reproduce the crashes one way or another, so for now it just remains an experimental solution I'm probably going to abandon, but that is how I solved it.
__________________

Last edited by Bad_Bud; 08-31-2016 at 15:07.
Bad_Bud is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-02-2016 , 09:08   Re: The Specialists: Modifying Kill Weapon
Reply With Quote #5

Unless you're talking about an original bug in the game, You should start to review your third-party plugins instead. It should be easy to find it.
__________________
Arkshine is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 09-02-2016 , 15:10   Re: The Specialists: Modifying Kill Weapon
Reply With Quote #6

I'm talking about original bugs in the game.
__________________
Bad_Bud 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 07:45.


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