GSC reference › Built-in
SwitchToWeaponImmediate()
Built-in (engine)
Server
Player Called on: player
Switch to a different weapon or cycle weapons if no weapon is given without playing the dropping animation for current weapon
Signature
<player> SwitchToWeaponImmediate([weapon object])
Called on an entity: player SwitchToWeaponImmediate(...)
Parameters
| Name | Required? | Details |
|---|---|---|
| weapon object | Optional | The weapon to switch to |
Example (from Treyarch's docs)
level.player SwitchToWeaponImmediate( weapon )
Real uses in BO3's scripts
Called 33 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm_laststand.gsc, line 326
self switchtoweaponimmediate(); - scripts/zm/_zm_melee_weapon.gsc, line 283
self switchtoweaponimmediate(fallback_weapon); - scripts/zm/_zm_weap_ball.gsc, line 463
player switchtoweaponimmediate(ball); - scripts/zm/_zm_weap_controllable_spider.gsc, line 132
self switchtoweaponimmediate(w_previous); - scripts/zm/_zm_weap_riotshield.gsc, line 689
self switchtoweaponimmediate();
Related built-ins
- 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
- DisableOffhandWeapons()Disable the player's offhand weapons
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).