<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=Hpl3%3ACommunity%3Ahpl3_reference_guide</id>
	<title>Hpl3:Community:hpl3 reference guide - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=Hpl3%3ACommunity%3Ahpl3_reference_guide"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=Hpl3:Community:hpl3_reference_guide&amp;action=history"/>
	<updated>2026-05-15T13:01:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=Hpl3:Community:hpl3_reference_guide&amp;diff=541&amp;oldid=prev</id>
		<title>Maintenance script: Upload from wiki</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=Hpl3:Community:hpl3_reference_guide&amp;diff=541&amp;oldid=prev"/>
		<updated>2020-07-09T13:43:45Z</updated>

		<summary type="html">&lt;p&gt;Upload from wiki&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= HPL3 Reference Guide =&lt;br /&gt;
&lt;br /&gt;
This is a guide for anyone coming from HPL2 to help describe common actions done in Amnesia modding. In this guide, I will show you how to accomplish how to achieve the same effect (or at least as similar as you can get) in HPL3.&lt;br /&gt;
&lt;br /&gt;
== Key Pick-Up ==&lt;br /&gt;
&lt;br /&gt;
In HPL3, keys, puzzle objects, or any other item that can be picked up is all grouped together under the term &amp;quot;Tool&amp;quot;. When an entity with the type &amp;quot;Tool&amp;quot; is placed in the level, the player can pick it up just by interacting with it - no scripting required.&lt;br /&gt;
&lt;br /&gt;
[Image Placeholder - Player Picks Up Chip]&lt;br /&gt;
&lt;br /&gt;
Of course, there are times when you want to know if the player has picked up a tool. In this case, you can add a function to the tool's &amp;quot;OnPlayerPickup&amp;quot; callback. This callback gets fired when the player (appropriately enough) picks up the tool.&lt;br /&gt;
&lt;br /&gt;
[Image Placeholder - Editor Screenshot of Callback]&lt;br /&gt;
&lt;br /&gt;
[Image Placeholder - Codelite Screenshot of Callback]&lt;br /&gt;
&lt;br /&gt;
== Forces and Impulses ==&lt;br /&gt;
&lt;br /&gt;
=== Force vs Impulse ===&lt;br /&gt;
&lt;br /&gt;
Force changes the speed of an object over time. It is used for things that have a cumulative effect, like gravity or acceleration.&lt;br /&gt;
&lt;br /&gt;
Impulse changes the speed of an object instantaneously. It is used for things like jumps and explosions.&lt;br /&gt;
&lt;br /&gt;
=== Simple Way ===&lt;br /&gt;
&lt;br /&gt;
There are four convenience functions that will quickly allow you to add force or impulse to an entity: &lt;br /&gt;
&lt;br /&gt;
* [[hpl3/game/scripting/function_reference/hps_api#entity_addforce|Entity_AddForce]]&lt;br /&gt;
* [[hpl3/game/scripting/function_reference/hps_api#entity_addforcefromentity|Entity_AddForceFromEntity]]&lt;br /&gt;
* [[hpl3/game/scripting/function_reference/hps_api#entity_addimpulse|Entity_AddImpulse]]&lt;br /&gt;
* [[hpl3/game/scripting/function_reference/hps_api#entity_addimpulsefromentity|Entity_AddImpulseFromEntity]]&lt;br /&gt;
&lt;br /&gt;
The names of the functions offer a straightforward explanation of what the functions do:&lt;br /&gt;
&lt;br /&gt;
The '''Entity_AddForce''' and '''Entity_AddImpulse''' functions enable you to apply force/impulse on an entity with a direction and magnitude specified by a given [[hpl3/community/scripting/classes/cvector3f|cVector3f]] parameter. &lt;br /&gt;
&lt;br /&gt;
The '''Entity_AddForceFromEntity''' and '''Entity_AddImpulseFromEntity''' functions enable you to add force/impulse on an entity originating from the position of another entity with a magnitude specified by a given '''float''' parameter. &lt;br /&gt;
&lt;br /&gt;
All four functions support wildsards (*) for affecting multiple entities with a single function call.&lt;br /&gt;
&lt;br /&gt;
Usage example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;Entity_AddForce(&lt;br /&gt;
       &amp;quot;entity_name&amp;quot;,                // The name of the entity&lt;br /&gt;
       cVector3f(0.0, 5.0, 0.0),     // The direction and magnitude of the force (in this case, straight upward)&lt;br /&gt;
       false,                        // If true, the force is applied relative to the entity's local rotation&lt;br /&gt;
       false);                       '' If true, the force is applied to the entity's main physics body only&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Advanced Way ===&lt;br /&gt;
&lt;br /&gt;
Physics in HPL3 is a bit more complicated than in HPL2. Every physics-enabled entity in HPL3 has attached to it an [[hpl3/community/scripting/classes/iphysicsbody|iPhysicsBody]] which can be retrieved in script. (In order for an entity to be physics-enabled, it must have body objects attached to it in the ModelViewer.)&lt;br /&gt;
&lt;br /&gt;
To get the iPhysicsBody object of an entity, you do the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;// Retrieve the entity object from the map&lt;br /&gt;
iLuxEntity @entity = Map_GetEntity(&amp;quot;entity_name&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
// Retrieve the iPhysicsBody from the entity object&lt;br /&gt;
iPhysicsBody @body = entity.GetMainBody();&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From here, the functions related to force and impulse are:&lt;br /&gt;
&lt;br /&gt;
* '''AddForce''' (const cVector3f &amp;amp;in avForce)&lt;br /&gt;
* '''AddForceAtPosition''' (const cVector3f &amp;amp;in avForce,  const cVector3f &amp;amp;in avPos)&lt;br /&gt;
* '''AddImpulse''' (const cVector3f &amp;amp;in avImpulse)&lt;br /&gt;
* '''AddImpulseAtPosition''' (const cVector3f &amp;amp;in avImpulse,  const cVector3f &amp;amp;in avPos)&lt;br /&gt;
&lt;br /&gt;
These functions behave similarly to their convenience function counterparts, with '''AddForceAtPosition''' and '''AddImpulseAtPosition''' applying their effects from an arbitrary point in the world rather than the position of another entity.&lt;br /&gt;
&lt;br /&gt;
Usage example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;// Add a vertical force to the entity with a magnitude of 5.0&lt;br /&gt;
body.AddForce(cVector3f(0.0, 5.0, 0.0));&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== To-Do List ==&lt;br /&gt;
&lt;br /&gt;
* Monster Spawn&lt;br /&gt;
* Wake-Up Sequence&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
		
	</entry>
</feed>