<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="https://oldwiki.frictionalgames.com/lib/exe/css.php?s=feed" type="text/css"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Frictional Game Wiki hpl2:tutorials:script</title>
    <subtitle></subtitle>
    <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/"/>
    <id>https://oldwiki.frictionalgames.com/</id>
    <updated>2026-06-11T16:55:47+00:00</updated>
    <generator>FeedCreator 1.7.2-ppt DokuWiki</generator>
<link rel="self" type="application/atom+xml" href="https://oldwiki.frictionalgames.com/feed.php" />
    <entry>
        <title>Adding messages to a locked door</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/adding_messages_to_locked_doors?rev=1404472882&amp;do=diff"/>
        <published>2014-07-04T11:21:22+00:00</published>
        <updated>2014-07-04T11:21:22+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/adding_messages_to_locked_doors?rev=1404472882&amp;do=diff</id>
        <summary>Adding messages to a locked door

Hey, in this tutorial me, ClayPigeon, will teach you how to add a message to a locked door.

What does this means? That means that when a player tries to open a locked door, it will show a message on the screen telling him it's locked, or will give the player a hint on where the key is.</summary>
    </entry>
    <entry>
        <title>Advanced Timers</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/advancedtimers?rev=1310573201&amp;do=diff"/>
        <published>2011-07-13T16:06:41+00:00</published>
        <updated>2011-07-13T16:06:41+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/advancedtimers?rev=1310573201&amp;do=diff</id>
        <summary>Advanced Timers

This wiki page will explain the advanced usage of timers.

Timers are set up to wait for the selected amount of time to pass before doing specific commands. In introductions for custom stories, I've seen some that are too quick. For example, the player is in his bed and gets up. Naturally, it should take a little more time unless purposely done so. Like if the player wakes up to the breaking of glass or strange sounds.</summary>
    </entry>
    <entry>
        <title>Buttons that opens a door</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/buttons_that_open_a_door?rev=1369393805&amp;do=diff"/>
        <published>2013-05-24T11:10:05+00:00</published>
        <updated>2013-05-24T11:10:05+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/buttons_that_open_a_door?rev=1369393805&amp;do=diff</id>
        <summary>Buttons that opens a door

Today I (xtron) will teach you (the reader) how to make lets say press 4 buttons and a door opens.

First off you will be needing THE DOOR!

THE DOOR:

Press on entities (7) &gt; Doors &gt; Choose the door of your liking and place it out on your map. Change the name of your door to door1.</summary>
    </entry>
    <entry>
        <title>Beginner Scripting Tutorial 1</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/disable_gravity_tutorial?rev=1297804635&amp;do=diff"/>
        <published>2011-02-15T21:17:15+00:00</published>
        <updated>2011-02-15T21:17:15+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/disable_gravity_tutorial?rev=1297804635&amp;do=diff</id>
        <summary>Beginner Scripting Tutorial 1

This is an easy tutorial for beginners. It is not intended to teach you new techniques but more to show you all the neat stuff you can do with the functions and the HPL2 engine.

In this tutorial you will learn how to make entities 'float' or rather make them seem to be very very light. Possible uses could be for some strange sanity effects or even simulating an underwater environment!</summary>
    </entry>
    <entry>
        <title>Elven VIDEO Tutorials</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/elventutorials?rev=1334612968&amp;do=diff"/>
        <published>2012-04-16T21:49:28+00:00</published>
        <updated>2012-04-16T21:49:28+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/elventutorials?rev=1334612968&amp;do=diff</id>
        <summary>Elven VIDEO Tutorials

Hello young learner! That you are here means, you are looking help or   you want to study some scripting. English may not be my native language,   but I do know some things how to do them. We live in new age and texts   are becoming less and less popular (in some sense). It's way better if   player can see all of creation in action. That's also why most of my   tutorials are made as videos.</summary>
    </entry>
    <entry>
        <title>Scripting Basics for Amnesia Mapping Beginners</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/entihscript_beginner?rev=1293843551&amp;do=diff"/>
        <published>2011-01-01T00:59:11+00:00</published>
        <updated>2011-01-01T00:59:11+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/entihscript_beginner?rev=1293843551&amp;do=diff</id>
        <summary>Scripting Basics for Amnesia Mapping Beginners

