Evil Tools - Mapping tools for creating Survival Horror campaigns

Evil Tools – A wonderful set of things to create you very own survival horror experience!

Hello internet. A little while ago I released gm_apartment and hinted at how the tools we made could be used to create your own horror maps. To my surprise, people actually gave a shit and I’ve been getting questions about how they work. And so, here we are.

One other thing, we kept naming out custom entities “evil_whatever” as a running joke about how badly we are ripping off Resident Evil. So I think its only appropriate to call this the “Evil Tools”.

Before I start explaining how to use the tools, you need to know how to make them work for your map.

Step 1: Download Gm_apartment This is required

Step 2: The FGD In addons/evil_apartment there is a file called evil.fgd. This is the file that adds new entities to hammer. Install the FGD, the wiki has great instructions on how if you don’t know.

Step 3: Making you map work with evil tools This is important. The code checks what map you are playing on, and if it passes a check, the game ‘turns on’. Follow these directions:

-Make a new addon, put your map into it.

-Inside your new addon, create the path lua/autorun

-Go back to the evil_apartment addon. Look inside it's lua/autorun folder. There is a file here called sh_apartment.lua. Copy and paste it into your addon's autorun folder.

-Now that you pasted sh_apartment.lua into your addon, rename the new one to something following sh_namehere.lua. This can be literally anything you want *except* apartment.

-Almost done, now open up the lua file.  In line 1, look for the words gm_apartment. Replace this with your map name. Example, if I wanted gm_construct to boot up with the game, i'd replace it with “gm_construct”.

-You're done. The map will now work with the gm_apartment gametype. 

So what you’re doing is using the evil_apartment addon as a base. If we simply copied the evil_apartment lua folder over it would conflict with gm_apartment’s code. This way, whoever players your map will only need to have gm_apartment before they can play your new map.

Okay now onto the fun parts. The mapping tools.

ent_loading_door

This entity is how we did the doors in gm_apartment. At first, I had a giant elaborate set up that would use env_fades and trigger_teleports. It was a nightmare. The new code made rigging up the doors a 10 second job instead of a nightmare.

I am only going to cover the important properties for every new entity.

-Properties

Name: You can use this to define a specific door’s name. This isn’t required to make it work, but you can lock and unlock doors using inputs/outputs.

World Model: This defines what the door looks like. You don’t really need to make it a “door” persay.

Requires: Ah-ha. This is the important part. You can type in whatever itemId you want the key to this door to be here. Look in lua/autorun/inventory. Each item here has a unique ItemID, you just type in the ItemID of whatever item you want to unlock the door. (Note: if you define an itemID, the door will automatically be locked on spawn.)

Important, if you do not type anything in the Requires field, the door will not be locked.

Teleport To: This is the name of what info_teleport_destination to teleport the player to. You must define this, or else the door will not work.

Door Open Sound: This lets you define what sound plays when the door is opened. This is true for the close, lock, and unlock fields. You could have your doors moo when opened. Isn’t that great?

Loading Screen: This lets you change the loading screen. Type in the path to the material you want the new loading screen to be, and it will display. Note: This disables the easter egg loading screen.
Flags

Teleport player: This can let you make it so when the door is used, it doesn’t actually teleport the player. I don’t know why you’d need this, but it’s there.

ent_candle

Spawns a lightable candle.

Light Color: You can define what color the flame, light, and how bright the candle is with this. I used the values 255 157 60 2 in gm_apartment. I would not recommend making the brightness go beyond 10, it kind of looks like someone took a giant light shit if it’s above 10. It’s pretty fun to set it to hot pink and screw with peoples heads.

Render Distance: This is an optimization value. Once the player moves beyond the number of units you define in here, the light will turn off. I use 512 a lot in gm_apartment since it’s very close together. Each candle is a dynamic light so I recommend using this to improve performance. Or else the candle will never turn off.

flags

Starts On: A candle be on by default. Bug: The flame particle doesn’t spawn if a candle is turned on by default. We didn’t fix this, so if you need this to work, get a coder.

ent_item

Ok here’s a very important entity. Every item in gm_apartment is an ent_item. Keys, cranks, pliers, whatever.

Item ID: This is how you tell the entity what it is. Look in lua/autorun/inventory. Each item here has a unique ItemID, you just type in the ItemID of whatever item you want it to be.

Enable Motion: You can let the player knock around the item. This feature is never used in gm_apartment so i’m not sure how buggy it is. Careful, the player is a messy jerk who can lose an item by accident.

Flags

Give Player the item: You can totally fuckin’ troll the player and have fakeout items that just trigger stuff when they try to pick it up. Unchecking this will still fire any “onpickup” outputs but the player doesn’t actually have anything added to their inventory.

Can Move: This defines whether or not the item can be moved. So if it’s dangling from a rope or something, check this.

Ent_item_objective

This is the other super-important entity. It’s also the most in-depth one because I am a giant dummy who needed to make a non-linear portrait puzzle.

World Model: This defines what the item_objective looks like. The model needs to have a collision model or else it won’t work.

