GSC reference › Built-in
AttachWeapon()
Built-in (engine)
Client
Called on: entity
Attaches a weapon to the entity.
Signature
<entity> AttachWeapon(<weapon>, [renderoptions], [acvi])
Called on an entity: entity AttachWeapon(...)
Parameters
| Name | Required? | Details |
|---|---|---|
| weapon | Required | The weapon to attach. |
| renderoptions | Optional | The render options for the weapon |
| acvi | Optional | The attachment cosmetic variations |
Example (from Treyarch's docs)
self AttachWeapon( weapon )
Real uses in BO3's scripts
Called 6 times in the decompiled scripts. A few, zombies first:
- scripts/shared/_character_customization.csc, line 1294
data_struct.charactermodel attachweapon(data_struct.showcaseweaponmodel, data_struct.weaponrenderoptions, data_struct.acvi); - scripts/shared/end_game_taunts.csc, line 471
charactermodel attachweapon(level.weaponnone); - scripts/shared/end_game_taunts.csc, line 494
charactermodel attachweapon(charactermodel.showcaseweapon, charactermodel.showcaseweaponrenderoptions, charactermodel.showcaseweaponacvi); - scripts/shared/end_game_taunts.csc, line 499
charactermodel attachweapon(charactermodel.showcaseweapon); - scripts/mp/_end_game_flow.csc, line 118
charactermodel attachweapon(weapon_right["weapon"]);
Related built-ins
- GetWeapon()Get the requested weapon object based on game mode agnostic weapon name string
- GetCurrentWeapon()Gets the current player weapon
- GiveWeapon()Give a weapon to the player
- HasWeapon()Returns true if the player has the given weapon
- TakeWeapon()Take the weapon
- SwitchToWeapon()Switch to a different weapon or cycle weapons if no weapon is given
- SetWeaponAmmoClip()Set the weapon's ammo
- GetWeaponsListPrimaries()
- GetWeaponAmmoClip()Get the weapon's ammo count in clip
- SetWeaponAmmoStock()Set the weapon's ammo
- GetWeaponsList()Gets an array of all weapons that the player has.
- GetWeaponAmmoStock()Get the weapon's total ammo count
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).