View Single Post
nosoop
Veteran Member
Join Date: Aug 2014
Old 03-16-2021 , 04:14   Re: [TF2] Custom Weapons X (preview)
Reply With Quote #5

Quote:
Originally Posted by Naleksuh View Post
In attribute development it's a common need to know when a weapon is equipped to perhaps do a particular action (maybe add a condition, grant health, etc). At this time there's no real good way of doing this
There's a few different ways you can check when a weapon is equipped:
  • post_inventory_application event (notably, this plugin spawns and equips all items before that event runs, so any item checks like "does this person have a shield" should be correct by this time)
  • SDKHooks Equip/Post hooks (also runs on weapon pickups)
  • Various options through DHooks
That can all be done in a separate shared plugin, if not inlined directly within the plugin that needs it; there's no special handling that would make it necessary for this plugin to have an implementation.

A native function for other plugins to identify a specific custom item from an entity is something I do intend to add in the future (likely by embedding the weapon ID through one of the supported attribute systems).
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 03-16-2021 at 07:54.
nosoop is offline