HPL2/HPL2 Helper Scripts

From Frictional Wiki
< HPL2
Revision as of 01:51, 23 November 2023 by Mrbehemo (talk | contribs) (Final draft of first version done.)
Jump to navigation Jump to search

Introduction

HPL2 Helper Scripts is a package of .hps files containing script classes and functions that may be useful to HPL2 modders and custom story creators (for ATDD and AAMFP). It is compatible with ATDD version 1.5 and later.

Would you like to...

...make 500 candles blow out in a big wave? ...make haunted objects hover in the air? ...spawn dozens of random debris objects throughout an area? ...make a particle system move along a spline? ...manage a list of quest objectives? ...compare the distances between entities? ...make puzzles based on position and rotation? ...store an array in a global game variable? ...seamlessly teleport the player into an almost identical room? ...make a statue that twitches when the player has low sanity?

Well, this script package isn't going to magically do those things for you, but it gives you a lot of tools to help you do them yourself.

The scripts are divided into two categories: utilities and features. The utilities scripts include tools for general scripting, like new maths functions, or linked lists and vector classes. The features scripts are more specific solutions that make use of the utilities, such as a way to spawn entities at specific locations, script a large chain of events or to make entities twitch and flicker. Some modders might prefer to just adopt the utilities scripts. It's up to you!

See below for download and set-up instructions.

Contents

The documentation and help is organised by file. You'll find everything detailed on these pages:

Utilities

Provides more control and options for debug messages and logging.
Extends the functionality of the saved game global and local variable wrappers.
Adds support for linked list classes.
Provides an "OnLoad()" global function.
Provides extended maths functionality.
Provides extended string functionality.
Adds support for vector classes.
          

Features

Implements a class for floating or hovering entities, without physics.
Implements a class for managing global ambient sounds.
Implements a class for managing entities that appear to glitch or flicker.
Implements a class for managing large sequences of entity actions.
Implements a class for spawning entities at specific map locations.
 
 
 
 

Set-up


Alert icon.png Requires version 1.5

First, download HPL2 Helper Scripts via Steam Workshop or ModDb. Once you have it, there are three options for how you add it into your mod. If you are unsure, just go with option A.

Option A: The full feature-set package

If you want to be able to use all the new functions and classes, go with option A.

  1. Copy the folder HPL2HelperScripts into your maps folder.
  2. Include HelperScripts_FullPackage.hps in your level's .hps script file using the #include directive.
  3. Add HelperScriptsUpdate(afStep) to your main OnUpdate() function in your level's .hps script file.

E.g., in myLevel.hps:

#include "HelperScripts_FullPackage.hps"

void OnUpdate(float afStep)
{
    HelperScriptsUpdate(afStep);
}

Option B: The utilities-only package

Choose option B if you want to have access to the functions and classes in the utilities category, but don't need the stuff in the features category.

  1. Copy the folder HPL2HelperScripts into your maps folder.
  2. Include HelperScripts_UtilitiesOnly.hps in your level's .hps script file using the #include directive.
  3. Add HelperScriptsUpdate(afStep) to your main OnUpdate() function in your level's .hps script file.

E.g., in myLevel.hps:

#include "HelperScripts_UtilitiesOnly.hps"

void OnUpdate(float afStep)
{
    HelperScriptsUpdate(afStep);
}

Option C: Pick-n-mix

Advanced modders might prefer to only adopt the specific script files they need. Go nuts! But also be aware of the #include dependencies in each script file, as many of them are interdependent. You might find it easiest to start with option A or B and then remove scripts later that you definitely haven't used. You're also fully allowed and encouraged to just use HPL2HelperScripts as a learning resource or even to just copy snippets here and there.

Support

HPL2 Helper Scripts is made by mrbehemo of Aetheric Games. If you need support, first be sure to check this documentation. If you're still stuck and have a question about these scripts, come and find me on the Frictional Discord server.

Licence

You are free to use HPL2 Helper Scripts in whatever way you see fit, no rights reserved by Aetheric Games. If you find it helpful, it would be nice to include a credit. You can list it as "HPL2 Helper Scripts by Aetheric Games".