Tutorial: Equipping Weapons in CS Last edited 5 years ago2018-06-11 07:24:32 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

This article was converted from a previous version of TWHL and may need to be reviewed

  1. The formatting may be incorrect due to differences in the WikiCode processing engine, it needs to be revised and reformatted
  2. Some information may be out of date
  3. After the article is re-formatted and updated, remove this notice and the Review Required category.
  4. Some older tutorials are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.

Stripping and Equipping Weapons in Counter-Strike

Resources Required: Up to date FGD, found here.
User posted image

Introduction

The premise is simple: to equip weapons at the start of a round or by trigger later in the round and to make sure they can only use those weapons if you so desire. Actually putting this concept into a playable level involves some minor entity work, so if you are unfamiliar with the multi_manager, game_playerequip, player_weaponstrip, and the info_map_parameters, then read the brief description's below.

Note: Tutorials covering and full descriptions of all these entities can be found on this site, and require virtually no hunting, and limited knowledge of HL to understand their principles and properties.

multi_manager`: An entity that allows you to trigger multiple events/entities after a single previous event has taken place. For example, the door opens, triggers the `multi_manager, the multi_manager triggers an alarm ( ambient_generic ), and a flashing light, then after 10 seconds it triggers another 'multi_manager' to turn everything off again.

game_player_equip`: The entity used to equip the player with the weapons you require. For example, the player runs through a trigger, which runs the `game_player_equip which "gives" the player ammo, Kevlar, grenades or a gun.

`player_weaponstrip`: The player runs through a trigger, targeting this entity, removing all weapons/items currently in the player's possession.

`info_map_parameters`: An entity which allows you to set certain parameters within the map, such as weapon buying, and bomb blast radius etc. Quite a limited entity and only mentioned here as an example of different methods of achieving the same goal.

Making a Map Where Everyone Gets the Same Equipment

First things first, make your map, if you're just testing out the entity setup it can be a big open room. If not, please put some effort into it. game_player_equip is typically used for fy, aim, and knife maps. However, just because you want to give players certain weapons doesn't mean the map must be of the fy_ strain, you could be making an escape style map, where the CTs start in a jail, and are only equipped with a knife and Glock (or whatever takes your fancy). Perhaps a scout map set in a "forest", with two bases, separated by a canyon. The possibilities are endless.

If you are equipping everyone on the map with the same weapons, all you need is a game_player_equip in the map. Choose what you wish to equip in the entity, make sure the "use only" flag is NOT ticked, click apply, and it's all set. If you have the latest FGD installed then all the keyvalues will be very clearly labeled. Note that merely having a game_player_equip present on the map will cause all players to spawn with nothing (except for the bomb if there are bomb targets). This is true even if the "use only" flag is ticked. So if you have a game_player_equip on the map, make sure you give back the knife unless you specifically wanted to take it away.

An example map might be an M3/Deagle map. You'll want to equip the M3, the Deagle, an appropriate amount of ammo for each gun, and the players knife unless you want to take it away from them. You could optionally equip other items like kevlar and grenades. To do this, set the following keyvalues in the game_player_equip entity. For ease of making this table, the keyvalues used will be the actual keyvalues you see with smart edit turned off and only the keyvalues that need to be changed will be shown. As stated before, if you have the latest FGD, smart edit will have all the keyvalues you need with helpful labels. With an older FGD, you may have to add the keyvalues yourself with smart edit turned off.
Property NameValue
weapon_knife1
weapon_deagle1
weapon_m31
ammo_50ae2
ammo_buckshot4
item_kevlar1
weapon_hegrenade1
Now every player will be equipped with those items on the start of each round. There's still one more thing to do.

Prevent Players from Buying

There are two ways to do this. One is to make a small cube out of a trigger texture out of reach of the players. Turn it into a func_buyzone and now buyzones will no longer be created near spawn points. Leaving the buyzone unassigned will prevent this for both teams.

The second option is to put an info_map_parameters entity in your map and choose to prevent both teams from buying.

I prefer using both these methods at once to both get rid of the buyzone icon in spawn and allow the message to players that they aren't allowed to buy to appear when they press the buy button or any other buy binds.

Congratulations, you now have a working m3/deagle map!
The Desert EagleThe Desert Eagle

Another Effect

An interesting principal for giving the player a weapon at a certain point in a map. This could be a Deagle/USP/M4A1/etc. The theory is the same, just change the variables like the weapon names and ammo etc.

This particular set up is for a locker that contains an AK47 that is supposedly picked up by the player:

Make your locker, with a door etc. Right behind the door (don't have it in any way poking through the door) create a trigger_once and in its Target line enter akmm.

Now place a cycler_sprite inside the locker; this will be the most awkward task. In the sprite line enter models/ak47.mdl. Now you have the gun lying on the floor of the locker. You could try tweaking the Pitch, Yaw and Roll in the cycler_sprite's properties to position the model how you want it.

Name the cycler_sprite akd.

Right next to the locker (it could be all the way across the map, but for tidiness put it next to the locker) place a multi_manager. Open it up and name it akmm, turn off Smart Edit, click on add, and enter this:

Key: akd (short for AK Disappear)
Value: 0.1 (this is 0.1 seconds, adjust it as neccesary)

Add again, and then:

Key: akg (short for AK Give)
Value: 0.1

Place a env_render entity, name it akd, open its properties and set its Render Mode to Solid and its FX Amount to 1.

Place a game_playerequip, open it up and name it akg

Scroll down through its list of guns and select ak47

Turn off Smart Edit and click add:

Key: ammo_762nato
Value: 4 (gives four clips)

Other Uses

There are several things that you can do to make this entity set-up more interesting: you could make a Quake-like level using a func_rotating in conjunction with some home-made textures (a picture of a CS gun of your choice on a {BLUE background for instance), and use env_render entities and multi_manager entities to trigger the disappearance of the func_rotating and to equip the player with the gun on the picture.

You could have a metal detector or security scanner device type thingy that when walked through, sets off an alarm and strips the player of all their weapons. However, avoid leaving a player with no weapons, as this makes for a pretty tedious game of CS. ;)

The Armoury Entity

The armoury_entity allows you to put weapons on the ground to be picked up. Not all weapons are available for this entity, including pistols. Make sure you do not put this entity inside the ground or inside a player spawn. They usually have a decent amount of ammo but are not maxed out. You can change the quantity of weapons available in a single armoury_entity.

Weapon and Ammo Glossary

2 Comments

Commented 12 years ago2012-03-15 17:52:16 UTC Comment #100692
item_hegrenade (High-Explosive Grenade) does not work in cs.
USE weapon_hegrenade
Commented 12 years ago2012-03-15 17:52:18 UTC Comment #100693
item_hegrenade (High-Explosive Grenade) does not work in cs.
USE weapon_hegrenade

You must log in to post a comment. You can login or register a new account.