AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2] Custom Weapons X (https://forums.alliedmods.net/showthread.php?t=331273)

nosoop 03-13-2021 05:15

[TF2] Custom Weapons X
 
⚠️ This is currently a preview. While I consider the core of it usable, there's still some additional QoL things that need work. ⚠️

Description:
New weapons in TF2? Want to BYOHU (Bring Your Own Heavy Update)?

Introducing Custom Weapons X, because this plugin has ascended past the concept of numbers and 23 of the 26 letters in the English alphabet.

It's lightyears ahead to the point where it's not backwards compatible with just about anything from Custom Weapons 2 or Custom Weapons 3. I figured a total overhaul of the design was due, after gaining a ton of experience working with existing Custom Weapons iterations and with how the game itself operates.

In exchange for having to start over, it provides support for dropped weapons and not blowing up your buildings because the game wants you to have your own weapon and not the plugin's.

While yes, CW3 attributes aren't compatible with this plugin, it does support the Custom Attributes framework in addition to the game's native attributes, so there's a number of attributes available for item designers to play with, and developers can of course create new ones.

If you'd like things ported from one of the old CW* formats, I am also open for paid inquiries. Send me a forum PM if you're interested.

Usage:
For people that play the video games:
  • Saying /cwx brings up the menu, allowing you to pick a custom item for your current class.
  • /c, /cus, and /custom are also supported, but will only be processed by CWX if CW3 isn't running.
For the server operators:
  • You can run this alongside any of your existing Custom Weapons plugins. I wouldn't recommend doing this in production as they'll try to equip over each other, but otherwise they effectively exist separately.
  • sm_cwx_equip <uid> equips the specified custom item on yourself. This bypasses the equip menu, allowing you to apply custom items that aren't normally compatible for the class you're playing as.
  • sm_cwx_equip_target <target> <uid> equips the specified custom item on the player matching the given target string. Again, bypasses the menu.
  • sm_cwx_export exports your currently equipped item to a file, allowing for a WYSIWYG approach.
  • There's an example of a weapon config in the configs/ directory of the repository. There's also a slightly more thorough instructional guide on creating a weapon config here.
For developers:
  • Attributes can be implemented using either native attributes or the Custom Attribute Framework.
  • The plugin API for CWX is in the works. API design is hard
More information is provided in the project wiki.

Installation:
Installation instructions are provided in the project repository.
The plugin currently has no "stable" build, but rolling releases are available. While I do try and test to avoid builds that are completely unstable, some bugs may occasionally slip through the cracks; please report any you come across if they can be reproduced in the latest release.

Releases / Source

Naleksuh 03-13-2021 13:03

Re: [TF2] Custom Weapons X (preview)
 
This is really interesting and resolves a lot of issues with previous versions...especially dropping all your weapons when you touch a resupply...I hated that.

Any plans for taking the plugin in the direction of SQL based weapon storage, events for addition/removal, and a custom weapons MOTD?

nosoop 03-13-2021 13:39

Re: [TF2] Custom Weapons X (preview)
 
Quote:

Originally Posted by Naleksuh (Post 2740329)
This is really interesting and resolves a lot of issues with previous versions...especially dropping all your weapons when you touch a resupply...I hated that.

Any plans for taking the plugin in the direction of SQL based weapon storage, events for addition/removal, and a custom weapons MOTD?

The custom item schema will remain file-based for the time being since it's easier for the average server operator to work with, though the plan is to parse it out into an enum struct internal representation instead of scanning over KeyValues. Maybe a separate plugin can handle schema updates and install item updates dynamically.

Letting other plugins update loadouts is an idea in the design process; probably won't be working on a web frontend for it myself.

There are no plans for weapon addition / removal events, if that's what you're asking (attribute-related events are outside of scope). Still working on the API design, but I think most things can be handled without it.

Naleksuh 03-14-2021 03:58

Re: [TF2] Custom Weapons X (preview)
 
"There are no plans for weapon addition / removal events, if that's what you're asking (attribute-related events are outside of scope). Still working on the API design, but I think most things can be handled without it. "

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

nosoop 03-16-2021 04:14

Re: [TF2] Custom Weapons X (preview)
 
Quote:

Originally Posted by Naleksuh (Post 2740409)
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).