So you want to map some stuff for Amnesia.  Great!  The world needs more custom Amnesia content.  The first thing you will note when you try to pick up Amnesia and whip out really cool maps for it is one thing.  The whole Amnesia map idea is intricately woven in script.  Now some of you may know scripting, and the lucky of you even know the programming language this particular script is based on, C++.</summary>
    </entry>
    <entry>
        <title>Scary events</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/events?rev=1310651317&amp;do=diff"/>
        <published>2011-07-14T13:48:37+00:00</published>
        <updated>2011-07-14T13:48:37+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/events?rev=1310651317&amp;do=diff</id>
        <summary>Scary events

Today I (xtron) will show you! (the reader) how to make scary events that will yea…scare the player!.

The door slam

The Door.

we will startoff this tutorial with the basic door slam!.

Start with adding a door.

Go to entities &gt; Door &gt; Choose a door that you want to slam. Change the name of it.</summary>
    </entry>
    <entry>
        <title>Force and impulses</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/force?rev=1338985206&amp;do=diff"/>
        <published>2012-06-06T12:20:06+00:00</published>
        <updated>2012-06-06T12:20:06+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/force?rev=1338985206&amp;do=diff</id>
        <summary>Force and impulses

In this tutorial I (xtron) will explain how to use Prop/Body force and impulses

How to get the coordinates:

Create an item were the player/prop stands when it/he's geting pushed  then you press ctrl+d ( duplciate it ) and drag it to the place where</summary>
    </entry>
    <entry>
        <title>&quot;For&quot; Loops</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/forloop?rev=1347456081&amp;do=diff"/>
        <published>2012-09-12T13:21:21+00:00</published>
        <updated>2012-09-12T13:21:21+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/forloop?rev=1347456081&amp;do=diff</id>
        <summary>&quot;For&quot; Loops

“For” loops are used to repeat some operation multiple times, for example to do something with a variable, or to call an engine function several times in a row. It is almost the same as the “While” loop.

A “for” loop's header defines 3 parts things: (1) the counting variable, set to an initial value, (2) the loop condition, and (3) the change in the variable's value. These are separated by a semicolon ( ; ).  After the header, comes the body of the loop, which defines what is it th…</summary>
    </entry>
    <entry>
        <title>Funcdef &amp; Function Pointers</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/funcdef?rev=1313370564&amp;do=diff"/>
        <published>2011-08-15T01:09:24+00:00</published>
        <updated>2011-08-15T01:09:24+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/funcdef?rev=1313370564&amp;do=diff</id>
        <summary>Funcdef &amp; Function Pointers

This tutorial explains how to set up and use funcdefs &amp; function pointers in level scripts. The first two parts of this tutorial cover some very basic examples on use, with the last mixing arrays and function pointers to allow both calling sequences and a function at random.</summary>
    </entry>
    <entry>
        <title>Setting Up</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/howtomakenotes?rev=1288881839&amp;do=diff"/>
        <published>2010-11-04T14:43:59+00:00</published>
        <updated>2010-11-04T14:43:59+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/howtomakenotes?rev=1288881839&amp;do=diff</id>
        <summary>Setting Up

Before you actually begin adding notes or any text that is seen within the game, you must create an extra_xx.lang file (xx being whichever language you plan on using for your story). This tutorial covers how to create extra_xx.lang in your custom story's main folder.</summary>
    </entry>
    <entry>
        <title>Incremental Running</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/incremental_running?rev=1377290453&amp;do=diff"/>
        <published>2013-08-23T20:40:53+00:00</published>
        <updated>2013-08-23T20:40:53+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/incremental_running?rev=1377290453&amp;do=diff</id>
        <summary>Incremental Running

This code will allow the player to run faster over time until he stops.

Add all this code to your script file:

// SPRINT {
 
 
void AutoSprintInit ()
{    AddTimer ( EMPTY, 1.0, &quot;AutoSprintCheck&quot; ); }
 
 
void AutoSprintCheck ( string &amp;in asTimer )
{
    float pSpeed = GetPlayerSpeed();
 
    if ( pSpeed &lt; 3.7f ) { AutoSprintNormalize(); }
    if ( pSpeed &gt;= 3.8f ) { AutoSprintIncrease( pSpeed ); }
 
    AddTimer ( EMPTY, 1.0, &quot;AutoSprintCheck&quot; );
}
 
 
void AutoSprintIncr…</summary>
    </entry>
    <entry>
        <title>Levers that opens secret shelfs</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/levers_and_secretshelfs?rev=1404351379&amp;do=diff"/>
        <published>2014-07-03T01:36:19+00:00</published>
        <updated>2014-07-03T01:36:19+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/levers_and_secretshelfs?rev=1404351379&amp;do=diff</id>
        <summary>Levers that opens secret shelfs

