Table of Contents

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 script language based on that syntax, for example Javascript.

In my own experience, as a non-educated fellow in the world of scripting, I think you are best of taking a look at Javascript before you try to begin scripting in HPL2. Why? Because it is easy to find Javascript tutorials and information online and all you need is a text editor and your web browser. A place to start is for example w3schools introduction to Javascript. Mainly chapters JS Comments to JS For...In touch the general subjects that are common to all syntax's.

A short version is that all that you do in HPL2 is to use functions, they are commands that you give properties and then all the magic is taken care of by the game. Everything here are functions. You then decide how and when the functions are to be executed by using the common programing specific parts such as statements, variables and comparisons in combination with the objects you place using the level editor.

Example for those with no prior experience

Script is simplified and will not actually work ingame AT ALL, syntax is incorrect and only written as it is to give a short snippet of script code.

AddEntityCollideCallback("Player","AreaHelp","CollidePlayerWithAreaHelp");
 
void CollidePlayerWithAreaHelp()
{
    if(HasItem("cellar_key") == true)
    {
        SetMessage("Use your inventory to select key and use on door.", 10)