BlazingDiancie 04-07-2021 15:19

Re: [TF2] Custom Weapons X (preview)
 
Loving this plugin already. Feels much more efficient and lightweight than CW3, and a lot less subtly buggy. I'm assuming all the stuff CW3 could do like custom log names and sound replacements will be added in due time. Can't wait to see where this goes. I'll keep you posted on GitHub if I find any issues.

nosoop 12-27-2021 12:47

Re: [TF2] Custom Weapons X (preview)
 
Quote:

Originally Posted by nosoop (Post 2740279)
It's lightyears ahead to the point where it's not backwards compatible with just about anything from Custom Weapons 2 or Custom Weapons 3. [...]

While yes, CW3 attributes aren't compatible with this plugin [...]

So, that was a lie. I've written a plugin that should allow well-behaved CW3 plugins to work with CWX. Happy holidays.

CW2 probably won't happen since they don't support removal of attributes.

Anyways, progress is going. If you'd like to see some specific functionality within the project, please do file issues.

Pony_Phreak 02-16-2022 21:43

Re: [TF2] Custom Weapons X (preview)
 
I've been toying with this plugin a bit and have noticed a recurring error- Wearable items are duplicating their effects-- epically after respawn or on hitting supply lockers., so a +25hp turns into +50. Inspecting another player with the item will always show the intended "+25" though.

what makes their even weirder, is they always happen on certain players and not others.

Either way, this has consistently happened on wearable, but not weapons. I'll put one of the wearable's code here so you can take a peek and see if I'm making a mistake, before ya consider bug-hunting. maybe you can point out something I'm doing wrong


Code:

    //Sniper SMG Pack
    "{a9f81fa5-4edb-4601-858a-fd0d4d177cf6}"
        {
                "name"                "The Blitzing Bersagliere"
                "inherits"                "The Cozy Camper"
                "item_class"        "tf_wearable"
        "used_by_classes"
                {
                        "sniper" "primary"
                }
        "keep_static_attrs"                "0"
                "attributes_game"
                {
                "max health additive bonus"                "25"
                        "maxammo secondary increased"        "2.5"
                }
        "attributes_custom"
                {
                "mod crit type on target condition"                "condition=25 crit_type=1"
                }

        }


nosoop 02-17-2022 00:01

Re: [TF2] Custom Weapons X (preview)
 
Quote:

Originally Posted by Pony_Phreak (Post 2771667)
I've been toying with this plugin a bit and have noticed a recurring error- Wearable items are duplicating their effects-- epically after respawn or on hitting supply lockers., so a +25hp turns into +50. Inspecting another player with the item will always show the intended "+25" though.

what makes their even weirder, is they always happen on certain players and not others.

Either way, this has consistently happened on wearable, but not weapons. I'll put one of the wearable's code here so you can take a peek and see if I'm making a mistake, before ya consider bug-hunting. maybe you can point out something I'm doing wrong

What's happening here is that you've specified a wearable that normally occupies the secondary loadout slot as a primary slot item; because of how persistence is handled, that sort of thing is currently unsupported.

It's actually covered under this issue, which was deemed a wontfix at the time.

There's an improvement to item persistence that I've been meaning to test so that weapons not intended for the class aren't discarded on resupply; it might also work to apply wearables in slots they are normally not suitable for. I've gone ahead and pushed those changes; download the newest build and let me know how it goes.

Pony_Phreak 02-18-2022 00:55

Re: [TF2] Custom Weapons X (preview)
 
Quote:

Originally Posted by nosoop (Post 2771672)
There's an improvement to item persistence that I've been meaning to test so that weapons not intended for the class aren't discarded on resupply; it might also work to apply wearables in slots they are normally not suitable for. I've gone ahead and pushed those changes; download the newest build and let me know how it goes.

I know its only about a day since the latest release, but so far so good. No one reported anything funny, and I never saw anything out of the ordinary after this update. looks like you fixed it. Thanks.


All times are GMT -4. The time now is 22:12.

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