Difference between revisions of "HPL2/HPL2 Helper Scripts"

From Frictional Wiki
Jump to navigation Jump to search
(Added set-up instructions)
(Final draft of first version done.)
Line 1: Line 1:
 
{{TocRight}}
 
{{TocRight}}
 
 
=Introduction=
 
=Introduction=
<br>
+
''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.
{{ReqVer|1.5}}<br>
 
<br>
 
  
''HPL2 Helper Scripts'' is a collection 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...
<br> 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!
+
<blockquote><small>
 +
...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?
 +
</small></blockquote>
 +
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.
  
See below for download and set-up instructions.
+
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!
  
{{Note|This is a placeholder. Full documentation will be available soon.}}
+
[[HPL2 Helper Scripts#Set-up|See below for download and set-up instructions.]]
  
 
=Contents=
 
=Contents=
The documentation and help is organised by the .hps file. You'll find everything detailed on these pages:
+
The documentation and help is organised by file. You'll find everything detailed on these pages:
 
+
{|
 
+
|-
 
+
|
 +
==Utilities==
 +
:* [[HPL2 Helper Scripts - Debug|<big><big>'''Debug'''</big></big>]]
 +
::Provides more control and options for debug messages and logging.
 +
:* [[HPL2 Helper Scripts - GameVars|<big><big>'''GameVars'''</big></big>]]
 +
::Extends the functionality of the saved game global and local variable wrappers.
 +
:* [[HPL2 Helper Scripts - Lists|<big><big>'''Lists'''</big></big>]]
 +
::Adds support for linked list classes.
 +
:* [[HPL2 Helper Scripts - LoadWatcher|<big><big>'''LoadWatcher'''</big></big>]]
 +
::Provides an "OnLoad()" global function.
 +
:* [[HPL2 Helper Scripts - Math|<big><big>'''Math'''</big></big>]]
 +
::Provides extended maths functionality.
 +
:* [[HPL2 Helper Scripts - String|<big><big>'''String'''</big></big>]]
 +
::Provides extended string functionality.
 +
:* [[HPL2 Helper Scripts - Vectors|<big><big>'''Vectors'''</big></big>]]
 +
::Adds support for vector classes.
 +
||&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;||
 +
==Features==
 +
:* [[HPL2 Helper Scripts - Bobber|<big><big>'''Bobber'''</big></big>]]
 +
::Implements a class for floating or hovering entities, without physics.
 +
:* [[HPL2 Helper Scripts - Fader|<big><big>'''Fader'''</big></big>]]
 +
::Implements a class for managing global ambient sounds.
 +
:* [[HPL2 Helper Scripts - Glitcher|<big><big>'''Glitcher'''</big></big>]]
 +
::Implements a class for managing entities that appear to glitch or flicker.
 +
:* [[HPL2 Helper Scripts - Slimer|<big><big>'''Slimer'''</big></big>]]
 +
::Implements a class for managing large sequences of entity actions.
 +
:* [[HPL2 Helper Scripts - Spawner|<big><big>'''Spawner'''</big></big>]]
 +
::Implements a class for spawning entities at specific map locations.
 +
:<big><big>&nbsp;</big></big>
 +
::&nbsp;
 +
:<big><big>&nbsp;</big></big>
 +
::&nbsp;
 +
|}
  
 
=Set-up=
 
=Set-up=
 +
<br>
 +
{{ReqVer|1.5}}<br>
 +
<br>
 
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'''.<br>
 
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'''.<br>
  
 
==Option A: The full feature-set package==
 
==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.
 
If you want to be able to use all the new functions and classes, go with option A.
#Copy the folder '''''HPL2HelperScripts''''' into your '''''maps''''' folder.
+
#Copy the folder <code>HPL2HelperScripts</code> into your <code>maps</code> folder.
#Include '''''HelperScripts_FullPackage.hps''''' in your level's .hps script file using the '''''#include''''' directive.
+
#Include <code>HelperScripts_FullPackage.hps</code> in your level's <code>.hps</code> script file using the <code>#include</code> directive.
#Add '''''HelperScriptsUpdate(afStep)''''' to your main '''''OnUpdate()''''' function in your level's .hps script file.
+
#Add <code>HelperScriptsUpdate(afStep)</code> to your main <code>OnUpdate()</code> function in your level's <code>.hps</code> script file.
E.g., in myLevel.hps:
+
E.g., in <code>myLevel.hps</code>:
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
 
#include "HelperScripts_FullPackage.hps"
 
#include "HelperScripts_FullPackage.hps"
Line 39: Line 74:
 
==Option B: The utilities-only package==
 
==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.
 
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.
#Copy the folder '''''HPL2HelperScripts''''' into your '''''maps''''' folder.
+
#Copy the folder <code>HPL2HelperScripts</code> into your <code>maps</code> folder.
#Include '''''HelperScripts_UtilitiesOnly.hps''''' in your level's .hps script file using the '''''#include''''' directive.
+
#Include <code>HelperScripts_UtilitiesOnly.hps</code> in your level's <code>.hps</code> script file using the <code>#include</code> directive.
#Add '''''HelperScriptsUpdate(afStep)''''' to your main '''''OnUpdate()''''' function in your level's .hps script file.
+
#Add <code>HelperScriptsUpdate(afStep)</code> to your main <code>OnUpdate()</code> function in your level's <code>.hps</code> script file.
E.g., in myLevel.hps:
+
E.g., in <code>myLevel.hps</code>:
 
<syntaxhighlight lang="cpp">
 
<syntaxhighlight lang="cpp">
 
#include "HelperScripts_UtilitiesOnly.hps"
 
#include "HelperScripts_UtilitiesOnly.hps"
Line 59: Line 94:
  
 
=Licence=
 
=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".
+
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&nbsp;Helper&nbsp;Scripts&nbsp;by&nbsp;Aetheric&nbsp;Games".
  
  
 
__FORCETOC__
 
__FORCETOC__
 
__NOINDEX__
 
__NOINDEX__

Revision as of 02:51, 23 November 2023

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".