Requires: This determines what item will make the item_objective work. Look in lua/autorun/inventory. Each item here has a unique ItemID, you just type in the ItemID of whatever item you want to be the solution.

Example, the itemID of the lamp in room 101 was 11 (the ItemID of the lightbulb).

Item ID: The item_objective itself can be an item. This was created for the portrait puzzle, each portrait was an item_objective and defined what initially was on the wall with the ItemId. You could use this feature to initially make a drained battery, have the player recharge it somewhere else, and then put it back.

Restricted To: This defines what set of items will work with the item_objective. This way you can let the player place down items that won’t actually do anything, but only a specific set of items. This is how we let the player place down incorrect portraits in the portrait puzzle without letting them put a light bulb or whatever else on the wall.

Pickup Sound: If this is defined, a sound will play whenever the player picks the item up.

Flags

Can Move: This lets the player be a total dick and knock the item_objective around.

Can pickup item(must have itemID): You can determine whether the player can pickup the item that appears here.

Any item can be placed: Lets you place any item on the objective and have it work.

Starts transparent(will not spawn the item): When a player picks up the item from the item_objective, a transparent model spawns to indicate something used to be there. You can use this to set it transparent initially, and it won’t spawn the item. Useful to tell the player that they need to place something here.

ent_typewriter

This fucking thing.

World Model: Ok look i’m going to level with you. I don’t know why you’d want this to be anything but a typewriter. But I guess if you needed it to be a keyboard or whatever, it can be.

First-Fifth Phrase: These tell the typewriter what the “correct” phrases are. If a player types in a correct phrase you can fire an output using onPhraseX, where x is the phrase number you wanted. There is actually no limit on the amount of phrases you can have, just turn off smart edit if you need more than 5 for whatever reason.

Ent_storymanager

Hey guys I wrote this really long shitty story because I didn’t feel like making an ending, here read it for 20 minutes.

In all seriousness, this is a pretty interesting thing. You can use this to add books or notes to your map. I just misused it for the worlds most pretentious story.

Name: Name of the manager. You can have more than one.

How to use it:

We had to create this thing as a middleman to display the story at the end, the ent_storymanager has to be told by a trigger or button or whatever what story to play.

I set up a trigger_once to fire this output:

My Output named: OnTrigger

Targets entities named: story_manager_end (the name of the ent_storymanager)

Via this input: StartStory (you can also use stopstory if one is currently playing)

With a parameter override of: 1 you have to type in here the id of what story you want to display. Since it had to trigger the start of the story, it’s 1.

Misc:

All the item related stuff has outputs like “item used” or what have you. That’s handy, because you can fire outputs when players use items. Explore what you can do with each thing, it’s all pretty flexible.

Ok now on to how to make your own items, stories, whatever.

Creating new items:

Navigate to lua/autorun/inventory/items. In this folder there is a lot of individual LUA files. These are all the items in the game. Open any one of them up, they look scary at first but don’t worry, i’m here to explain all this dumb shit.

ITEM.ID = 18 -This is the unique ID of the item. Each item needs to be assigned its own number or else the game will be so confused it won’t know what to do. Do not assign two items the same ID. 18 is the highest number in the game, so if you make anything new start at 19.
ITEM.Name = “Generator Crank” – This is what the item will be called in the invetory screen.
ITEM.Model = “models/props_mining/diesel_generator_crank.mdl” – This is what model will be used in the inventory screen.
ITEM.Skin = 0 – What skin the item uses, if there are multiple skins. Use 0 if theres only 1 skin.
ITEM.Description = “Look at an object and press the use key to use some items.” -The description of the item in the inventory screen.
ITEM.CamPos = Vector(0, 128, 128)
ITEM.LookAtPos = Vector(0, -1, 0)
**ITEM.FOV = 22 – **Ok these numbers can be largely copy and pasted. This tells the code there to draw the item’s model in the inventory screen. If you have sv_evil_cheats set to 1, there’s some debug commands to let you change where the model draws. I don’t have any damn clue how they work.

Just copy and paste what we have and change the variables. It’s the easiest and most efficient way to make new items.

There aren’t any keys in hl2, so feel free to use my model ( “models/sunabouzu/inventory_key.mdl” ). If you want to reskin it, please feel free to just decompile it and take it. I’m all about helping you guys.

Making new stories

First off, navigate to lua/autorun/stories/stories. There’s a lot of lua files here, like the items. Open up chunk3.lua.

**STORY.ID = 3 **-This is the unique ID of the story. Same thing as items, each one needs it’s own number.
STORY.Content = {
“Here is a story about this broad”,
“Her arm got ripped off”,
“Sucks, don’t it?”
}
STORY.Rate = .075 // characters/second – This is how fast the story scans in.
STORY.Sound = “sunabouzu/stories2.wav” -If you want music to play you can use this. If you don’t want music, just delete this line entirely.
STORY.Brother = 4 – you can use this to tell the story to play another one as soon as the current one ends. Since this story id is 3, we wanted it to move to the next one, 4.

