HUD toggles tutorial

+

Guest 2364765

Guest
HUD toggles tutorial

I don't claim that my method is the best, in fact i think it's very clunky but it was done without IDE (script studio doesn't work) and any documentation so i just looked at other scripts and Gopher's Immersive HUD in order to make semi-proper key-bound on/off toggles for HUD.

Without further ado, let's get started.
Snippets:
Function for showing HUD:
Show HUD function: http://pastebin.com/CCBVtnkK
Hide HUD function: http://pastebin.com/Ar2qyLTL
Functions for getting each module (required!): http://pastebin.com/MUzgzyz1 <- this is clunky and could use a rewrite, but i don't know any methods, nor am i a natural-born programmer so this has to do for the time being.

Implementation:
Since we want key bound toggle, this functions will have to be implemented in a script that's responsible for handling input, which is
\scripts\game\player\playerInput.ws

Now, inside the file you need to paste the 3 snippet-functions and then look for a proper event to call them.
Personally i never use 3,4,5,6 keys to change signs so i figured that's the best place to hook. If you wish to do the same then simply search for this line(should be #1101):
Code:
				case 'SelectAard' :
As we want the 3 key, which switches to Aard to disable hud, we add below following line:
Code:
					HideHUD();
Calling our function, we repeat the process for Yrden, which is under the 4 key. This time we call ShowHUD() function, making entire segment look like this:
event OnSelectSign(action : SInputAction)
{
if( IsPressed( action ) )
{
switch( action.aName )
{
case 'SelectAard' :
GetWitcherPlayer().SetEquippedSign(ST_Aard);
HideHUD();
theSound.SoundEvent("gui_global_denied"); // Completely optional, plays a small "ding sound"
break;
case 'SelectYrden' :
GetWitcherPlayer().SetEquippedSign(ST_Yrden);
ShowHUD();
theSound.SoundEvent("gui_global_denied"); // Completely optional, plays a small "ding sound"
break;
case 'SelectIgni' :
GetWitcherPlayer().SetEquippedSign(ST_Igni);
break;
case 'SelectQuen' :
GetWitcherPlayer().SetEquippedSign(ST_Quen);
break;
case 'SelectAxii' :
GetWitcherPlayer().SetEquippedSign(ST_Axii);
break;
default :
break;
}
}
}

And with this, you should run your game and enjoy HUD toggles right under your fingertips!

Update: Custom keybinds
To add a new keybind you need to do three things:
Firstly go into \scripts\game\player\playerInput.ws
Find keybind registry entries, for eg:
Code:
theInput.RegisterListener( this, 'OnCommSprint', 'Sprint' );
And copy it, let's make it
Code:
theInput.RegisterListener( this, 'OnCommHUDOff', 'HUDOff' );
Now we need to setup an event that will fire for each keypress:
event OnCommHUDOff( action : SInputAction )
{
if( IsPressed( action ) )
{
GetMinimap2Module().ShowElement(false, false);
GetMinimap2Module().SetEnabled(false);
GetQuestsModule().ShowElement(false, false);
GetQuestsModule().SetEnabled(false);
GetControlsFeedbackModule().ShowElement(false, false);
GetControlsFeedbackModule().SetEnabled(false);
GetTimeLapseModule().ShowElement(false, false);
GetTimeLapseModule().SetEnabled(false);
GetBoatHealthModule().ShowElement(false, false);
GetBoatHealthModule().SetEnabled(false);
GetBossFocusModule().ShowElement(false, false);
GetBossFocusModule().SetEnabled(false);
GetCompanionModule().ShowElement(false, false);
GetCompanionModule().SetEnabled(false);
GetConsoleModule().ShowElement(false, false);
GetConsoleModule().SetEnabled(false);
GetDamagedItemsModule().ShowElement(false, false);
GetDamagedItemsModule().SetEnabled(false);
GetEnemyFocusModule().ShowElement(false, false);
GetEnemyFocusModule().SetEnabled(false);
GetEnemyHitEffectsModule().ShowElement(false, false);
GetEnemyHitEffectsModule().SetEnabled(false);
GetNPCNamesModule().ShowElement(false, false);
GetNPCNamesModule().SetEnabled(false);
GetHorsePanicBarModule().ShowElement(false, false);
GetHorsePanicBarModule().SetEnabled(false);
GetHorseStaminaBarModule().ShowElement(false, false);
GetHorseStaminaBarModule().SetEnabled(false);
GetItemInfoModule().ShowElement(false, false);
GetItemInfoModule().SetEnabled(false);
GetBuffsModule().ShowElement(false, false);
GetBuffsModule().SetEnabled(false);
GetOnelinersModule().ShowElement(false, false);
GetOnelinersModule().SetEnabled(false);
GetOxygenBarModule().ShowElement(false, false);
GetOxygenBarModule().SetEnabled(false);
GetWolfMedalionModule().ShowElement(false, false);
GetWolfMedalionModule().SetEnabled(false);
GetMessageModule().ShowElement(false, false);
GetMessageModule().SetEnabled(false);
GetWolfHeadModule().ShowElement(false, false);
GetWolfHeadModule().SetEnabled(false);
GetInteractionsModule().ShowElement(false, false);
GetInteractionsModule().SetEnabled(false);
}


}

Lastly we need to actually add the new key for the input to be recognized, go toDocuments\The Witcher 3 and open input.settings.

now depending on context of your action (because input is context-sensitive) you need to add your entry under appropriate tag. Personally i used [Exploration]
As last entry under that tag i added
Code:
IK_F2=(Action=HUDOff)
However you NEED to save the file and set it as read only as the game will remove unofficial entries from the file

Now F2 will hide the HUD, congrats we've added a new keybind!
 
Last edited by a moderator:
Hey skacikpl!

Thanks for the tutorial adapted my mod (Photomode2inOne) based on your explanations :D

Now a tip!

I found out that if you add the line needed for the custom Action in the "input.xml" at "bin\config\r4game\user_config_matrix\pc"
(In practice, creating a new configurable key to the Keyboard bindings in menu)

You DON'T HAVE to set the "input.settings" to "Read Only", It will work as a native keyboard hotkey setting.

The line for the HUDOff would be like:
<Var builder="Input" id="HUDOff" displayName="HUDOff" displayType="INPUTPC" actions="HUDOff" />

There is a "How to" in the first lines of the file! Take a look for better understanding.
(Didn't understand the part that it says the "actions names" should be in the "input_qwerty.ini", if you find out something let me know)
 
Top Bottom