<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=M654</id>
	<title>Frictional Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=M654"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page/Special:Contributions/M654"/>
	<updated>2026-04-24T06:55:07Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Areas/Ladder_Area&amp;diff=6208</id>
		<title>HPL3/Areas/Ladder Area</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Areas/Ladder_Area&amp;diff=6208"/>
		<updated>2021-03-10T18:16:23Z</updated>

		<summary type="html">&lt;p&gt;M654: Created page with &amp;quot;== Overview == When placed on a static object (like a ladder), the Ladder area will allow the player to climb it.  == Properties == === Material === Determines the type of sou...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
When placed on a static object (like a ladder), the Ladder area will allow the player to climb it.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
=== Material ===&lt;br /&gt;
Determines the type of sounds the player will make when climbing.&lt;br /&gt;
&lt;br /&gt;
=== Exit_Top ===&lt;br /&gt;
[[Image:Ladder.png|thumb|A functioning ladder setup. Light green = Ladder, blue = InteractAux, red = Trigger|right]]&lt;br /&gt;
The [[HPL3/Areas/Trigger Area|Trigger area]] where the player will end up when exiting the ladder from the top. In order to work properly, an [[HPL3/Areas/InteractAux Area|InteractAux area]] with its '''InteractParent''' property set to the Ladder area must be placed next to the Trigger area, as seen in the image.&lt;br /&gt;
&lt;br /&gt;
=== Exit_Bottom ===&lt;br /&gt;
Same as '''Exit_Top''' but for exiting from the bottom.&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:Ladder.png&amp;diff=6207</id>
		<title>File:Ladder.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:Ladder.png&amp;diff=6207"/>
		<updated>2021-03-10T18:13:52Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:Hpl3:LadderArea.png&amp;diff=6206</id>
		<title>File:Hpl3:LadderArea.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:Hpl3:LadderArea.png&amp;diff=6206"/>
		<updated>2021-03-10T18:12:15Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Areas/PlayerStart_Area&amp;diff=6205</id>
		<title>HPL3/Areas/PlayerStart Area</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Areas/PlayerStart_Area&amp;diff=6205"/>
		<updated>2021-03-10T18:05:21Z</updated>

		<summary type="html">&lt;p&gt;M654: Created page with &amp;quot;As the name implies, the PlayerStart area is where the player will spawn when the map is loaded.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;As the name implies, the PlayerStart area is where the player will spawn when the map is loaded.&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Areas/Trigger_Area&amp;diff=6204</id>
		<title>HPL3/Areas/Trigger Area</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Areas/Trigger_Area&amp;diff=6204"/>
		<updated>2021-03-10T17:54:02Z</updated>

		<summary type="html">&lt;p&gt;M654: Created page with &amp;quot;== Overview == The Trigger area runs a callback function when an entity collides with it.  == Properties == === CC_Entities === This is a list of all entities that can trigger...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