Ok so I didn’t write anything for story.content because it’s kind of weird to explain. Basically, the “pages” of the story are separated into a table. If you don’t know lua, that didn’t make any sense. Tables in Lua are a set of strings that you define inside “'s. So in that, each page is contained in the quotation marks.

It rolls like this:

“Page 1”,
“Page 2”,
“Page 3”

Notice page 1’s line. Since there is a page after page 1 I put a comma after the end quotation mark. Now look at page 3. Since there is nothing after it, there is no comma after it. When in doubt, copy and paste. Just be sure the last page’s line doesn’t have a comma at the end.

The lighter

Ok so this is where foresight comes to kick my ass.

The player always spawns with the lighter and the weapon wheel is disabled. You can add new weapons, like a handgun or a flashlight or whatever, but you need to basically replace the lighter. Also, we didn’t design this around the player having more than one weapon. If you want the lighter out of the picture, strip weapons from the player at the start and then give them a new gun.

Important Code Notes:

Put any new items you make into your new addon. Just mimic the file structure from evil_apartment.

We moved a lot of shit over to sv_evil_cheats, most notably, the ability to noclip. It’s cleaner if you work with this system for any possible new debug commands you need to make, but that’s just a suggestion. I’m not going to come to your house In the night with a shotgun just because you didn’t follow my rules. Probably.

Also, the lighter will set anything on fire with right click if evil_cheats 1 is on. Not going to lie, we did this so we could burn down everything when shit didn’t work. It’s surprisingly therapeutic.

This is more than an simple “fuck questions” thing, this forum has a lot of fantastic talent and I would love nothing more than for someone to expand on what we made and create something great. I’m going to leave this open for any questions, possibly feature requests.

Additionally here’s the vmf to gm_apartment. Refer to this is you visually need to see how something works.

Of course, if you need any questions answered, post here or pm myself or Unrealomega. We aren’t nearly as insane as people think. Honest.

I approve of this thread.

Just because it’s Sunabouzu

And he’d kill me

[editline]1[/editline]

Don’t kill me Sunabouzu

Kill him.

good fucking god you deserve a nobel prize

I love this, now onto my evil plots

Sun, what have you done?! Now there will be shitty clones of our shitty map.

I don’t want to live on this planet anymore.

Very indepth guide for the use of your FGD, nice one!

This is unbelievebly ace! I can’t wait to try it out on the weekend, it will save so much fannying around on my map. Woooop!!!

Just a quick question but is the candle model easily replaceable and if so will the flame still spawn at a point? (If for example I wanted a diffrent hight/width)

The candle isn’t designed to be anything but a candle so not really, but there are some things you can do to make a new entity that works like it.

The candle model has an attachment point that tells the code where to spawn the fire. If you’re familiar with coding and modeling enough you can decompile the candle model, change where the point is, and then recompile it as a new model. As for the code i’d suggest opening up the ent_candle code in lua/entities and copy/pasting it to a new lua file.

Long story short: You can only change the color and brightness of the ent_candle as it is now unless you know how to code and model.

No problemo mon frere, thanks for the reply. I’m downloading it now in anycase.

Use Source Sdk for 3 hours.
Its like playing Resident Evil (remake) for 3 hours, what comes to survival horror.

You don’t need to do that. You can use the ent_candle as a base and just override the functions.

Hnnnnnnnnnnghhhhhhhh soo many ideeeeeeeeaaaaaas!!!

Well if the coder says so then I guess you’d better listen to him.

Haha, good point. Thanks Unrealomega.
Also, is this the final release or are you adding features as you go?

Good question.

Right now I am not planning on making another map like apartment (anytime soon at least), and that’s a big reason why I did this thread. Such as it is, the Evil Tools base won’t have anything new in it until we make a new project, or unless a lot of people ask for a feature.

So no, the only time Evil Tools will be updated is when we make a new project using it. You’re on your own outside whats already in place.

Oh boy, finally have a use for that old as fuck Borealis map I was fixing up ages ago. I always though it would be great for an RE-esque mod but I always lacked the expertise to do anything like that.

If you’re considering improvements for your next project, I would suggest making weapons similar to ent_items, in that they exist in your inventory. Bascially when you choose to ‘equip’ the weapon item it simply adds the actual weapon to the player so they can use it, and when you unequip the weapon item it removes the weapon from the player.

Also, I want to suggest item combining. I think that would be pretty simple to implement, it’s essentially ‘combine ent_item A with ent_item B to get ent_item C’.

I hate to bump this, but I can’t get the FGD to work; as in the new entities aren’t showing up in my Hammer even after restarting it + the SDK.

What’s the dealio?

[editline]24th January 2012[/editline]

Whup, nevermind. Adding evil.fgd to my current EP2 config worked dandy.

This thing is awesome, people should know about it.

I wish I had some sort of skill in Lua so I could expand on it, add some features that RE popularized for example.

These are very great tools! Now hopefully the diversity in mapping will increase.