Difference between revisions of "HPL3/Amnesia: Rebirth/Tutorials/Custom Menu"
(Added a missing section WIP) |
(→Rotating the camera in a 3D menu: useful link) |
||
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.
Contents
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
.
/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.
If you wish to have a custom 2D menu like the original one, it will be fully done in the Menu script module.
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.
/* (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.
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.