Difference between revisions of "HPL2/Tutorials/Coin chests"

From Frictional Wiki
Jump to navigation Jump to search
(Created)
 
m (clarified what window)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Amnesia has an unused coins mechanic that is actually functional. The player can collect coins and then open special chests by spending these coins.
+
Amnesia has an unused coins mechanic that is actually functional. The player can collect coins and then open special chests by spending these coins. These chests show a special GUI window for this mechanic.
  
 
{{warning | The coin mechanic has a bug in the older versions of the game where the required amount of coins gets reset to zero after loading a game save. If you use this mechanic, it would be good to inform the players that they need the [[HPL2/1.5_Update | 1.5 update]].}}
 
{{warning | The coin mechanic has a bug in the older versions of the game where the required amount of coins gets reset to zero after loading a game save. If you use this mechanic, it would be good to inform the players that they need the [[HPL2/1.5_Update | 1.5 update]].}}
Line 12: Line 12:
 
# Open <code>Settings > User defined variables</code>
 
# Open <code>Settings > User defined variables</code>
 
# Change the Type to "Chest" at the top of the newly opened window
 
# Change the Type to "Chest" at the top of the newly opened window
# Close the window and save the file
+
# You can also customise the speed at which the chest opens when the player spends money for it if you want
 +
# Close the properties window and save the file
  
 
Now you can place the chest in your mod and set the number of coins needed to open the chest.
 
Now you can place the chest in your mod and set the number of coins needed to open the chest.
  
 
{{idea| An easy way of placing custom entities is to place the original version, select it and then just swap the entity file under the general tab of entity properties.}}
 
{{idea| An easy way of placing custom entities is to place the original version, select it and then just swap the entity file under the general tab of entity properties.}}

Latest revision as of 22:00, 24 September 2023

Amnesia has an unused coins mechanic that is actually functional. The player can collect coins and then open special chests by spending these coins. These chests show a special GUI window for this mechanic.

Alert icon.png Warning: The coin mechanic has a bug in the older versions of the game where the required amount of coins gets reset to zero after loading a game save. If you use this mechanic, it would be good to inform the players that they need the 1.5 update.

The entities that add coins to the player's "purse" are 3 variants of pouches with thalers and can be either placed in a level through the editor (they can be found in the items folder under entities) or by specifying them as the item that appears when breaking vases, pots etc. The entity property for the latter is called "ContainedItem".

However, there is no coin chest entity in the game's files. To make use of this mechanic, you will need to create one:

  1. Start the Model Editor
  2. File > Open
  3. Navigate to and open /entities/gameplay/chest_small/chest_small.ent, for example. You can change other chests (e.g. the treasure chest) and even doors to work as a coin chest.
  4. Save as a new file in your mod folder, e.g. /custom_stories/MyMod/entities/chest_small_coins.ent
  5. Open Settings > User defined variables
  6. Change the Type to "Chest" at the top of the newly opened window
  7. You can also customise the speed at which the chest opens when the player spends money for it if you want
  8. Close the properties window and save the file

Now you can place the chest in your mod and set the number of coins needed to open the chest.

Icon idea.png Idea: An easy way of placing custom entities is to place the original version, select it and then just swap the entity file under the general tab of entity properties.