In this tutorial I (xtron) will show you! (the reader) how to make levers that opens secret bookshelfs!.

The Bookshelf

First off you need to create a moveable bookshelf.

Go to Entities(7) &gt; Gameplay &gt; Look for “shelf_secret_door_rot</summary>
    </entry>
    <entry>
        <title>Variables</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/localandglobalvariables?rev=1310647551&amp;do=diff"/>
        <published>2011-07-14T12:45:51+00:00</published>
        <updated>2011-07-14T12:45:51+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/localandglobalvariables?rev=1310647551&amp;do=diff</id>
        <summary>Variables

A variable is letter or word used to represent a value that can be altered. The main types of variables are bool, string, int, and float. Bool is when the variable can be true or false. String is a letter, word, or phrase. Int is an integer (whole number). Float is a number with a decimal (can also be a whole number).</summary>
    </entry>
    <entry>
        <title>Setting Up a Monster</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/monsterpathnodes?rev=1371075320&amp;do=diff"/>
        <published>2013-06-12T22:15:20+00:00</published>
        <updated>2013-06-12T22:15:20+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/monsterpathnodes?rev=1371075320&amp;do=diff</id>
        <summary>Setting Up a Monster

To set up a monster in your custom story, you need to place it in the level editor. Monsters can be found when you click the “Entities” tab and then go to the subsection “enemy”. For this tutorial, we'll choose the monster that is called</summary>
    </entry>
    <entry>
        <title>How to add Custom Sounds?</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/page?rev=1414880574&amp;do=diff"/>
        <published>2014-11-01T22:22:54+00:00</published>
        <updated>2014-11-01T22:22:54+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/page?rev=1414880574&amp;do=diff</id>
        <summary>How to add Custom Sounds?

Hello! Stepper321 (And friends) here, i'm gonna teach you how to add custom sounds!

Having the sounds

First you'll need a sound-editting program, you can do this by using SUPER (Recommended) Audacity or Sony Vegas (Not free)

The sounds need to be in</summary>
    </entry>
    <entry>
        <title>Player Blink</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/player_blink?rev=1387483312&amp;do=diff"/>
        <published>2013-12-19T20:01:52+00:00</published>
        <updated>2013-12-19T20:01:52+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/player_blink?rev=1387483312&amp;do=diff</id>
        <summary>Player Blink

This simulates an eye blink every 6~10 seconds.



Create the following functions in your script file:


void Blink()
{
          FadeOut(0);
          FadeIn(0.1);
}



void BlinkTimed( string &amp;in asTimer )
{
          Blink();
          AddTimer ( &quot;&quot;, RandFloat(6,10), &quot;BlinkTimed&quot; );
}</summary>
    </entry>
    <entry>
        <title>Introduction</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/problem?rev=1381793175&amp;do=diff"/>
        <published>2013-10-14T23:26:15+00:00</published>
        <updated>2013-10-14T23:26:15+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/problem?rev=1381793175&amp;do=diff</id>
        <summary>Introduction

Hello, stepper here! Today i am going in the depths of finding problems yourself! So you don't have to wait for answers and do it quickly.

Error menu

As always you see a error menu when you start the map with the error. There are error with misplacing, spelling errors, all that kind of stuff.</summary>
    </entry>
    <entry>
        <title>Push Doors Open( using Force)</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/pushdoorsopen?rev=1310995186&amp;do=diff"/>
        <published>2011-07-18T13:19:46+00:00</published>
        <updated>2011-07-18T13:19:46+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/pushdoorsopen?rev=1310995186&amp;do=diff</id>
        <summary>Push Doors Open( using Force)

Force, aside from moving things around, can be used to open doors and things such as cabinets which can be opened.

This page describes what AddBodyForce/AddPropForce does and how to find out which of the X, Y, or Z variables you want to increase or decrease, in this case it would be whichever way the door opens.</summary>
    </entry>
    <entry>
        <title>Random Scares</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/random_scares?rev=1366709591&amp;do=diff"/>
        <published>2013-04-23T09:33:11+00:00</published>
        <updated>2013-04-23T09:33:11+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/random_scares?rev=1366709591&amp;do=diff</id>
        <summary>This is a script that allows you to make your scares to be randomized, meaning that each playthrough will have different scares.

Let's get started!

Random Scares


void OnStart()
{
AddEntityCollideCallback(&quot;Player&quot;, &quot;ScriptArea_1&quot;, &quot;PlrCollideSwitch&quot;, true, 1);
}</summary>
    </entry>
    <entry>
        <title>Running up walls</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/running_up_walls?rev=1437165136&amp;do=diff"/>
        <published>2015-07-17T20:32:16+00:00</published>
        <updated>2015-07-17T20:32:16+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/running_up_walls?rev=1437165136&amp;do=diff</id>
        <summary>Running up walls

This code will simulate the player running up walls.

Since code ends up being too large and thus confusing, i'm dividing it in parts.

1. How it works



This feature uses areas to determine where the wall is and to detect when the player jumps to it.</summary>
    </entry>
    <entry>
        <title>hpl2:tutorials:script:scripting_by_xtron_-_item_that_unlocks_a_door</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/scripting_by_xtron_-_item_that_unlocks_a_door?rev=1377184340&amp;do=diff"/>
        <published>2013-08-22T15:12:20+00:00</published>
        <updated>2013-08-22T15:12:20+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/scripting_by_xtron_-_item_that_unlocks_a_door?rev=1377184340&amp;do=diff</id>
    </entry>
    <entry>
        <title>Scripting Sequences</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/sequences?rev=1311974911&amp;do=diff"/>
        <published>2011-07-29T21:28:31+00:00</published>
        <updated>2011-07-29T21:28:31+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/sequences?rev=1311974911&amp;do=diff</id>
        <summary>Scripting Sequences

A “Sequence” is a series of events. In Amnesia, a sequence will describe a chain of events that happen in your story! This is useful for any sort of long cutscene, or some sort of intro sequence.

The problem

Our first problem that we encounter when thinking about this is, how do we keep track of what part of the sequence we're on? Our second problem would be how to go about structuring it.</summary>
    </entry>
    <entry>
        <title>Slight Oil Recovery</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/slight_oil_recovery?rev=1374879861&amp;do=diff"/>
        <published>2013-07-26T23:04:21+00:00</published>
        <updated>2013-07-26T23:04:21+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/slight_oil_recovery?rev=1374879861&amp;do=diff</id>
        <summary>Slight Oil Recovery

This is a feature i did for my custom story to help the player continue.

Create the following function in your script file:


void OilRecovery ( string &amp;in asTimer ) 
{       
        if ( GetLanternActive() == false ) { AddPlayerLampOil( 0.25 ); }
        AddTimer ( &quot;&quot;, 5, &quot;OilRecovery&quot; ); 
}</summary>
    </entry>
    <entry>
        <title>Script - Tutorial 1</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/tutorial_1?rev=1288883253&amp;do=diff"/>
        <published>2010-11-04T15:07:33+00:00</published>
        <updated>2010-11-04T15:07:33+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/tutorial_1?rev=1288883253&amp;do=diff</id>
        <summary>Script - Tutorial 1

HPL2 uses a script language called AngelScript, it is a C/C++ based syntax and a brief overview of the syntax can be found here.

I do not know how to script?!

Scripting in HPL2 is about as easy as it gets, without adding an extra help system (for example Blizzard has some very nifty tools in their editors to help with scripting). But even so it will be a mess and you will be lost with no previous experience. What you need is basically an introduction course to C/C++ or a s…</summary>
    </entry>
    <entry>
        <title>Creating your own custom Amnesia Main Menu Background</title>
        <link rel="alternate" type="text/html" href="https://oldwiki.frictionalgames.com/hpl2/tutorials/script/tutorialsformainmenu?rev=1366211752&amp;do=diff"/>
        <published>2013-04-17T15:15:52+00:00</published>
        <updated>2013-04-17T15:15:52+00:00</updated>
        <id>https://oldwiki.frictionalgames.com/hpl2/tutorials/script/tutorialsformainmenu?rev=1366211752&amp;do=diff</id>
        <summary>Creating your own custom Amnesia Main Menu Background

In this tutorial you can learn how to create your own Amnesia Main Menu Background, that means the little map (YES, it's a map!) you see when you are in Amnesia's Main Menu!

It's very simple, the only tool you need for now is the</summary>
    </entry>
</feed>
