Jump to content

[SOLVED][1.19.2] custome keybind whit keymap default to more than one keys like [leftshift + left control]


perromercenary00

Recommended Posts

holl good days 

im doing something with keybindings and i want this actions set to activated some traps

and i want set this action to combination of keys but the player must  have the possibility to change this keys 

so basically i need to establish mi keybind to 
leftshift + x

leftshift + c

leftshift + v

leftshift + left control 

but the key bind tutorial im folowing only allows one key per action in this case the default gonna be the leter "O" [GLFW.GLFW_KEY_O]

//

	public class KeyBinding {
	public static final String KEY_CATEGORY_TUTORIAL = "Merctool";
	public static final String KEY_DRINK_WATER = "Drink_WATA";
	public static final KeyMapping DRINKING_KEY = new KeyMapping( KEY_DRINK_WATER, KeyConflictContext.IN_GAME,
	InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_O, KEY_CATEGORY_TUTORIAL ); //<------- ??
	}
	

 

##

how i do to set this KeyMapping to use two keys ¿¿

GLFW.GLFW_KEY_LEFT_SHIFT + GLFW.GLFW_KEY_LEFT_CONTROL ??????

 

sooo by default looks like this 

2023-03-17-08-01-25.png

 

 




 

 

Edited by perromercenary00
solved
Link to comment
Share on other sites

Unless it's not working, I think that is how it should look.

Additionally, SHIFT and Left Control are already bound to Crouch and Sprint, so that might be a contributing factor as to why it wouldn't work.

I'm not good at modding, but at least I can read a crash report (well enough). That's something, right?

Link to comment
Share on other sites

o nonono 
mi english is not soo good

when you define a keybind you do an 

	public static final KeyMapping DRINKING_KEY = new KeyMapping(
	KEY_DRINK_WATER,
	KeyConflictContext.IN_GAME,
	InputConstants.Type.KEYSYM,
	GLFW.GLFW_KEY_O, <-------
	KEY_CATEGORY_TUTORIAL ); 
	

this lines define the keybind and set the initial/default value to "O" the user can change it later to whatever hi want in the menu 

i want in this case the initial/default value to be control + shift 
and the player can change it later if it want it 

	public static final KeyMapping DRINKING_KEY = new KeyMapping(
	KEY_DRINK_WATER,
	KeyConflictContext.IN_GAME,
	InputConstants.Type.KEYSYM,
	keys=[GLFW.GLFW_KEY_LEFT_SHIFT + GLFW.GLFW_KEY_LEFT_CONTROL],  <------- this part of here
	KEY_CATEGORY_TUTORIAL ); 
	

 

Link to comment
Share on other sites

i found something 


	public static final KeyMapping DRINKING_KEY =
	new KeyMapping( "DrinkingWater",
	KeyConflictContext.IN_GAME,
	KeyModifier.SHIFT,
	InputConstants.Type.KEYSYM,
	GLFW.GLFW_KEY_LEFT_CONTROL,
	KEY_CATEGORY_TUTORIAL
	);
	

KeyModifier.SHIFT, KeyModifier.CONTROL,KeyModifier.ALT

is weird coze you cannot combine whatever you want only this 3 options 

but its good enough for me soo it leit as solved

 

 

Link to comment
Share on other sites

  • perromercenary00 changed the title to [SOLVED][1.19.2] custome keybind whit keymap default to more than one keys like [leftshift + left control]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.