[RMXP] PERMANENT BUTTON CONFIG?

Posts

Pages: 1
I was just testing my game from someone else's computer and I had to go into config to set up the V key as the R button. Normally in XP the R button is assigned to W only. But my game has it as both W and V because I feel that V is a more comfortable position for it. I can't assign it to other buttons because those are needed for other functions. When you play my game it tells you that you can slide with V or W. So it'd be terrible if players have to manually press F1 to config what I intended as default. Do any of you know how to make sure that my config for the V key stays with the game no matter who's computer it goes to? Is there something in the script I can alter?
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
You can't change the default button configs in RPG Maker XP. You can't make your game use the V key. Only the player can.

Furthermore, changing the button config in your RPG Maker XP game also changes it for all other RPG Maker XP games installed on your computer. The setting is not part of your game, it's part of the Windows registry entry for the engine.
Shit. Well I really want people to have the option of using the V key it's more comfortable than reaching for the W key. Should I just have a message near the start of the game telling people how to customize it that way? Or should said message pop up when the player first learns how to slide?
It just feels wrong. People are going to find it odd that I as the creator am suggesting a button config to them rather than providing it.

Does anyone have any suggestions?
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
One option is to use a script to completely replace RMXP's default method of handling keyboard input.

This script for example lets your game detect each specific key on the keyboard. For example it lets you use Keyboard.trigger(Keys::V) to detect when the player presses the V key, regardless of what they've set in the F1 menu. You can then do a find/replace in the game's scripts to replace
Input.trigger?(Input::R)
with
Keyboard.trigger(Keys::V)

This script doesn't make the default input method stop working though, it just gives you a second option. Which is good, because not everyone uses a keyboard. If you want the controller to still work as well, which I highly recommend, you should instead actually do a find/replace in the game's scripts to replace
Input.trigger?(Input::R)
with
(Keyboard.trigger(Keys::V) or Input.trigger?(Input::R))

I think this will actually work fine for what you want to accomplish. However it depends on your comfort level with scripts, since this will require not just importing a script but also editing your other scripts that use the R button.

If you can't get this option to work, my second suggestion is to give up and just tell the player early on that "You can press F1 to customize the keyboard layout" and "For example, many players prefer to set the V key on the keyboard to work as the R button, which is what you use to dodge" (or whatever the button does in your game)
I'm trying it right now but my scripting skills aren't that good.

So what I tried to do was I took that first script labeled Module and inserted that in. Next, I inserted that second script labeled Methods separately. Is that correct so far or were they supposed to be in the same insert?

After that I setup a call script in an event and typed:
find Input.trigger?(Input::R)
replace (Keyboard.trigger(Keys::V)

That got a syntax error.
So clearly I don't know how to do it. If you can give me a little more help, I'll try again. I appreciate the help LockeZ thanks.

If it's too much to teach than I suppose I can just tell the player about customizing controls but I would like to give this script another try.

Edit: Oh by find/replace do you mean using the control F to locate a line and replace the line of code? Which script would I search in then because the new script didn't seem to have that line? Well I guess I could just try to search all my scripts.

Edit: Also is there something in the Module or Method that I need to edit?
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
Just putting the module and methods in as two separate scripts is fine. You don't need to edit anything in them.

When I say find/replace, I mean go into the script editor for each script and press Ctrl-F to do a find/replace. As for which scripts to do it in... well, the most thorough method would be to do it in every script in your game. But you might not need all that. It also might not actually be enough, if you're detecting the R key in an event command somewhere. What is the R key actually used for in your game? Some minigame that's part of another script, or just the normal stuff in the menus?
The way R button is used in my game is in two Common Events that are on through most of the game. They are fairly long events but basically I'll try to give a sort of summary example of the way they involve the R button:

Conditional Branch: The R button is being pressed
Conditional Branch: The player is facing down
Set Move route Player
Graphic "Lanoa Ducking"
Wait for moves completion
Control Switches 0598Duck is ON

Another Example is:

Conditional Branch: The Down button is being pressed
Conditional Branch: The R button is being pressed
Control Switches 0597Sliding is ON
Play SE 'swing'
Set Move route Player
Graphic "Lanoa Sliding"
Change Speed 5
Move Down
Move Down
Change Speed 4
Wait 1

So do I just need to put something into those Common Events?
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
OK, it's less complicated than I thought, then. You won't actually have to edit any scripts, since you only want to change how the R button works in your common event and not in the rest of the game.



First, import those two scripts, which you already did.

Second, in your two common events, change those conditional branches from "The R button is being pressed" to "Script". In the script box put:
(Keyboard.trigger(Keys::V) or Input.trigger?(Input::R))

That'll make it so the events trigger when the player presses the R button OR the V key.
So I followed your instructions and this is what's happening so far; I got an error screen saying:

Script 'Custom controls Methods' line 130: NoMethodError occurred.
undefined method `include?' for nil:NilClass


The line in question reads the following:

return @used_i.include?(key)

I'm going offline soon because it's night time in my time zone but I'll try again tomorrow. Thanks for your help so far LockeZ.
I copied and pasted the line that you gave me so that should be fine so maybe line 130 needs to change. What do you think?
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
Aha, just read his post in a little more detail.

Go into the script editor and find the Scene_Map script, it's one of the default scripts.

Line 22 should be:
       Graphics.update


Add another line right after that, that says:
       Keyboard.update

There is good news and bad news.

Good news is nothing is crashing, the script now works.

The bad news is that the script doesn't seem like it was made with button holding in mind. It only seems to notice pressing of a button.
Noramly in my game if you hold down either the W or V key Lanoa will duck down and from there you can choose to slide in a direction.
But now holding the W key is like pressing it once because she ducks for a split second then stands up. As for the V key, holding that down has Lanoa flicker back and forth between ducking and standing.
Because in my game, to stop ducking is as simple as letting go of the button but since the script handles things as presses it doesn't work.

So is there a way to make it understand holding the button?

If not I suppose I'll just have to explain customization to the player?

Another option I just tried was to make a different button for standing back up but that's rather awkward. For example say you are playing Megaman or Street Fighter, you duck by holding the down button and get back up by releasing it. It'd be weird if you had to press a separate button to get back up.

Edit: Well regardless, it was still worth a try I apprieciate your help LockeZ. I believe this is the second time you helped me with a script. The last time it worked. This time it might not but either way I thank you for your time.
LockeZ
I'd really like to get rid of LockeZ. His play style is way too unpredictable. He's always like this too. If he ran a country, he'd just kill and imprison people at random until crime stopped.
5958
Sorry it didn't work. There might be another alternate keyboard input script out there if you're feeling adventurous. Let me know if you try another script out and are having problems. I'm vastly more familiar with RMXP scripting than with the later engines.
Pages: 1