Resource icon

[VScript] give_tf_weapon GTFW is now Retired

  • Trying to get it compatible with MvM / upgrade stations.
    • Added variable CVAR_GTFW_OVERWRITE_WEAPONS under _master.nut
      • true by default
      • true = weapon in slot is deleted before making the new weapon (via GiveWeapon)
      • false = weapon in slot is not deleted. Instead, the item definition index is changed so the weapon can store upgrades from upgrade stations. It supports custom weapons, too!
        • (it's recommended to reset the stats by using this code:
        • NetProps.SetPropBool(handle hWeapon, "m_AttributeManager.m_Item.m_bOnlyIterateItemViewAttributes", true)
  • Fixed CTFPlayer.SwitchToActive(wep)
  • Added ficool2 fix for handling spy watches

Attachments

  • mvm_aeon_a17_1.png
    mvm_aeon_a17_1.png
    895.8 KB · Views: 138
  • Updates tables.nut
    • Removed all ID2's from every weapon entry that had null in them.
    • Made any unique stock weapon into it's own entry. Each stock weapon is another entry named "Unique <weapon>".
      • Some promos were also made into another entry (Vintage Lugermorph, Genuine Huo-Long Heater, etc)
    • Removed Festives class (removed bc it was a dupe)
      • Moved all entries into TF_WEAPONS class + TF_WEAPONS_ALL array
    • Fixed "Grappling Hook" having an extra space in classname, causing giving the weapon to fail.
  • Updated code.nut to reflect above changes.
  • Added support for tf_bots using this script (thanks Mr.Burguers)
  • Added descriptions in tables.nut
  • Fixed Liberty Launcher saying it had 60 ammo reserve
  • Fixed Quickiebomb Launcher saying it had 72 reserve ammo
  • Fixed weapon's ammo reserve multiplying if weapon had an ammo reserve bonus (i.e. Rocket Jumper)
  • Fixed clip size attributes not applying correctly
REORGANIZED PARAMETERS OF RegisterCustomWeapon() and RegisterCustomWeaponEx()!
  • New param order for RegisterCustomWeapon():
( item_name, baseitem, use_original_stats, stats_function, custom_arms_model, custom_weapon_model )​
  1. Added: use_original_stats = bool. If true, uses the original stats of the weapon. If false, wipes it clean (as if stock) so new stats can be applied.
  2. Removed: extra_custom_wearable. It's now only in the Ex version.
  3. Swapped: custom_arms_model and custom_weapon_model
  • New param order for RegisterCustomWeaponEx():
( item_name, baseitem, use_original_stats, stats_function, custom_arms_model, custom_weapon_worldmodel, custom_weapon_viewmodel, custom_extra_wearable, ammotype, clipsize, ammoreserve)
  • Basically same as above but with the extra things tacked on to the end.

Rest of the 3.0 Update
  • Fixed bug where all given weapons don't have new stats.
    • Seems setting the following netprop to 1 does this:
      • m_AttributeManager.m_Item.m_bOnlyIterateItemViewAttributes
  • Fixed all Spy's watches not using correct animations
  • Added another tutorial "custom_weapons.nut"
  • Fixed some things throwing "Instance does not exist" when switching weapons
  • Moved all files into a folder! And added a "master" file.
    • Folder is /give_tf_weapon/
    • Execute _master.nut to get the script running!
  • Added a readme.
  • Fixed Pyro's Hottest Hand throwing errors when dying.
  • Fixed any custom weapon throwing errors when dying.
  • Updated CTFPlayer.SwitchToActive(weapon)
    • Finds the best weapon to switch to and switches to it.
    • If null, switches to the any valid gun, or if no gun is found, switches to melee, or else, any.
  • Added more error checks
  • Custom/Unintended weapons for classes now set by netprop m_iItemIDHigh
    • If m_iItemIDHigh bit 5 set, it's unintended for the class.
    • If m_iItemIDHigh bit 6 set, it's a custom weapon.
  • Turned off CVAR_GTFW_USE_GLOBAL_ERROR_MESSAGES because I forgot to turn it off
  • Added CTFPlayer.CreateArmsModel(arms_model)
    • Experimental. Overwrites the arms model for the class with another set of arms.
      • NOTE: When used, it adds an ent (tf_weapon_vm) per weapon on the player.
      • Needs to be set every time the class touches the resupply, else weapons in VM will be invisible.
  • Fixes DeleteWeapon, DisableWeapon, EnableWeapon from finding classnames instead of ItemIDs.
    • No more DeleteWeapon("Rocket Jumper") deleting all rocket launchers.
  • Added a way to set custom weapon view model for custom weapons. (Requested by @ImNotSimon )
    • Set it using RegisterCustomWeaponEx()
    • The weapon model parameters will copy over to one another if the other is blank.
    • For example, if world model isn't set, but viewmodel is, it'll use the viewmodel for both world model and view model. Works vice-versa.
  • Fixed Scout's Bat being an invalid index for GiveWeapon/ReturnWeaponTable
  • Got rid of all instances of table PlayerLoadOutGlobal_ClassArms.
    • The table was for setting class arms for the player's main view model, but it is unneeded now that SetCustomViewModel() exists.
    • This should fix any type of "instance doesn't exist" errors when switching weapons.
  • Fixed custom arms model not working if it was the only parameter in RegisterCustomWeapon().
  • Added extra check in viewmodel think script, to prevent an error.
  • Reverted previous v_model/w_model change in 2.3 because it broke all unintended weapon viewmodels
  • Fixed bug where using GiveWeapon would bug the draw animation when switching to it for the first time.
  • Added support for all-class shotgun.
    • Medic, Spy, and Scout use shotgun in primary
    • the rest use it in secondary
    • Use "Soldier Shotgun" or similar to give specific shotgun types/arm models
  • Added support for all-class pistol.
    • All classes outside Engineer use 36 ammo reserve
  • Set CVAR_GTFW_USE_GLOBAL_ERROR_MESSAGES to False by default
  • Fixed Short Circuit not giving metal when given through GiveWeapon().
  • Fixed Short Circuit not updating arm model in first person.
  • Fixed "Engineer Shotgun" not using correct ammo type if given by GiveWeapon().
  • If a custom weapon stats function runs, it automatically runs ReapplyProvision() after the function finishes.
    • ReapplyProvision() applies attributes to the player after being added to the weapon.

Attachments

  • 11.png
    11.png
    1.9 MB · Views: 92
  • 12.png
    12.png
    1.9 MB · Views: 82
  • 13.png
    13.png
    1.9 MB · Views: 78
  • 14.png
    14.png
    1.9 MB · Views: 82