Tutorial: Equipping Weapons in CS Last edited 20 years ago2004-10-27 04:00:00 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.

Download attachment

User posted image

Stripping and Equipping Weapons in Counter-Strike

Resources Required: Up to date FGD, found here.

Introduction

The premise is simple: to choose which weapons the player(s) start(s) off with, and to make sure they can only use those weapons. 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: A device 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 turns everything off again.

game_playerequip: The entity used to equip the player with the weapons you require. For example, the player runs through a trigger, which runs the game_playerequip 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.

Getting it all to work

First things first, make your map. I imagine it will probably be similar to the fy_iceworld map, and if this is the case, think long and hard about whether you want to release your map. Most mapping forums tend to frown upon iceworld clones, as they've seen a thousand before yours, and I can guarantee you won't be met with the compliments your friends/clan gave you. It's a tough world. ;)

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, and I only mention those ideas because I would like to stress how important it is that you be creative when you design your map, this tutorial will (hopefully) show you that almost all of your ideas can be realised with a little hard work, and some thinking outside the square.
  1. Insert three point-based entities (if this means nothing to you, start reading the beginner tutorials). You will need to create:
1x multi_manager
1x player_weaponstrip - name it strip
1x game_playerequip - name it equip
  1. Arrange them neatly in a high corner of your map, I suggest aligning the centres of all three on a single x/y axis. Not only will it look like something that resembles professionalism, it will be easier to edit them when you make a mistake.
  2. Preventing Teams from buying (method one): Create two brush-based entities (I suggest a 16x16 unit shape, as this is easy to manage, and fits in with the size of the point entities you already created. A tidy approach to mapping is a good way to keep things neat and edit-able), and create two func_buyzones. Now set their properties like so:
Team: Counter-Terrorist only
Team: Terrorist only

Now you have two buyzones in an unreachable place, set to each team, making it impossible for them to buy weapons.
  1. Preventing teams from buying (method two): Using the info_map_parameters entity. If you have no idea what this does, or how it effects the game, think of scoutzknivez. This uses an info_map_parameters, which gives you that "CTs/Ts aren't allowed to buy" message. What if you want a buyzone, though, but just not at the start of the map? This is where the info_map_parameters will let you down.
Setting the entity up is very simple, just open its properties and set Buying to Neither team can buy.

Now to set up your point based entities (you created them first so that you could arrange them neatly). There may be several different ideas running through your puny mortal brain of how you could implement the techniques we discussed earlier. There is no set way to achieve all the desired results, for a different map set-up, you will need to change the way the entities are themselves set-up. I will firstly go through a simple m3 and deagle map.

multi_manager

Name: game_playerspawn
(this means that the <ENT>multi_manager[/val] is triggered when a player spawns, and eliminates any need for brush-based triggers) Now turn Off Smart Edit by clicking it once (it's off when the button isn't depressed), and click Add and enter the following:

Key: strip
Value: 0.1
This triggers the player_weaponstrip after 0.1 seconds, which is virtually instantaneous.

Key: equip
Value: 0.2
This triggers the game_playerequip after 0.2 seconds. You must trigger the equip after the strip, otherwise you will give player a load of guns, and then take them away instantly. A most undesired effect.

You can use multiple game_playerequips, but you only need one to make the m3/deagle map.

Open the game_playerequip's properties and select the following:

Give Knife: Yes
Give m3: Yes

Optionally:

Give Kevlar and Helmet: Yes
Give HE Grenade: Yes (always a fun one)

Now for the "tricky" part:

Turn off Smart Edit, and enter these:

Key: weapon_deagle
Value: 1
Key: ammo_50ae
Value: 6
Key: ammo_buckshot
Value: 4

Congratulations, you now have a working m3/deagle map!

Remember, the name in the multi_manager's Key field must match the name given to your strip/equip entities. Try not to use wild names, as strip/equip will do just fine, but these don't have to be the names, just an example of what I use to keep things in order and easily remembered.
The Desert EagleThe Desert Eagle

The Armoury Entity

Now, what if you didn't want to strip everything and have everyone with the same primary and secondary weapons? Well, the first (and easiest) thing I would suggest is the armoury_entity. It can be found at the top of your FGD list, and contains a list of many of the guns available. It is very easy to use, if you follow some basic guidelines:

a) Select a weapon using the 'item' line, select how much ammo you want to give using the 'count' line. Note: count is actually how many guns will be spawned, as the entity doesn't support ammo (yet), but it works to equip you with a fair amount of ammo. If you wanted to go nuts, you could place triggers for the player to fall through which would trigger game_playerequips which would give ammo, but this will cause you more problems than it solves. I would recommend simply adjusting the Count field in the armoury_entity, it is a lot safer and bug-free.

b) You cannot select certain guns, such as the UMP, or pistols. If you wish to equip pistols, you will need to use the previously mentioned method, via a multi_manager/player_weaponstrip/game_playerequip. This is where the armoury_entity meets its pitfalls. Like I said - a different entity for a different job.

c) Don't place the armoury_entity "inside" the info_playerspawn. Set it either a few units above, or a few units below. Make sure you don't set it in the ground if you are placing it below the player.

That's about it for the armoury_entity, it's very basic and the only errors you can get will be placement-related (i.e. inside the ground/player). It has a limited use and I would recommend thinking carefully about what kind of theme would be best-suited to such an entity. An Armoury is an idea that springs to mind, perhaps the back of a SWAT van filled with shotguns and MP5s.

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_renders and multi_managers 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. ;)

At the end this tutorial I'll just give you a complete list of the items, weapons, their full names, and their ammo type, specifically for use with the game_playerequip entity.

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)

Extro

Remember to play around and see what does and does not work, I have neither the time nor the patience to even attempt to describe every pitfall of playing with entities that are not 100% stable, and you will get errors if you try some outlandish stuff.

Be prepared to change what you first envisioned, as dreams are infinitely less plausible than reality.

Good night, and good riddance - err, I mean luck!

Weapon and Ammo Glossary

ammo_45acp ammo_9mm ammo_50ae ammo_357sig ammo_9mm ammo_57mm ammo_buckshot ammo_buckshot ammo_9mm ammo_9mm ammo_57mm ammo_45acp ammo_45acp ammo_762nato ammo_556nato ammo_556nato ammo_556nato ammo_762nato ammo_338magnum ammo_762nato ammo_556nato ammo_556natobox

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.