Weapons & Perks - 505e06b2/MW2-GSC-Documentation GitHub Wiki
Useful links:
- https://wiki.zeroy.com/index.php?title=Call_of_Duty_4:_Scripting_Reference_-_Player
- https://github.com/shit-ware/IW4/blob/master/maps/mp/gametypes/_weapons.gsc
- https://github.com/shit-ware/IW4/blob/master/maps/mp/gametypes/_class.gsc
- https://github.com/Flo122/Mw2/blob/master/AwesomeMod/Cleane%20Mod-Files/maps/mp/gametypes/_weapons.gsc
- https://github.com/Flo122/Mw2/blob/master/AwesomeMod/Cleane%20Mod-Files/maps/mp/gametypes/_class.gsc
Return the weapon with attachments as a string ending in _mp
invalid_attachments = buildWeaponName("scar", "reflex", "eotech"); //will be invalid since they use the same slot - no attachments will be added when given
one_attachments = buildWeaponName("m4", "reflex", "none"); //will only have red-dot
two_attachments = buildWeaponName("famas", "reflex", "gl"); //red-dot and grenade launcher
no_attachments = "fn2000_mp"; //just put _mp after the base name to get the full name
player giveWeapon(two_attachments); //given the famas + red-dot + grenade launcher
Include: maps\mp\gametypes\_class
Give the player the specified perk or equipment - giving certain equipment after spawning may not always work
//self givePerk("specialty_fastreload"); //including the related file may cause namespace conflicts - in the original source, the methods below seem preferred
self maps\mp\perks\_perks::givePerk("throwingknife_mp"); //throwing knife
self maps\mp\perks\_perks::givePerk("specialty_fastreload"); //sleight of hand
Include: maps\mp\perks\_perks
Add the specified weapon to the player's inventory
player giveWeapon("deserteaglegold_mp");
player giveWeapon("scar_reflex_mp", 3); //scar-h with red-dot and arctic camo
player giveWeapon("m4_mp", int(tableLookup("mp/camoTable.csv", 1, "red_tiger", 0)) ); //m4a1 with red tiger
player giveWeapon("m79_mp", 0, true); //thumper akimbo
Take the specified weapon from the player's inventory
player takeWeapon("deserteaglegold_mp");
Take all weapons from the player (leaving them with nothing in their hands)
player takeAllWeapons();
Force a weapon from the player's inventory into their hands
player switchToWeapon("deserteaglegold_mp");
Return the currently held weapon as a string
weapon_name = player getCurrentWeapon();
Return the current, non-temporary (killstreak), weapons as an array
weapons_in_inventory = player getWeaponsListPrimaries();
Give the player the max ammo stock for the specified weapon
player giveMaxAmmo("deserteaglegold_mp");
Give the player the default ammo stock for the specified weapon
player giveStartAmmo("deserteaglegold_mp");
Return the remaining clip in the specified weapon as an integer
shots_before_reload = player getWeaponAmmoClip("deserteaglegold_mp");
Set the current clip size for the weapon
player setWeaponAmmoClip("deserteaglegold_mp", 1);
Set the current ammo stock size for the weapon
player setWeaponAmmoStock("deserteaglegold_mp", 9999);
Return the remaining ammo for the specified weapon as an integer
ammo_left = player getWeaponAmmoStock("deserteaglegold_mp");
Return the remaining ammo for the specified weapon as an integer
ammo_left = player getWeaponAmmoStock("deserteaglegold_mp");