Template:BasicCS2Weapon: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "<onlyinclude>{{BasicCSseriesWeapon|{{{1|{{str index|{{ROOTPAGENAME}}|8}}}}}|css=0|csgo=0|cs2=1}}</onlyinclude>")
 
No edit summary
 
Line 1: Line 1:
<onlyinclude>{{BasicCSseriesWeapon|{{{1|{{str index|{{ROOTPAGENAME}}|8}}}}}|css=0|csgo=0|cs2=1}}</onlyinclude>
<onlyinclude>
== KeyValues ==
{{minititle|CS2 Weapon}}
{{KV|Is this weapon allowed to be picked up?|intn=CanBePickedUp|boolean|Determines if players are able to pick up the weapon.}}
 
== Flags ==
{{fl|1|Start Constrained|Prevents the model from moving.}}
{{fl|2|Deny Player Pickup|Prevents player from being able to pick up the weapon.|nofgd=1}}
 
== Inputs ==
{{minititle|CS2 Weapon}}
{{i|SetAmmoAmount|param=integer|For guns, sets the number of bullets in the active magazine. Does nothing for grenades. Behaves like <tt>SetClipPrimary</tt>.}}
{{i|SetReserveAmmoAmount|param=integer|For guns, sets the number of bullets in reserve for reloading, clamping at the weapon's maximum (e.g. 90 for the [[weapon_ak47]]).<br>For grenades, sets their count, clamping at the current maximum depending on the convars <tt>ammo_grenade_limit_*</tt>; When setting to 0 or below while holding the grenade, the player no longer owns any, but the viewmodel stays. Negative values are clamped to 0 for guns.<!--Behaves like <tt>SetClipSecondary</tt>.-->}}
{{i|ToggleCanBePickedUp|param=boolean|Toggles whether the weapon can be picked up by players. Visually, nothing changes and there is no event if picking up fails. Hover texts like ''"[E] Swap for AK-47"'' remain in both cases.}}
{{i|SetClipPrimary|param=int|For guns, sets the number of bullets in the active magazine, clamping between 0 and its clip size; When setting to 0, the owner may start reloading automatically.<br>Does nothing for grenades.}}
{{i|SetClipSecondary|param=int|<!--For guns, sets the number of bullets in reserve, clamping between 0 and its clip size. For grenades, sets their count, clamping between 0 and the current maximum; When setting to 0, the viewmodel stays but no grenade can be thrown.-->{{bug|Does nothing. Use <tt>SetReserveAmmoAmount</tt> instead.}}}}
 
== Outputs ==
{{minititle|CS2 Weapon}}
{{o|OnPlayerUse|Fires when a player [[+use]]s this weapon {{PlAct}}. Does not fire if the weapon is picked up successfully.}}
{{o|OnPlayerPickup|Fires when a player picks this weapon up {{PlAct}}.}}
 
<includeonly>
[[Category:Weapons|{{{1|{{ROOTPAGENAME}}}}}]]
[[Category:Counter-Strike 2 entities]]
[[Category:Counter-Strike 2 weapons|{{{1|{{ROOTPAGENAME}}}}}]]
</includeonly></onlyinclude>

Latest revision as of 15:45, 5 April 2025

KeyValues

CS2 Weapon:

Is this weapon allowed to be picked up? (CanBePickedUp) <boolean>
Determines if players are able to pick up the weapon.

Flags

Start Constrained : [1]
Prevents the model from moving.
Deny Player Pickup : [2] !FGD
Prevents player from being able to pick up the weapon.

Inputs

CS2 Weapon:

SetAmmoAmount <integer>
For guns, sets the number of bullets in the active magazine. Does nothing for grenades. Behaves like SetClipPrimary.
SetReserveAmmoAmount <integer>
For guns, sets the number of bullets in reserve for reloading, clamping at the weapon's maximum (e.g. 90 for the weapon_ak47).
For grenades, sets their count, clamping at the current maximum depending on the convars ammo_grenade_limit_*; When setting to 0 or below while holding the grenade, the player no longer owns any, but the viewmodel stays. Negative values are clamped to 0 for guns.
ToggleCanBePickedUp <boolean>
Toggles whether the weapon can be picked up by players. Visually, nothing changes and there is no event if picking up fails. Hover texts like "[E] Swap for AK-47" remain in both cases.
SetClipPrimary <integer>
For guns, sets the number of bullets in the active magazine, clamping between 0 and its clip size; When setting to 0, the owner may start reloading automatically.
Does nothing for grenades.
SetClipSecondary <integer>
Icon-Bug.pngBug:Does nothing. Use SetReserveAmmoAmount instead.  [todo tested in ?]

Outputs

CS2 Weapon:

OnPlayerUse
Fires when a player +uses this weapon (!activator is the player.). Does not fire if the weapon is picked up successfully.
OnPlayerPickup
Fires when a player picks this weapon up (!activator is the player.).