Hello, Asaratha here again. This is tutorial #3, where we advance our room, add some lights, and our first scare.
First, open up the level we made again. (Unless you already had it open), and delete 1 wall, and the floor we have.
I know it sounds strange, but trust me. I'll show you have to make a lazy floor later.
Now, let's expand the room a bit, by going back to our Static_Objects, choosing mansionbase, and selecting Default02 for walls again.
Shape the room like this, (or similarly)
Now, let's make our first door. Under "wall", find door_way02, and place it inbetween the 2 walls. After that, put a door_frame inside of the doorway.
Now, to put in the door! Go to Entities -> Door, and scroll down to "mansion". Place it inside the doorframe.
Nothing else required. (Yet.) Now, let's add in a floor again, assuming you remember from Tut #1. Although, if we were to go in-game, this room would be pitch-black. So, let's stay in the entities tab. Go to "furniture" in the entities drop-down menu, and load. Scroll to the bottom until you see "table_wood_small", and put it infront of our spawn point. Next, go to "lamps" on the drop-down menu, and click "candlestick02".
In order to put the candlestick on the table, we need to enable "Create on Surface".
And then put it on the table. Let's see how this looks in-game without going in-game, on the bottom bar, click the "A" and "P" buttons to turn off the auto ambient lights.
Although, as you can see, this is still very dark.
It may look very ridiculous, but lets make this 1 small candle fill the entire room with light. Click the "Lights" button on the left bar, (from Tut #1), and under the Light Type tab, select PointLight. Put it under the table, select the cursor tool, click on the light, and drag it above the candle using the green arrow. While having the light selected, click on the "Point" tab on the right, and increase the radius to about 5-ish~. (Note: I also moved my table back a bit to light up the room more.)
As you can see, it's still dark, but better. Let's turn Ambient Lighting back on, and get into our first scare.
Now, let's begin to make a first, but simple scare. Select the door you created, and under the name category, name it "ScareDoor1". DON'T FORGET TO HIT ENTER! Everything under categories in the Amnesia Level Editor REQUIRES you to hit the Enter button!
Now, here comes how to Script. Go into your custom story folder, mine being "C:\Program Files (x86)\Steam\steamapps\common\amnesia the dark descent\custom_stories\Tutorial Map\maps\ch01". And in the ch01 folder, make a text file, whatever your map is named, and instead of .txt, change the file name to .hps.
Map.hps, etc etc.
Open up the .hps file in Notepad++! As soon as you open it, you're going to want to add this to it:
That's all you need to start. Now, in this scare, we're going to make the door start fully open, but when you hit a trigger, it'll slam shut in your face. Let's go back to the Level Editor real quick, click on your door again, and under the Entity tab on the right, set "OpenAmount" to 1.
Now, go into the "Area" tab of your Level Editor, and under AreaType, leave it as Script. Put it infront of the door, but not too close to it. On the right of the editor, change the Size of the script area you made. Adjust it to your liking, don't make it too small, or else it'll be hard to trigger/find.
Now, name the script area "DoorScareScript\".
Now let's go back into our script. Enter this between the 2 brackets in your .hps
AddEntityCollideCallback("Player", "DoorScareScript", "DoorSlam", true, 1);
void OnStart() = When the map starts, basically enable these.
AddEntityCollideCallback = When "Player", collides with "DoorScareScript\", use the function "DoorSlam". (Which we're going to make!)
Now, lets make our function. Underneath the bracket closing off OnStart, put this in.
SetSwingDoorClosed("ScareDoor1", true, true);
void DoorSlam = this is the function we created in the OnStart
SetSwingDoorClosed = "ScareDoor1" is the door we're closing, "true" = It checking if it wants to be opened or closed (I think, correct me if I'm wrong please.)
This should work, now, save the changes on the LevelEditor and Script.
Our Spawn In-Game:
And if all goes well, the door should Slam Shut!
Note: If your door is backwards, click on it, and change the Y to 270, or adjust it.
Thats all for this tutorial! I'll get into detail of your level next tutorial, and after that, I'll just make scripting tutorials.
Any questions? Ask me in the comments!