Key combinations

Started by NS917 on

Topic category: Mod design feedback

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Key combinations
Sat, 05/20/2023 - 03:36 (edited)

so im making a Naruto mod and i wanted to make jutsu's work like instead of other mods that just use items it uses keys as specific hand sign. so that when you perform jutsus you have to press one key then another in quick succession. the code works like this:

1.make however many keybinds you want (in my case 5) 

2. make logic variables based on how many keybinds you have

3. create a simple script that activates one variable to true when you press a key then 20 ticks later goes back to false

4. then, in each jutsu script (make sure its set to every player tick) create a if statement that checks if whatever the first key in the combination is true then after waiting 20 ticks another if statement that checks for the secound key combination to be true and if it is then the jutsu will activate

 

*note if you dont want to be able to spam jutsus then add a command to set both variables to false in the section where the jutsu is activated

this is what it should look like

 

 

 

this what each on key press script should look like

this is what your jutsu script should look like

Edited by NS917 on Sat, 05/20/2023 - 03:36