Difference between revisions of "HPL3/Amnesia: Rebirth/Tutorials/Custom Menu"

From Frictional Wiki
Jump to navigation Jump to search
(Added a missing section WIP)
 
Line 47: Line 47:
 
However, that is very limiting and can become frustrating, so instead we can use a camera animation to set the view as we want.
 
However, that is very limiting and can become frustrating, so instead we can use a camera animation to set the view as we want.
  
First, place a CameraAnimation area where you want your camera to point. Make sure to call it "CameraAnimation_1" - or use a different name, but match it with the script.
+
First, place [[HPL3/Areas/Camera Animation Area|a CameraAnimation area]] where you want your camera to point. Make sure to call it "CameraAnimation_1" - or use a different name, but match it with the script.
  
 
Then, go to the map script and add this line to OnEnter: <code>CameraAnimation_Begin("CameraAnimation", "", false);</code>
 
Then, go to the map script and add this line to OnEnter: <code>CameraAnimation_Begin("CameraAnimation", "", false);</code>

Latest revision as of 22:32, 9 November 2020

This tutorial will show you how to make a custom menu for your mod. It assumes you set up your mod and were able to run a basic map.

Preparing the map

Make your map as you want. The map only needs a player spawn called PlayerStartArea_1 (it can be named differently, but you will need to correct that in script later).

If you don't want a 3D menu, the map should be empty (asides from the player spawn).

If you are planning to make the map 3D, you can make the map at this point. It will be easier if we complete other steps first, however.

Finally, make sure to copy the original script: /maps/main_menu/main_menu.hps to your map's folder and rename the script with the same name as your map.

Setting up a custom module

The menu is handled by a script module the filepath to which is /script/custom/modules/MenuHandler.hps. Copy it and place it in a similar place in your mod, i.e. /mods/YourMod/script/custom/modules/MenuHandler.hps.

Icon tip.png Tip: Engine modules are placed in /script/modules/. Game-specific modules are placed in /script/custom/modules/.

From now on, you should be able to change that module and see the changes in your mod.

Icon tip.png Tip: If you're using CodeLite (which you should), you will need to re-add the game folders again to see new files (read the set-up guide to see how).

Making a custom 2D menu

If you wish to have a custom 2D menu like the original one, it will be fully done in the Menu script module.

Wip icon.png Altering the 2D menu needs testing and experience - this part of the tutorial is to come.


Setting up for a 3D menu

If you want a 3D menu, you will need to at least remove the menu background art.

To do that, open your MenuHandler module and Ctrl+F search this: menu_bg_uw_background.png. That will take you to the start of the section you need to comment out; make sure to comment everything from "Background" to "Animated texture graphics". You can also comment out the vignette effect if you wish.

Icon tip.png Tip: Use this syntax to comment out big chunks of code at the same time: /* (commented code here) */

This is also the section where you can edit the logo which appears in the menu. Just swap the PNG filename to a custom one.

Wip icon.png Moving the menu piece around - coming soon


Rotating the camera in a 3D menu

If you tried placing something in the map and loading it, you might notice the camera always looks into a certain direction, no matter how the player spawn is roated. If you're making a map from scratch, this should not be a problem, since you can just make the map where the camera points.

However, that is very limiting and can become frustrating, so instead we can use a camera animation to set the view as we want.

First, place a CameraAnimation area where you want your camera to point. Make sure to call it "CameraAnimation_1" - or use a different name, but match it with the script.

Then, go to the map script and add this line to OnEnter: CameraAnimation_Begin("CameraAnimation", "", false);

This will start a camera animation which will iterate through all CameraAnimation areas that start with "CameraAnimation" in their name. Since we only have one and it's move time is set to zero, the animation will just teleport the camera to our area and leave it there. You can of course make actual camera animations in the menu if you wish, but that goes beyond the scope of this tutorial.

After these edits, you will be able to reload the map menu and see your changes in the 3D map.

Setting the map as the menu in the mod release

Wip icon.png Coming soon