The Trigger area runs a callback function when an entity collides with it.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
=== CC_Entities ===&lt;br /&gt;
This is a list of all entities that can trigger the callback, separated by commas or spaces. &amp;lt;code&amp;gt;player&amp;lt;/code&amp;gt; refers to the player character.&lt;br /&gt;
&lt;br /&gt;
=== CC_Funcs ===&lt;br /&gt;
Includes a list of functions that will run when the area is triggered.&lt;br /&gt;
&lt;br /&gt;
== Callback function syntax ==&lt;br /&gt;
This is the basic syntax for a collision callback function.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool FunctionName(const tString &amp;amp;in asParent, const tString &amp;amp;in asChild, int alState)&lt;br /&gt;
{&lt;br /&gt;
    if(alState == 1) // 1 = entering area, -1 = leaving area&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code here&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5627</id>
		<title>HPL3/Amnesia: Rebirth/Tutorials/Inventory items</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5627"/>
		<updated>2020-11-12T16:22:44Z</updated>

		<summary type="html">&lt;p&gt;M654: Fixed images&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will explain how to create a custom item that can be picked up, added to the inventory, and used on other entities.&lt;br /&gt;
&lt;br /&gt;
[[Image:CustomItemExample2.jpg|thumb|An example of a custom item in the inventory|right]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial==&lt;br /&gt;
&lt;br /&gt;
===Creating an ItemType===&lt;br /&gt;
Let's start by creating an item type. Keep in mind that an ItemType isn't the same as the physical in-game item entity, so a single ItemType can be used with multiple different entities.&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;config/Inventory.cfg&amp;lt;/code&amp;gt;. This file contains a list of all ItemTypes in the game. Add a new &amp;lt;code&amp;gt;&amp;lt;ItemType&amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ItemType ID=&amp;quot;ItemName&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Inventory Icon=&amp;quot;icon_file_name&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Use OnWorld=&amp;quot;true&amp;quot; CanUseOnWorldMapCallback=&amp;quot;CanUse_ItemName&amp;quot; UseOnWorldMapCallback=&amp;quot;OnUse_ItemName&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/ItemType&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The icons for items shown in the inventory are stored in &amp;lt;code&amp;gt;graphics/inventory/items&amp;lt;/code&amp;gt; and saved in the DDS format. Replace &amp;lt;code&amp;gt;icon_file_name&amp;lt;/code&amp;gt; with the name of your icon file, and change &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; to whatever you want to call your item type.&lt;br /&gt;
&lt;br /&gt;
Setting the &amp;lt;code&amp;gt;OnWorld&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; will allow this item &lt;br /&gt;
type to be used on other entities in-game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CanUseOnWorldMapCallback&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;UseOnWorldMapCallback&amp;lt;/code&amp;gt; are functions that determine which entities the  item type can interact with and what happens when it's used on an entity, respectively. We'll get back to these later.&lt;br /&gt;
&lt;br /&gt;
A detailed list of Use attributes and available functions is located in the beginning of &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;, but to keep things simple we'll only be using the three shown above.&lt;br /&gt;
&lt;br /&gt;
===Item name and description===&lt;br /&gt;
Now let's give the item a name and a description that will show up when the item is moused over in the inventory. Open &amp;lt;code&amp;gt;config/lang/english.lang&amp;lt;/code&amp;gt; and add two entries to the &amp;lt;code&amp;gt;Inventory&amp;lt;/code&amp;gt; category: &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemName_Desc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;LANGUAGE&amp;gt;&lt;br /&gt;
	&amp;lt;CATEGORY Name=&amp;quot;Inventory&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName&amp;quot;&amp;gt;Test Item&amp;lt;/Entry&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName_Desc&amp;quot;&amp;gt;This is a simple test item.&amp;lt;/Entry&amp;gt;&lt;br /&gt;
	&amp;lt;/CATEGORY&amp;gt;&lt;br /&gt;
&amp;lt;/LANGUAGE&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Placing the entity===&lt;br /&gt;
[[Image:CustomItemEntityTab.png|thumb|The Entity tab|right]]&lt;br /&gt;
In the level editor, choose an entity to represent the item in-game. Select it, open its '''Entity''' tab and look for a section called '''Pickup'''. If it isn't there, that means that the entity is either a physics object or a static object and you won't be able to pick it up in-game. In that case, open the entity's ENT file, scroll down to the &amp;lt;code&amp;gt;&amp;lt;UserDefinedVariables&amp;gt;&amp;lt;/code&amp;gt; tag and change the &amp;lt;code&amp;gt;EntityType&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;Prop_Pickup&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;UserDefinedVariables EntityType=&amp;quot;Prop_Pickup&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now re-add the entity to the map. The '''Pickup''' section should now appear. Expand the section and set the ItemType attribute to the ID of the item type you created in &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;. Now, when you click on the item in-game it will be added to your inventory.&lt;br /&gt;
&lt;br /&gt;
===Item scripting===&lt;br /&gt;
Open the map script and add a new function called &amp;lt;code&amp;gt;CanUse_ItemName&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool CanUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asPickedEntity)&lt;br /&gt;
{&lt;br /&gt;
    if(asPickedEntity == &amp;quot;ExampleEntity1&amp;quot; || asPickedEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is one of the functions we set in the config file, and it determines which entities the item can interact with. The &amp;lt;code&amp;gt;asPickedEntity&amp;lt;/code&amp;gt; parameter contains the name of the entity the player is looking at at any given time. If the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, the player can use the item on the picked entity. In this example, the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the picked entity is named &amp;lt;code&amp;gt;ExampleEntity1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ExampleEntity2&amp;lt;/code&amp;gt; (ie. the player can use the item on either of these entities).&lt;br /&gt;
&lt;br /&gt;
Finally, let's add one more function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool OnUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asTargetEntity, const tString &amp;amp;in asItemEntity, float afTimeElapsed, float afTimeStep)&lt;br /&gt;
{&lt;br /&gt;
    if(asTargetEntity == &amp;quot;ExampleEntity1&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity1&lt;br /&gt;
    }&lt;br /&gt;
    else if(asTargetEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity2&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This code runs when the player clicks on an entity while holding the item. As shown above, this time the name of the clicked entity is stored in &amp;lt;code&amp;gt;asTargetEntity&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:CustomItemExample3_reupload.jpg|thumb|Picking up the test item|left]]&lt;br /&gt;
[[Image:CustomItemExample4_reupload.jpg|thumb|Using the test item on a door entity|left]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample3_reupload.jpg&amp;diff=5626</id>
		<title>File:CustomItemExample3 reupload.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample3_reupload.jpg&amp;diff=5626"/>
		<updated>2020-11-12T16:22:10Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample4_reupload.jpg&amp;diff=5625</id>
		<title>File:CustomItemExample4 reupload.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample4_reupload.jpg&amp;diff=5625"/>
		<updated>2020-11-12T16:21:34Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 uploaded a new version of File:CustomItemExample4 reupload.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample4_reupload.jpg&amp;diff=5624</id>
		<title>File:CustomItemExample4 reupload.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample4_reupload.jpg&amp;diff=5624"/>
		<updated>2020-11-12T16:20:21Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5623</id>
		<title>HPL3/Amnesia: Rebirth/Tutorials/Inventory items</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5623"/>
		<updated>2020-11-12T16:15:17Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will explain how to create a custom item that can be picked up, added to the inventory, and used on other entities.&lt;br /&gt;
&lt;br /&gt;
[[Image:CustomItemExample2.jpg|thumb|An example of a custom item in the inventory|right]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial==&lt;br /&gt;
&lt;br /&gt;
===Creating an ItemType===&lt;br /&gt;
Let's start by creating an item type. Keep in mind that an ItemType isn't the same as the physical in-game item entity, so a single ItemType can be used with multiple different entities.&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;config/Inventory.cfg&amp;lt;/code&amp;gt;. This file contains a list of all ItemTypes in the game. Add a new &amp;lt;code&amp;gt;&amp;lt;ItemType&amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ItemType ID=&amp;quot;ItemName&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Inventory Icon=&amp;quot;icon_file_name&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Use OnWorld=&amp;quot;true&amp;quot; CanUseOnWorldMapCallback=&amp;quot;CanUse_ItemName&amp;quot; UseOnWorldMapCallback=&amp;quot;OnUse_ItemName&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/ItemType&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The icons for items shown in the inventory are stored in &amp;lt;code&amp;gt;graphics/inventory/items&amp;lt;/code&amp;gt; and saved in the DDS format. Replace &amp;lt;code&amp;gt;icon_file_name&amp;lt;/code&amp;gt; with the name of your icon file, and change &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; to whatever you want to call your item type.&lt;br /&gt;
&lt;br /&gt;
Setting the &amp;lt;code&amp;gt;OnWorld&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; will allow this item &lt;br /&gt;
type to be used on other entities in-game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CanUseOnWorldMapCallback&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;UseOnWorldMapCallback&amp;lt;/code&amp;gt; are functions that determine which entities the  item type can interact with and what happens when it's used on an entity, respectively. We'll get back to these later.&lt;br /&gt;
&lt;br /&gt;
A detailed list of Use attributes and available functions is located in the beginning of &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;, but to keep things simple we'll only be using the three shown above.&lt;br /&gt;
&lt;br /&gt;
===Item name and description===&lt;br /&gt;
Now let's give the item a name and a description that will show up when the item is moused over in the inventory. Open &amp;lt;code&amp;gt;config/lang/english.lang&amp;lt;/code&amp;gt; and add two entries to the &amp;lt;code&amp;gt;Inventory&amp;lt;/code&amp;gt; category: &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemName_Desc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;LANGUAGE&amp;gt;&lt;br /&gt;
	&amp;lt;CATEGORY Name=&amp;quot;Inventory&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName&amp;quot;&amp;gt;Test Item&amp;lt;/Entry&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName_Desc&amp;quot;&amp;gt;This is a simple test item.&amp;lt;/Entry&amp;gt;&lt;br /&gt;
	&amp;lt;/CATEGORY&amp;gt;&lt;br /&gt;
&amp;lt;/LANGUAGE&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Placing the entity===&lt;br /&gt;
[[Image:CustomItemEntityTab.png|thumb|The Entity tab|right]]&lt;br /&gt;
In the level editor, choose an entity to represent the item in-game. Select it, open its '''Entity''' tab and look for a section called '''Pickup'''. If it isn't there, that means that the entity is either a physics object or a static object and you won't be able to pick it up in-game. In that case, open the entity's ENT file, scroll down to the &amp;lt;code&amp;gt;&amp;lt;UserDefinedVariables&amp;gt;&amp;lt;/code&amp;gt; tag and change the &amp;lt;code&amp;gt;EntityType&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;Prop_Pickup&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;UserDefinedVariables EntityType=&amp;quot;Prop_Pickup&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now re-add the entity to the map. The '''Pickup''' section should now appear. Expand the section and set the ItemType attribute to the ID of the item type you created in &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;. Now, when you click on the item in-game it will be added to your inventory.&lt;br /&gt;
&lt;br /&gt;
===Item scripting===&lt;br /&gt;
Open the map script and add a new function called &amp;lt;code&amp;gt;CanUse_ItemName&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool CanUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asPickedEntity)&lt;br /&gt;
{&lt;br /&gt;
    if(asPickedEntity == &amp;quot;ExampleEntity1&amp;quot; || asPickedEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is one of the functions we set in the config file, and it determines which entities the item can interact with. The &amp;lt;code&amp;gt;asPickedEntity&amp;lt;/code&amp;gt; parameter contains the name of the entity the player is looking at at any given time. If the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, the player can use the item on the picked entity. In this example, the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the picked entity is named &amp;lt;code&amp;gt;ExampleEntity1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ExampleEntity2&amp;lt;/code&amp;gt; (ie. the player can use the item on either of these entities).&lt;br /&gt;
&lt;br /&gt;
Finally, let's add one more function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool OnUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asTargetEntity, const tString &amp;amp;in asItemEntity, float afTimeElapsed, float afTimeStep)&lt;br /&gt;
{&lt;br /&gt;
    if(asTargetEntity == &amp;quot;ExampleEntity1&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity1&lt;br /&gt;
    }&lt;br /&gt;
    else if(asTargetEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity2&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This code runs when the player clicks on an entity while holding the item. As shown above, this time the name of the clicked entity is stored in &amp;lt;code&amp;gt;asTargetEntity&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:CustomItemExample3.jpg|thumb|Picking up the test item|left]]&lt;br /&gt;
[[Image:CustomItemExample4.jpg|thumb|Using the test item on a door entity|left]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample4.jpg&amp;diff=5621</id>
		<title>File:CustomItemExample4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample4.jpg&amp;diff=5621"/>
		<updated>2020-11-12T16:14:10Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemExample4.jpg to File:CustomItemExample4.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample4.jpg&amp;diff=5622</id>
		<title>File:Hpl3:CustomItemExample4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample4.jpg&amp;diff=5622"/>
		<updated>2020-11-12T16:14:10Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemExample4.jpg to File:CustomItemExample4.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[File:CustomItemExample4.jpg]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample3.jpg&amp;diff=5619</id>
		<title>File:CustomItemExample3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample3.jpg&amp;diff=5619"/>
		<updated>2020-11-12T16:14:04Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemExample3.jpg to File:CustomItemExample3.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample3.jpg&amp;diff=5620</id>
		<title>File:Hpl3:CustomItemExample3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample3.jpg&amp;diff=5620"/>
		<updated>2020-11-12T16:14:04Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemExample3.jpg to File:CustomItemExample3.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[File:CustomItemExample3.jpg]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample2.jpg&amp;diff=5617</id>
		<title>File:CustomItemExample2.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample2.jpg&amp;diff=5617"/>
		<updated>2020-11-12T16:13:23Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemExample2.jpg to File:CustomItemExample2.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample2.jpg&amp;diff=5618</id>
		<title>File:Hpl3:CustomItemExample2.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample2.jpg&amp;diff=5618"/>
		<updated>2020-11-12T16:13:23Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemExample2.jpg to File:CustomItemExample2.jpg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[File:CustomItemExample2.jpg]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemEntityTab.png&amp;diff=5615</id>
		<title>File:CustomItemEntityTab.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemEntityTab.png&amp;diff=5615"/>
		<updated>2020-11-12T16:12:37Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemEntityTab.PNG to File:CustomItemEntityTab.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemEntityTab.PNG&amp;diff=5616</id>
		<title>File:Hpl3:CustomItemEntityTab.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemEntityTab.PNG&amp;diff=5616"/>
		<updated>2020-11-12T16:12:37Z</updated>

		<summary type="html">&lt;p&gt;M654: M654 moved page File:Hpl3:CustomItemEntityTab.PNG to File:CustomItemEntityTab.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[File:CustomItemEntityTab.png]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5611</id>
		<title>HPL3/Amnesia: Rebirth/Tutorials/Inventory items</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5611"/>
		<updated>2020-11-11T17:13:56Z</updated>

		<summary type="html">&lt;p&gt;M654: Simplified some code to make it easier to understand what's going on&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will explain how to create a custom item that can be picked up, added to the inventory, and used on other entities.&lt;br /&gt;
&lt;br /&gt;
[[Image:Hpl3:CustomItemExample2.jpg|thumb|An example of a custom item in the inventory|right]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial==&lt;br /&gt;
&lt;br /&gt;
===Creating an ItemType===&lt;br /&gt;
Let's start by creating an item type. Keep in mind that an ItemType isn't the same as the physical in-game item entity, so a single ItemType can be used with multiple different entities.&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;config/Inventory.cfg&amp;lt;/code&amp;gt;. This file contains a list of all ItemTypes in the game. Add a new &amp;lt;code&amp;gt;&amp;lt;ItemType&amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ItemType ID=&amp;quot;ItemName&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Inventory Icon=&amp;quot;icon_file_name&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Use OnWorld=&amp;quot;true&amp;quot; CanUseOnWorldMapCallback=&amp;quot;CanUse_ItemName&amp;quot; UseOnWorldMapCallback=&amp;quot;OnUse_ItemName&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/ItemType&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The icons for items shown in the inventory are stored in &amp;lt;code&amp;gt;graphics/inventory/items&amp;lt;/code&amp;gt; and saved in the DDS format. Replace &amp;lt;code&amp;gt;icon_file_name&amp;lt;/code&amp;gt; with the name of your icon file, and change &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; to whatever you want to call your item type.&lt;br /&gt;
&lt;br /&gt;
Setting the &amp;lt;code&amp;gt;OnWorld&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; will allow this item &lt;br /&gt;
type to be used on other entities in-game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CanUseOnWorldMapCallback&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;UseOnWorldMapCallback&amp;lt;/code&amp;gt; are functions that determine which entities the  item type can interact with and what happens when it's used on an entity, respectively. We'll get back to these later.&lt;br /&gt;
&lt;br /&gt;
A detailed list of Use attributes and available functions is located in the beginning of &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;, but to keep things simple we'll only be using the three shown above.&lt;br /&gt;
&lt;br /&gt;
===Item name and description===&lt;br /&gt;
Now let's give the item a name and a description that will show up when the item is moused over in the inventory. Open &amp;lt;code&amp;gt;config/lang/english.lang&amp;lt;/code&amp;gt; and add two entries to the &amp;lt;code&amp;gt;Inventory&amp;lt;/code&amp;gt; category: &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemName_Desc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;LANGUAGE&amp;gt;&lt;br /&gt;
	&amp;lt;CATEGORY Name=&amp;quot;Inventory&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName&amp;quot;&amp;gt;Test Item&amp;lt;/Entry&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName_Desc&amp;quot;&amp;gt;This is a simple test item.&amp;lt;/Entry&amp;gt;&lt;br /&gt;
	&amp;lt;/CATEGORY&amp;gt;&lt;br /&gt;
&amp;lt;/LANGUAGE&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Placing the entity===&lt;br /&gt;
[[Image:Hpl3:CustomItemEntityTab.PNG|thumb|The Entity tab|right]]&lt;br /&gt;
In the level editor, choose an entity to represent the item in-game. Select it, open its '''Entity''' tab and look for a section called '''Pickup'''. If it isn't there, that means that the entity is either a physics object or a static object and you won't be able to pick it up in-game. In that case, open the entity's ENT file, scroll down to the &amp;lt;code&amp;gt;&amp;lt;UserDefinedVariables&amp;gt;&amp;lt;/code&amp;gt; tag and change the &amp;lt;code&amp;gt;EntityType&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;Prop_Pickup&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;UserDefinedVariables EntityType=&amp;quot;Prop_Pickup&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now re-add the entity to the map. The '''Pickup''' section should now appear. Expand the section and set the ItemType attribute to the ID of the item type you created in &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;. Now, when you click on the item in-game it will be added to your inventory.&lt;br /&gt;
&lt;br /&gt;
===Item scripting===&lt;br /&gt;
Open the map script and add a new function called &amp;lt;code&amp;gt;CanUse_ItemName&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool CanUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asPickedEntity)&lt;br /&gt;
{&lt;br /&gt;
    if(asPickedEntity == &amp;quot;ExampleEntity1&amp;quot; || asPickedEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is one of the functions we set in the config file, and it determines which entities the item can interact with. The &amp;lt;code&amp;gt;asPickedEntity&amp;lt;/code&amp;gt; parameter contains the name of the entity the player is looking at at any given time. If the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, the player can use the item on the picked entity. In this example, the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the picked entity is named &amp;lt;code&amp;gt;ExampleEntity1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ExampleEntity2&amp;lt;/code&amp;gt; (ie. the player can use the item on either of these entities).&lt;br /&gt;
&lt;br /&gt;
Finally, let's add one more function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool OnUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asTargetEntity, const tString &amp;amp;in asItemEntity, float afTimeElapsed, float afTimeStep)&lt;br /&gt;
{&lt;br /&gt;
    if(asTargetEntity == &amp;quot;ExampleEntity1&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity1&lt;br /&gt;
    }&lt;br /&gt;
    else if(asTargetEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity2&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This code runs when the player clicks on an entity while holding the item. As shown above, this time the name of the clicked entity is stored in &amp;lt;code&amp;gt;asTargetEntity&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Hpl3:CustomItemExample3.jpg|thumb|Picking up the test item|left]]&lt;br /&gt;
[[Image:Hpl3:CustomItemExample4.jpg|thumb|Using the test item on a door entity|left]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5610</id>
		<title>HPL3/Amnesia: Rebirth/Tutorials/Inventory items</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5610"/>
		<updated>2020-11-11T17:04:56Z</updated>

		<summary type="html">&lt;p&gt;M654: Added pictures&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will explain how to create a custom item that can be picked up, added to the inventory, and used on other entities.&lt;br /&gt;
&lt;br /&gt;
[[Image:Hpl3:CustomItemExample2.jpg|thumb|An example of a custom item in the inventory|right]]&lt;br /&gt;
&lt;br /&gt;
==Tutorial==&lt;br /&gt;
&lt;br /&gt;
===Creating an ItemType===&lt;br /&gt;
Let's start by creating an item type. Keep in mind that an ItemType isn't the same as the physical in-game item entity, so a single ItemType can be used with multiple different entities.&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;config/Inventory.cfg&amp;lt;/code&amp;gt;. This file contains a list of all ItemTypes in the game. Add a new &amp;lt;code&amp;gt;&amp;lt;ItemType&amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ItemType ID=&amp;quot;ItemName&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Inventory Icon=&amp;quot;icon_file_name&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Use OnWorld=&amp;quot;true&amp;quot; CanUseOnWorldMapCallback=&amp;quot;CanUse_ItemName&amp;quot; UseOnWorldMapCallback=&amp;quot;OnUse_ItemName&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/ItemType&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The icons for items shown in the inventory are stored in &amp;lt;code&amp;gt;graphics/inventory/items&amp;lt;/code&amp;gt; and saved in the DDS format. Replace &amp;lt;code&amp;gt;icon_file_name&amp;lt;/code&amp;gt; with the name of your icon file, and change &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; to whatever you want to call your item type.&lt;br /&gt;
&lt;br /&gt;
Setting the &amp;lt;code&amp;gt;OnWorld&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; will allow this item &lt;br /&gt;
type to be used on other entities in-game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CanUseOnWorldMapCallback&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;UseOnWorldMapCallback&amp;lt;/code&amp;gt; are functions that determine which entities the  item type can interact with and what happens when it's used on an entity, respectively. We'll get back to these later.&lt;br /&gt;
&lt;br /&gt;
A detailed list of Use attributes and available functions is located in the beginning of &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;, but to keep things simple we'll only be using the three shown above.&lt;br /&gt;
&lt;br /&gt;
===Item name and description===&lt;br /&gt;
Now let's give the item a name and a description that will show up when the item is moused over in the inventory. Open &amp;lt;code&amp;gt;config/lang/english.lang&amp;lt;/code&amp;gt; and add two entries to the &amp;lt;code&amp;gt;Inventory&amp;lt;/code&amp;gt; category: &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemName_Desc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;LANGUAGE&amp;gt;&lt;br /&gt;
	&amp;lt;CATEGORY Name=&amp;quot;Inventory&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName&amp;quot;&amp;gt;Test Item&amp;lt;/Entry&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName_Desc&amp;quot;&amp;gt;This is a simple test item.&amp;lt;/Entry&amp;gt;&lt;br /&gt;
	&amp;lt;/CATEGORY&amp;gt;&lt;br /&gt;
&amp;lt;/LANGUAGE&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Placing the entity===&lt;br /&gt;
[[Image:Hpl3:CustomItemEntityTab.PNG|thumb|The Entity tab|right]]&lt;br /&gt;
In the level editor, choose an entity to represent the item in-game. Select it, open its '''Entity''' tab and look for a section called '''Pickup'''. If it isn't there, that means that the entity is either a physics object or a static object and you won't be able to pick it up in-game. In that case, open the entity's ENT file, scroll down to the &amp;lt;code&amp;gt;&amp;lt;UserDefinedVariables&amp;gt;&amp;lt;/code&amp;gt; tag and change the &amp;lt;code&amp;gt;EntityType&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;Prop_Pickup&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;UserDefinedVariables EntityType=&amp;quot;Prop_Pickup&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now re-add the entity to the map. The '''Pickup''' section should now appear. Expand the section and set the ItemType attribute to the ID of the item type you created in &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;. Now, when you click on the item in-game it will be added to your inventory.&lt;br /&gt;
&lt;br /&gt;
===Item scripting===&lt;br /&gt;
Open the map script and add a new function called &amp;lt;code&amp;gt;CanUse_ItemName&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool CanUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asPickedEntity)&lt;br /&gt;
{&lt;br /&gt;
    return asPickedEntity == &amp;quot;ExampleEntity1&amp;quot; || asPickedEntity == &amp;quot;ExampleEntity2&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is one of the functions we set in the config file, and it determines which entities the item can interact with. The &amp;lt;code&amp;gt;asPickedEntity&amp;lt;/code&amp;gt; parameter contains the name of the entity the player is looking at at any given time. If the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, the player can use the item on the picked entity. In this example, the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the picked entity is named &amp;lt;code&amp;gt;ExampleEntity1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ExampleEntity2&amp;lt;/code&amp;gt; (ie. the player can use the item on either of these entities).&lt;br /&gt;
&lt;br /&gt;
Finally, let's add one more function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool OnUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asTargetEntity, const tString &amp;amp;in asItemEntity, float afTimeElapsed, float afTimeStep)&lt;br /&gt;
{&lt;br /&gt;
    if(asTargetEntity == &amp;quot;ExampleEntity1&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity1&lt;br /&gt;
    }&lt;br /&gt;
    else if(asTargetEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity2&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This code runs when the player clicks on an entity while holding the item. As shown above, this time the name of the clicked entity is stored in &amp;lt;code&amp;gt;asTargetEntity&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[Image:Hpl3:CustomItemExample3.jpg|thumb|Picking up the test item|left]]&lt;br /&gt;
[[Image:Hpl3:CustomItemExample4.jpg|thumb|Using the test item on a door entity|left]]&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample4.jpg&amp;diff=5609</id>
		<title>File:CustomItemExample4.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample4.jpg&amp;diff=5609"/>
		<updated>2020-11-11T17:02:16Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample3.jpg&amp;diff=5608</id>
		<title>File:CustomItemExample3.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample3.jpg&amp;diff=5608"/>
		<updated>2020-11-11T17:01:59Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemExample2.jpg&amp;diff=5607</id>
		<title>File:CustomItemExample2.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemExample2.jpg&amp;diff=5607"/>
		<updated>2020-11-11T17:01:28Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample.PNG&amp;diff=5606</id>
		<title>File:Hpl3:CustomItemExample.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:Hpl3:CustomItemExample.PNG&amp;diff=5606"/>
		<updated>2020-11-11T16:49:25Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=File:CustomItemEntityTab.png&amp;diff=5605</id>
		<title>File:CustomItemEntityTab.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=File:CustomItemEntityTab.png&amp;diff=5605"/>
		<updated>2020-11-11T16:47:35Z</updated>

		<summary type="html">&lt;p&gt;M654: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5590</id>
		<title>HPL3/Amnesia: Rebirth/Tutorials/Inventory items</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/Amnesia:_Rebirth/Tutorials/Inventory_items&amp;diff=5590"/>
		<updated>2020-11-10T22:01:52Z</updated>

		<summary type="html">&lt;p&gt;M654: Created page with &amp;quot;This tutorial will explain how to create a custom item that can be picked up, added to the inventory, and used on other entities.  ==Tutorial==  {{ConstructionNotice|Function...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial will explain how to create a custom item that can be picked up, added to the inventory, and used on other entities.&lt;br /&gt;
&lt;br /&gt;
==Tutorial==&lt;br /&gt;
&lt;br /&gt;
{{ConstructionNotice|Function parameter  explanations and example images coming soon|align=left|width=30%}}&lt;br /&gt;
&lt;br /&gt;
===Creating an ItemType===&lt;br /&gt;
Let's start by creating an item type. Keep in mind that an ItemType isn't the same as the physical in-game item entity, so a single ItemType can be used with multiple different entities.&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;config/Inventory.cfg&amp;lt;/code&amp;gt;. This file contains a list of all ItemTypes in the game. Add a new &amp;lt;code&amp;gt;&amp;lt;ItemType&amp;gt;&amp;lt;/code&amp;gt; tag:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;ItemType ID=&amp;quot;ItemName&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;Inventory Icon=&amp;quot;icon_file_name&amp;quot;/&amp;gt;&lt;br /&gt;
    &amp;lt;Use OnWorld=&amp;quot;true&amp;quot; CanUseOnWorldMapCallback=&amp;quot;CanUse_ItemName&amp;quot; UseOnWorldMapCallback=&amp;quot;OnUse_ItemName&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/ItemType&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The icons for items shown in the inventory are stored in &amp;lt;code&amp;gt;graphics/inventory/items&amp;lt;/code&amp;gt; and saved in the DDS format. Replace &amp;lt;code&amp;gt;icon_file_name&amp;lt;/code&amp;gt; with the name of your icon file, and change &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; to whatever you want to call your item type.&lt;br /&gt;
&lt;br /&gt;
Setting the &amp;lt;code&amp;gt;OnWorld&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; will allow this item &lt;br /&gt;
type to be used on other entities in-game.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;CanUseOnWorldMapCallback&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;UseOnWorldMapCallback&amp;lt;/code&amp;gt; are functions that determine which entities the  item type can interact with and what happens when it's used on an entity, respectively. We'll get back to these later.&lt;br /&gt;
&lt;br /&gt;
A detailed list of Use attributes and available functions is located in the beginning of &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;, but to keep things simple we'll only be using the three shown above.&lt;br /&gt;
&lt;br /&gt;
===Item name and description===&lt;br /&gt;
Now let's give the item a name and a description that will show up when the item is moused over in the inventory. Open &amp;lt;code&amp;gt;config/lang/english.lang&amp;lt;/code&amp;gt; and add two entries to the &amp;lt;code&amp;gt;Inventory&amp;lt;/code&amp;gt; category: &amp;lt;code&amp;gt;ItemName&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ItemName_Desc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;LANGUAGE&amp;gt;&lt;br /&gt;
	&amp;lt;CATEGORY Name=&amp;quot;Inventory&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName&amp;quot;&amp;gt;Test Item&amp;lt;/Entry&amp;gt;&lt;br /&gt;
		&amp;lt;Entry Name=&amp;quot;ItemName_Desc&amp;quot;&amp;gt;This is a simple test item.&amp;lt;/Entry&amp;gt;&lt;br /&gt;
	&amp;lt;/CATEGORY&amp;gt;&lt;br /&gt;
&amp;lt;/LANGUAGE&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Placing the entity===&lt;br /&gt;
In the level editor, choose an entity to represent the item in-game. Select it, open its '''Entity''' tab and look for a section called '''Pickup'''. If it isn't there, that means that the entity is either a physics object or a static object and you won't be able to pick it up in-game. In that case, open the entity's ENT file, scroll down to the &amp;lt;code&amp;gt;&amp;lt;UserDefinedVariables&amp;gt;&amp;lt;/code&amp;gt; tag and change the &amp;lt;code&amp;gt;EntityType&amp;lt;/code&amp;gt; attribute to &amp;lt;code&amp;gt;Prop_Pickup&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;UserDefinedVariables EntityType=&amp;quot;Prop_Pickup&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now re-add the entity to the map. The '''Pickup''' section should now appear. Expand the section and set the ItemType attribute to the ID of the item type you created in &amp;lt;code&amp;gt;Inventory.cfg&amp;lt;/code&amp;gt;. Now, when you click on the item in-game it will be added to your inventory.&lt;br /&gt;
&lt;br /&gt;
===Item scripting===&lt;br /&gt;
Open the map script and add a new function called &amp;lt;code&amp;gt;CanUse_ItemName&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool CanUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asPickedEntity)&lt;br /&gt;
{&lt;br /&gt;
    return asPickedEntity == &amp;quot;ExampleEntity1&amp;quot; || asPickedEntity == &amp;quot;ExampleEntity2&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is one of the functions we set in the config file, and it determines which entities the item can interact with. The &amp;lt;code&amp;gt;asPickedEntity&amp;lt;/code&amp;gt; parameter contains the name of the entity the player is looking at at any given time. If the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt;, the player can use the item on the picked entity. In this example, the function returns &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if the picked entity is named &amp;lt;code&amp;gt;ExampleEntity1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ExampleEntity2&amp;lt;/code&amp;gt; (ie. the player can use the item on either of these entities).&lt;br /&gt;
&lt;br /&gt;
Finally, let's add one more function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
bool OnUse_ItemName(const tString &amp;amp;in asItemType, const tString &amp;amp;in asItemID, const tString &amp;amp;in asTargetEntity, const tString &amp;amp;in asItemEntity, float afTimeElapsed, float afTimeStep)&lt;br /&gt;
{&lt;br /&gt;
    if(asTargetEntity == &amp;quot;ExampleEntity1&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity1&lt;br /&gt;
    }&lt;br /&gt;
    else if(asTargetEntity == &amp;quot;ExampleEntity2&amp;quot;)&lt;br /&gt;
    {&lt;br /&gt;
        // Insert code to interact with ExampleEntity2&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    return false;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This code runs when the player clicks on an entity while holding the item. As shown above, this time the name of the clicked entity is stored in &amp;lt;code&amp;gt;asTargetEntity&amp;lt;/code&amp;gt;.&lt;/div&gt;</summary>
		<author><name>M654</name></author>
		
	</entry>
</feed>