Last active
December 17, 2022 05:37
-
-
Save NanoAi/eba7c13c096144633a75018b0e5980a6 to your computer and use it in GitHub Desktop.
A simple vscript for finding and editing weapons based on their Item Definition in TF2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function processWeapon( weapon ) { | |
//ref: https://wiki.alliedmods.net/Team_fortress_2_item_definition_indexes | |
//ref: https://wiki.teamfortress.com/wiki/List_of_item_attributes | |
local itemIndex = NetProps.GetPropInt(weapon, "m_AttributeManager.m_Item.m_iItemDefinitionIndex"); | |
if ( itemIndex == 40 ) { | |
weapon.AddAttribute("airblast cost decreased", 0.4, -1) | |
} | |
} | |
function OnGameEvent_post_inventory_application(p) { | |
local ply = GetPlayerFromUserID(p.userid) | |
if ( !ply ) { return; } | |
for ( local i = 0; i < 7; i++ ) { | |
local wep = NetProps.GetPropEntityArray(ply, "m_hMyWeapons", i) | |
if ( wep != null ) { | |
processWeapon(wep) | |
} | |
} | |
} | |
__CollectGameEventCallbacks(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment