User login

Navigation

Poll

I downloaded the ETQW demo and....
...I'm too busy playing for polls.
14%
...it's awesome.
43%
...it's okay, I expected better.
14%
...I'm lost in the valley, anyone have a map?
0%
...my machine won't run it. :-(
29%
Total votes: 7

Who's online

There are currently 0 users and 47 guests online.

Welcome to RUST | Gamedesign.net

Prefabs and Monsters

Submitted by Andy on Sun, 2004-10-17 03:39.

Hammer 3.4

Prefabs and Monsters - by Andy

Now you should have a couple of rooms connected by a corridor with walls that look good and a little mood lighting. Remember the first level of Half-Life? Where you got to walk around and interact with the items in the rooms. Each of the areas was pretty much defined by what sort of additions were in the rooms such as desks, lamps or lab tables. Furniture is just as important as good lighting and texture, to give your level realism.
Most of the work in this tutorial will be done using the Object Bar and inserting items that are already available.

Prefab Objects:
One of the simplest ways to add details is through the use of prefabs. Prefabs are prefabricated objects that are stored in libraries. Let's add a number of prefabs to this level from the prefab library.

Image 1
  1. Select Usable Objects from the categories list, and File Cabinet,west from the objects list (the use of entities in prefabs is a bit dated and sometimes pretty useless, as with this usable filing cabinet. If you want the draw to open, then all well and good, but you can't fit anything in it. One way around this is to change its properties to func_breakable and set the properties to spawn something on break.)
  2. On the lower part of the Objects dialog is the Insert original prefab button. Press this now.
  3. The prefab is now inserted in your room. Move it around the 2D views until you have it in a position you like. I have placed it in the first room, up against the wall. If you look at the example map you will see that the cabinet is about two units away from each wall but sitting on the floor. This will give it a more realistic lighting profile [and is good practice in cases where the object is not an entity - this way it won't split up the wall]. Move the cabinet hard up against the wall and look at the difference in shadow when you compile the map.
  4. I have inserted another filing cabinet, a trash can, a black chair and an old desk, north from the random objects category. Note that the trashcan needs to be transformed by 270 on the Z axis so that the push sign aligns with the room and I have also scaled it to 0.7 on all axes.

So now we have some things in our office, here are a few tips. The black chair created by the Prefab factory is a func_pushable entity. If you leave it free in the room it can be pushed around. If you don't want it to move, then it's a good idea to select it and click to World. By doing this you won't be able to push it and it won't make a moving sound every time you brush against it.

Image 2

In the second room I have added Modern shelves, south and Metal shelves (transformed 180 Z axis) from the random objects category. (The 'south' modern shelves are bound to a func_door for some reason, so click to World unless you actually want the shelves to act as a door.) The metal shelves have four boxes on them.
You can adjust the Spawn on Break properties with the Map -> Entity Report by selecting the properties of each box. If you choose to spawn any item other than a weapon, ammo for instance, then you will find that if you break the box the ammo will fall through the shelf (this is because there is no world entity below the box - it doesn't happen when you build the prefab yourself).

Have fun inserting prefabs. Just remember to check their properties as most of them are designed to function in one way or another. Practice transforming and scaling prefabs, so that they look right. What you're trying to achieve is playability balanced with good looks. There are numerous resource sites that have downloadable prefabs, but use caution and check them before putting them into your maps.

 

Part 6: Monsters:
If you take a look at the entity list you will see that there are lots of 'monster' entities. Now that you have created a simple map you probably want to know how to get it to interact with the player (or in other words, put in something to blow away). While it can be fun running around looking at great scenery and impressive detail, it becomes boring after a while. So this tutorial is a really basic guide to placing monster entities.

First up, we are going to look at how a monster_barney can make a map interesting. Use your entity tool to place a monster_barney in the second room. Leave all of his properties as default. Run the map, pick up the crowbar and go to Barney. First up try getting him to follow you into the other room with the Use key. If that isn't successful give him whack on the forehead with the crowbar. Now run back into the other room.

A couple of things you have probably noticed already:
Getting him to follow you was like pulling teeth and then once you had banged him on the head, he pulled out his gun but didn't chase you. Main reason for this is that poor old Barney didn't know where to go.

Info_node Placement
Info Nodes Barney is one of the monster entities that will follow info_nodes as well as path_corners. To get Barney to chase you into the next room, he needs a map. Info_nodes provide Barney with a path to follow. Same as you would place a normal entity, place an info_node at the entrance to the corridor, one in the middle and one at the other end. Info_nodes are shown here as yellow squares.

It doesn't matter how high of the ground you put them as the game engine always drops them down to 8 units off the floor; what does matter is where you put them. I have placed these nodes just 3 units from each corridor wall. This really isn't a good thing as it is better to place them a minimum of 24 units from walls or any other brush in your map. Included in the download is a small text file that was part of the original Wordcraft tutorials, which includes good information about placement.

If you compile the map now and talk to Barney with the Use key and move into the other room he should follow you down the corridor. If you hit him with the crowbar, he will draw his gun and come looking for you.
(Note: that info_nodes and path_corners are not interchangable: the former are used by all monsters that need to act on AI, and move dynamically, while the latter are used to specify movements - Barney will follow the path_corners until you bash him, and then he will rely on the info_nodes to hunt you down.)

Info_air_nodes work with flying monsters ie; monster_alien_controller.

Path_corners:
You can get Barney to follow path_corner entities as though he was checking security. Just place one at each end of the corridor (In their properties name them p1 and p2 and set their next stop targets. In this case p1 with a next stop of p2 and p2 with a next stop of p1). In Barney's properties, change his Target to p1. If you compile the map now and don't move, Barney will be walking up and down the corridor. If you approach him, he will stop following the path_corners. All monsters do this to some extent.

Monster_scientists behave in pretty much the same way and you can make them follow path_corners or info_nodes.

Monster_human_grunts behave slightly differently. First of all you don't really interact with them, you try to kill them. So the main thing is to decide if you want them to chase after the player. If so, info_node placement is important (and reading the file included with the example map for this tutorial will save time). A good coverage of info_nodes (maximum 128 visible at any point) within a room will make it impossible for the player to hide. The grunts will attack until killed, or you get capped, whichever is first.

Monster Properties:
Flags In the Flag properties, checking WaitTillSeen will make the monster stand there until the player sees him, then he will revert to his normal AI (This will not work if the monster is following path_corners). Checking Gag will shut them up. This means that the player will not know they are around the corner.

Checking Prisoner for any monster entity will stop the monster from attacking the player.

  Properties

You can use monsters to activate or deactivate things by entering the name of the target you want to trigger in Trigger Target. There are Trigger Conditions that can be set and are pretty much self-explanatory (Ok, well maybe not, it seems that some of the conditions are redundant. So test each one.)

One of the things that can be done is to trigger a monstermaker entity. By using this trigger, the new monsters don't appear until the Trigger Condition is met. Monstermakers are a tutorial in their own right, there is so much you can do with them. If you try them out, just remember to change the Angle of the entity so that the monsters it produces face the player or the info_node path when they appear. If you don't they will appear and end up looking at the walls, not doing much until the player attacks.

I have included a test room map to show how info nodes, Trigger Conditions and monstermaker entities work. Kill the first monster_houndeye and watch the fun start.

Houndeye

One last note: There are so many things you can do with monsters. Some of them can be used in conjunction with scripted_sequences and aiscripted_sequences which is outside the scope of this tutorial, but set up a test map, and check out what the different flags and properties of monsters do. It pays to be in God Mode when working with monsters. Remember that monsters that wait to get shot at are boring so get them to do something! And also, too many monsters can ruin the pace of play.

 
Downloads :

Getting Started Final Map

The Monster Map


RUST | Gamedesign.net is your source for all the latest game-editing news and tutorials. If you are seeing this message, this means that you are using a browser that does not support CSS. Please upgrade your browser and enjoy your stay at RUST and if you have any questions, comments, or suggestions, please contact a site administrator.