New functions
- CTFPlayer.AnnounceWeapon( weapon , int quality , string/int prefix , string has_string)
- Display in chat a weapon a player has found!
- weapon can be a handle, item definition index, string name, slot number (in negative), or classname. Just as long as the weapon is registered and has a valid display name, it's good!
- quality is from a pre-made list (documented in the function), OR it can be a unicode for color. ( Valve Dev Community on VScript ClientPrint )
- Examples
- GetListenServerHost().AnnounceWeapon("Horsemann's Hex")
- hPlayer.AnnounceWeapon("Natascha", 10)
- hPlayer.AnnounceWeapon("Toolbox", 9, "VSCRIPT-MADE")
- hPlayer.AnnounceWeapon("Medigun", 8, 18, "has stolen:")
Persisting Weapons
You can now keep your custom VScript weapons after touching resupply!
Note: Make sure to update your
post_inventory_application event to include the
GTFW_LoadLoadout function.
Note: Weapons don't save automatically. MUST run
GTFW_SaveLoadout( weapon ) after you collect a weapon.
- CTFPlayer.GTFW_SaveLoadout( weapon , int tfclass)
- Note: If no parameters set, saves ALL items in loadout (even non-vscript weapons!)
- CTFPlayer.GTFW_LoadLoadout( weapon, int tfclass )
- CTFPlayer.GTFW_DeleteLoadout( weapon, int tfclass )
- GTFW_DeleteAllLoadouts()
"
weapon" an optional parameter. So is "
tfclass".
If both are is not included, it'll run the loadout for the player's current TFClass.
If "
weapon" is included ( same parameter framework as ReturnWeapon() ) you can save a specific weapon to the player's loadout.
If
"tfclass" is included, it'll specifically save for that TFclass on the player.
Full changelog for 4.0.0
- Fixed bug with tf_weapon_builder not updating arms when placing a building
- Added feature to send in item definition index when creating an extra wearable item (i.e. buff banner backpack replacement, medi pack replacement, etc).
- Fixed extra wearables being invisible in third person due to not being initialized
- Fixed extra wearables using netprop "m_hExtraWearable", which was already used for custom weapons
- GiveWeapon(): Actually fixed stats function override from 3.3.2
- Added weapons that persist between resupply. This loadout can be loaded at any time using function "CTFPlayer.GTFW_LoadLoadout()"
- Can now find get weapon string names via table (via table.name)
- Can announce weapons found in chat
- code.nut: Added framework to use slots for GiveWeapon, RegisterCustomWeapon
- Use enum TF_WEAPONSLOTS (PRIMARY, SECONDARY, MELEE, SLOT3, SLOT4, SLOT5, SLOT6)
- Can also use classnames too
- tables.nut: Fixed Quick-Fix itemID being 441 (meant to be 411)
- Changed how GiveWeapon() gives weapons to player
- Should be able to update loadouts faster
- _master.nut: Cvar name changed for clarification: CVAR_GTFW_OVERWRITE_WEAPONS -> CVAR_GTFW_GIVEWEAPON_UPDATE_WEP_IDX_ONLY
- Ammo fixes
- Split AmmoFix code into its own function, CTFPlayer.UpdateAmmoFix()
- Fixed bugs where ammo reserve cap wouldn't update correctly between weapons/classes (example, Huntsman -> Minigun)
- Added version number in _master.nut
- And fixed a lot of miscellaneous bugs
- And simplified code here and there