AlliedModders

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

nosoop 06-03-2020 04:51

[TF2] Custom Attributes
 
Description:
A new unified API for community-made TF2 attributes.

I started writing this two years ago because I was annoyed by the design of the attribute system in Custom Weapons.

Since then, it was put into production on the CTF2W server, and Karma Charger funded the creation of many of the attributes that he's used in recent videos (which is probably the biggest reason why people care about this; those attributes aren't in CW3 format).

It's still not quite as polished / clean as I'd personally like it to be, but since it's already out here, I might as well throw up a discussion thread for it.

There are adapter plugins that provide integrations with official weapons, Custom Weapons, and Freak Fortress 2 (and due to its flexibility, possibly more in the future!).

Installation:
Grab the core plugin, tf_custom_attributes.smx, from the releases page. The plugin currently also depends on TF2Attributes, so install that too (this links to my version; FlaminSarge's version works just as well solely for core if you have an up-to-date build).

The core plugin does nothing by itself; you'll need another plugin to write attributes to entities (and attribute plugins to read from them, of course).

Refer to this page on Applying Custom Attributes for instructions on how to use it with your choice of plugin.

Looking for attributes to play with? I've created a list of publicly available ones; if you've written any number of them yourself, you're welcome to share them by creating a new discussion for it in the project's Created Attributes catetory, or by replying to this AlliedModders thread.

For developers:
The include file should be easy enough to read. The custom attribute system only works with weapon, cosmetic, and player entities (as the core plugin takes advantage of the game's own attribute system).

There's some more information available in the Creating Custom Attributes page of the project wiki.

Source

Naleksuh 06-06-2020 02:30

Re: [TF2] Custom Attributes
 
is good

LeAlex14 02-13-2021 16:35

Re: [TF2] Custom Attributes
 
YThat was an amazing plugin, a little hard to understand for beginner but really amazing, also, i have a question.
The stock TF2CustAttr_SetString just work on player and no and bots for me, and idk if this is wanted but I can not test plugin with TF2CustAttr_SetString on bots, can you make a version compatible with bots ? Anyway, that was a great job!

nosoop 02-13-2021 23:01

Re: [TF2] Custom Attributes
 
Thanks!

Quote:

Originally Posted by LeAlex14 (Post 2736812)
The stock TF2CustAttr_SetString just work on player and no and bots for me, and idk if this is wanted but I can not test plugin with TF2CustAttr_SetString on bots, can you make a version compatible with bots ?

TF2CustAttr_SetString should work on bot entities; nothing in the code specifically blocks usage on fake clients / bots. Weapons attached to them should work as well, but that's up to the weapon granting system you use.

I just added sm_custattr_add_to and sm_custattr_add_on to the attribute debugger, so you should be able to test attributes applied to bots. sm_custattr_show also got a minor tweak so you can inspect attributes applied to targets and verify that they're there. You'll need to build the plugin yourself at this time.

LeAlex14 02-14-2021 02:26

Re: [TF2] Custom Attributes
 
Quote:

Originally Posted by nosoop (Post 2736838)
Thanks!



TF2CustAttr_SetString should work on bot entities; nothing in the code specifically blocks usage on fake clients / bots. Weapons attached to them should work as well, but that's up to the weapon granting system you use.

I just added sm_custattr_add_to and sm_custattr_add_on to the attribute debugger, so you should be able to test attributes applied to bots. sm_custattr_show also got a minor tweak so you can inspect attributes applied to targets and verify that they're there. You'll need to build the plugin yourself at this time.

I'll try that thanks! Also, I can explain you what I do, so I code a plugin for mvm call wave manager, with this plugin, client can attach condition/models/sounds/custom attributes on a bot. So, I use TF2CustAttr_SetString when the bot wasn't on the spawn (ubercharged condition) and for some reason TF2CustAttr_SetString doesn't works, also, how work sm_custattr_add_on ?

nosoop 02-14-2021 03:04

Re: [TF2] Custom Attributes
 
Quote:

Originally Posted by LeAlex14 (Post 2736843)
I'll try that thanks! Also, I can explain you what I do, so I code a plugin for mvm call wave manager, with this plugin, client can attach condition/models/sounds/custom attributes on a bot. So, I use TF2CustAttr_SetString when the bot wasn't on the spawn (ubercharged condition) and for some reason TF2CustAttr_SetString doesn't works, also, how work sm_custattr_add_on ?

In that case, make sure that both you and the game are not removing any existing game attributes on the entity after the custom attributes are applied. They're cleared after the player_spawn and post_inventory_application events are fired, so if you're attempting to attach custom attributes on players in one of those callbacks, you may need to defer applying them via RequestFrame.

It sounds like you're attaching them at a different point in time though, and I'm not entirely familiar with how MvM works at the code level. You may need to tinker a bit more with when you call TF2CustAttr_SetString.

Try using TF2Attrib_SetByName on the player entity at same time - if that also gets cleared then it's definitely getting wiped by the game (or a different plugin); if it doesn't, then my assumptions are out.

The sm_custattr_add_on is an admin command, so you can run sm_custattr_add_on @bots <name> <value> to apply a custom attribute to all bots for testing and seeing when you can apply it. You'll want to verify that the custom attribute is actually applied to your bots using sm_custattr_show <player> as well (the latter only takes a single target though).

LeAlex14 02-14-2021 04:38

Re: [TF2] Custom Attributes
 
Really weird, nothing seems to work for bot, can I send you the plugin (it's just a test, the code wasn't really clean) in mp ?

nosoop 02-14-2021 05:08

Re: [TF2] Custom Attributes
 
Quote:

Originally Posted by LeAlex14 (Post 2736850)
Really weird, nothing seems to work for bot, can I send you the plugin (it's just a test, the code wasn't really clean) in mp ?

Sure; send a forum PM. I do have some other things to work on so I can't guarantee I'll reach it quickly, but will look into it when I can.

LeAlex14 02-18-2021 07:50

Re: [TF2] Custom Attributes
 
Ok so that was my first package for Custom Attribute!

Can be update so check that!

Added:
  1. BlackHole Projectiles for all projectiles, an adaptation on your first release
  2. Change projectiles, you can change all projectiles, so sniper and scout can throw spell with jarate and mad milk
  3. Homing Projectiles, already existing but that was just with one projectile

LeAlex14 03-15-2021 15:52

Re: [TF2] Custom Attributes
 
Hey ! It's me again, all works fine, I just have some issues with canteen. I don't see any function for remove attribute, but that can be possible ?
Nevermind, that works with tf2 atteibute remover.


All times are GMT -4. The time now is 23:50.

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