|
1 | 1 | # tf2attributes |
| 2 | + |
2 | 3 | TF2Attributes SourceMod plugin |
3 | 4 |
|
4 | 5 | https://forums.alliedmods.net/showthread.php?t=210221 |
| 6 | + |
| 7 | +## Differences from FlaminSarge's upstream |
| 8 | + |
| 9 | +This fork provides the following new functionality: |
| 10 | + |
| 11 | +Add / remove temporary attributes on the player (using the game's own time-based expiry |
| 12 | +mechanism for it). |
| 13 | + |
| 14 | +```sourcepawn |
| 15 | +// replicates the temporary health bonus granted by the Dalokohs Bar: |
| 16 | +TF2Attrib_AddCustomPlayerAttribute(client, "hidden maxhealth non buffed", 50.0, 30.0); |
| 17 | +``` |
| 18 | + |
| 19 | +Adds the game's "attribute hook" mechanism that collates values using an attribute class: |
| 20 | + |
| 21 | +```sourcepawn |
| 22 | +// computes the final damage multiplier based on the given item and owner's attributes: |
| 23 | +float damageBonus = TF2Attrib_HookValueFloat(1.0, "mult_dmg", weapon); |
| 24 | +``` |
| 25 | + |
| 26 | +Support for setting / getting attribute values via strings: |
| 27 | + |
| 28 | +```sourcepawn |
| 29 | +// set an entity's custom projectile model: |
| 30 | +TF2Attrib_SetFromStringValue(entity, "custom projectile model", "models/weapons/c_models/c_grenadelauncher/c_grenadelauncher.mdl"); |
| 31 | +
|
| 32 | +// get the name from an item: |
| 33 | +TF2Attrib_HookValueString("NO NAME", "custom_name_attr", entity, buffer, sizeof(buffer)); |
| 34 | +``` |
| 35 | + |
| 36 | +Setting custom names / descriptions is not possible. String values that are set by this plugin |
| 37 | +are not replicated to the client — this is fine for attributes that are only accessed on |
| 38 | +the server, but if you set any that the client will read, the client will crash on access. |
| 39 | + |
| 40 | +## Installing or migrating |
| 41 | + |
| 42 | +This fork is forward compatible with FlaminSarge/tf2attributes — all plugins compiled for |
| 43 | +their version should continue to work with this one. The installation instructions remain the |
| 44 | +same. |
| 45 | + |
| 46 | +1. Copy `tf2attributes.smx` to `addons/sourcemod/plugins/`. |
| 47 | +2. Copy `tf2.attributes.txt` to `addons/sourcemod/gamedata/`. |
| 48 | +3. If you're a developer, copy `tf2attributes.inc` to `addons/sourcemod/scripting/include/` |
| 49 | +(or the appropriate path for your compiler toolchain / project). |
0 commit comments