Raised This Month: $32 Target: $400
 8% 

[TF2] Custom Attributes


Post New Thread Reply   
 
Thread Tools Display Modes
Author
nosoop
Veteran Member
Join Date: Aug 2014
Plugin ID:
7147
Plugin Version:
0.3.2
Plugin Category:
Technical/Development
Plugin Game:
Team Fortress 2
Plugin Dependencies:
Servers with this Plugin:
68 
Plugin Description:
attributes++
Old 06-03-2020 , 04:51   [TF2] Custom Attributes
Reply With Quote #1

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
__________________
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; 04-01-2021 at 07:12.
nosoop is offline
Naleksuh
Member
Join Date: Dec 2018
Old 06-06-2020 , 02:30   Re: [TF2] Custom Attributes
Reply With Quote #2

is good
Naleksuh is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-13-2021 , 16:35   Re: [TF2] Custom Attributes
Reply With Quote #3

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!

Last edited by LeAlex14; 02-13-2021 at 17:55.
LeAlex14 is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 02-13-2021 , 23:01   Re: [TF2] Custom Attributes
Reply With Quote #4

Thanks!

Quote:
Originally Posted by LeAlex14 View Post
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.
__________________
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)
nosoop is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-14-2021 , 02:26   Re: [TF2] Custom Attributes
Reply With Quote #5

Quote:
Originally Posted by nosoop View Post
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 ?

Last edited by LeAlex14; 02-14-2021 at 02:32.
LeAlex14 is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 02-14-2021 , 03:04   Re: [TF2] Custom Attributes
Reply With Quote #6

Quote:
Originally Posted by LeAlex14 View Post
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).
__________________
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; 02-14-2021 at 03:07.
nosoop is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-14-2021 , 04:38   Re: [TF2] Custom Attributes
Reply With Quote #7

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 ?
LeAlex14 is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 02-14-2021 , 05:08   Re: [TF2] Custom Attributes
Reply With Quote #8

Quote:
Originally Posted by LeAlex14 View Post
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.
__________________
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)
nosoop is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 02-18-2021 , 07:50   Re: [TF2] Custom Attributes
Reply With Quote #9

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

Last edited by LeAlex14; 02-18-2021 at 07:51.
LeAlex14 is offline
LeAlex14
Member
Join Date: Jun 2020
Location: La France
Old 03-15-2021 , 15:52   Re: [TF2] Custom Attributes
Reply With Quote #10

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.

Last edited by LeAlex14; 03-16-2021 at 14:48.
LeAlex14 is offline
Reply


Thread Tools
Display Modes

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 12:25.


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