View Full Version : Change stats on all weapons of a certain type
If I want to change the damage on -all- syringe guns, how would I go about it? What about other variables/attributes?
-bump-
Trying to help out a friend with a custom weapon mod he's putting together, would really appreciate the assistance. :)
Game?
If tf2, use TF2Attributes to change different attributes(ammo, health, damage amount)
If not, use SDKHooks
TF2
If I use TF2Attributes, don't I have to modify every weapon individually? Instead of being able to do a "type" of weapon?
You can check the weapon class using GetEntityClassname. There's no consistent way to do all sorts of attribute changes for a specific weapon class.
#include <tf2_stocks>
#include <tf2attributes>
public void OnPluginStart() {
HookEvent("post_inventory_application", OnInventoryApplied);
}
public void OnInventoryApplied(Event event, const char[] name, bool dontBroadcast) {
int client = GetClientOfUserId(event.GetInt("userid"));
int hWeapon = GetPlayerWeaponSlot(client, TFWeaponSlot_Primary);
if (IsSyringeGun(hWeapon)) {
// apply damage modifier attribute here, will probably override existing damage modifiers
}
}
bool IsSyringeGun(int hWeapon) {
char weaponClass[32];
return GetEntityClassname(hWeapon, weaponClass, sizeof(weaponClass)) && StrEquals(weaponClass, "tf_weapon_syringegun_medic");
}
// or you can scale damage by hooking OnTakeDamage and checking the source of the attack in some way, I don't know how syringe guns and their projectiles handle it off the top of my head
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.