Gamepad Extender MVZ

● ARCHIVED · READ-ONLY
Started by Lone Wolf 39 posts Page 1 of 2 View original ↗
  1. Gamepad Extender MVZ
    (2/20/2024)

    That's right, I'm alive. There are a lot of reasons I didn't update WolfPad, but the simplest reason is just that MV's controller API support was complete ass. So what's the MVZ stand for? This is a version for MZ, that happens to be based off a private version for MV that I never bothered releasing. It will still work in MV, but plugin commands will not be available.

    Features:
    • Extends controller processing to support the full standard controller layout, including the second set of triggers, Start and Select buttons, analog sticks, and stick "buttons".
    • Support for an arbitrary number of controllers, with individual state management. Translation: enables multiplayer, though you'll need to write it yourself.
    • New plugin commands for controller vibration. Most other commands can be used with the event interpreter for conditional branches and variable assignment.
    • Fully-functional but still extremely vanilla API for use in "script" tags and other plugins.
    • For full details, see plugin help.
    Credit and Tanks:
    • Lone Wolf (me)
    • Yoji Ojima, for just outright exposing the Input core this time
    Terms of Use:
    If you use it, give credit to me (LoneWolf). With a few caveats:
    • I make no guarantees of compatibility with other scripts, especially not other Input module extensions.
    • Contact me via PM if you plan on using this in a commercial game. I probably won't charge anything, but I do like knowing it's out there.
    • Do not modify or redistribute this script by itself, though you may include it with your own script demos provided you include the plugin header in its entirety.
    FAQ:
    Q: What controllers are supported?
    A: Anything supported by the web browser's Gamepad API. This should include most if not all PC controllers from the last 10 years, as well as any newer XBox controllers. Support for non-standard mappings (as reported to the browser) is added as I find them.
    Q: Can you add support for more controllers?
    A: No. It is actually impossible without forking Chromium, which I am not going to do. PC drivers for console controllers should already be compatible if they work in newer PC games.
    Q: Your handle is basic. Who are you really?
    A: I have many names (and rarely use the same one twice). But I can say I have been doing this a very long time...

    Release Notes:
    • Added manufacturer detection, with support for Nintendo, Sony, and Microsoft pads at present (should useful for matching button prompts to the controller)
    • Added automatic mapping for pads which report the directional pad as the 10th axis (including DualSense and DualSense Edge)
    • New button hold/trigger handling to track buttons independently, not just the last pressed (enabled as a plugin option)
    • Compatibility option for the above, which includes the standard input core buttons (keyboard) as well (enabled as a plugin option)

    Version History:
    2/20/2024 - major update
    4/11/2021 - minor fixes and typo corrections
    9/12/2020 - initial release

    Download:
    (see attachment)
  2. I love this plugin, and it works as expected.

    Only have one question about the vibration. Is there a way to add it to battles?
    Like vibrate when hit or something?
  3. I am so sorry for the late reply. Apparently these forums no longer auto-follow threads you create yourself. (Or they never did and it really has just been that long since I posted anything...)

    As for your question, yes, it is entirely possible. You'd have to script it yourself, but it's as simple as creating a function that queues the effect you want, and then calling that at the appropriate point in the core battle scripts (or whatever ABS you're using). For the base engine, that would be Game_Action.prototype.executeDamage in rpg_objects.js.

    Look at Input.vibrationTest in WolfPadMVZ.js for a sample of how to build a complex vibration effect using the queue system. WolfPad will move through queued effects in order without requiring any extra timing control on your part. You can even add short pauses to an effect by sending in motor values of 0 with a specific duration.

    Input.vibration is a helper function that creates an effect object in the format used by the vibration queue. I'd also recommend using the designated functions (vibrate and haltVibration) and not directly manipulating the array, though.

    If all of this went entirely over your head, worry not. I may soon be whipping up an additional plugin to do something like this, because I'm going to need this functionality, too.
  4. looks really cool & looks like what I need but got no idea how to use it :LZYoops:

    edit> the vibrate function plugin command works cool but I don't understand how to map buttons to trigger a common event or trigger a switch.

    also: (see WolfPadMVX.js for complete list)

    where is wolfpadmvx?
  5. WolfPadMVX.js is the file download. Sounds like you've gotten the plugin commands working, at least. Next up, you'll need a tutorial on the "Parallel" event trigger.

    I'm sure there's also a tutorial out there for using script commands in events. Honestly, they're there, for completeness, but I still haven't found a use for them myself.
  6. does this plugin give you the ability to map the second joy stick on a ps4 or switch controller to the mouse movement? and to map r1 or r2 to mouse click?
  7. No to both, actually. It will work with any controller detected by Chromium's implementation of the Gamepad API, but only translates that information to RPG Maker's input spec. There are all sorts of other reasons you can't trigger mouse events directly, but those are ultimately irrelevant.

    You have to limit your thinking to player action and end result. You're not trying to use the gamepad to trigger a click, you're trying to use the gamepad to trigger the same action as a left click. Writing a software controlled "cursor" that tracks input from RMMZ's Input and Mouse classes is fairly trivial, as is writing actions that are triggered by either gamepad triggers or mouse buttons. All this plugin will help with is let you read the analog stick and a few extra buttons.

    If that doesn't sound trivial to you, though, I suggest starting with a more basic scripting tutorial, and maybe asking around in the Learning Javascript subforum. There are no shortcuts on the path to glory!
  8. Lone Wolf said:
    If that doesn't sound trivial to you, though, I suggest starting with a more basic scripting tutorial, and maybe asking around in the Learning Javascript subforum. There are no shortcuts on the path to glory!

    you are right I really should learn java script. I basically have no idea & minimal understanding about anything I'm doing. I know html. that's about it. :LZYoops:
  9. EDIT: Sorry found information I needed. unsure how to delete post.
  10. You'll want to replace pad* in that formula with an actual pad number (read the rest of that section), or leave it blank. You're not the first person to make that mistake, but it's something you'd pick on immediately after learning JavaScript syntax. It's sort of an unintentional proficiency test I left in.
  11. What controllers are supported? I'm using a USB to PS1/PS2 controller dongle with either an original PS1 controller or a dualshock 2.
  12. The unfortunate and rather technical answer is "whatever Chromium detects as a controller." Unlike my RGSS3 controller plugin, which expanded Direct X controller support to newer pads, this version is constrained entirely by the underlying NWJS/Chromium container. This version doesn't actually add extra controller support, just provides a better programming interface than what's there by default.

    Gamepad API - Web APIs | MDN
    However, you should be able to use Steam to map any old DirectInput pad to an XInput pad while in Desktop mode, and the resulting simulated gamepad should be picked up by RMMZ. Alternatively, if you're using custom drivers, see if they have an "Xbox controller" mode.

    It's a good question, though, so I added it to the FAQ.
  13. I want to use the D-Pad for button commands, but keep the analog stick for movement. Is it possible with your plugin ? I can't seem to make it work
  14. You'd have to modify Game_Player.prototype.getInputDirection to check the left stick instead of the directional inputs.

    Something like this, though you'll probably need to modify it a bit.
    JavaScript:
    Game_Player.prototype.getInputDirection = function() {
        return Input.lstick8() || Input.dir4;
    };
  15. I wrote this

    JavaScript:
    Game_Player.prototype.getInputDirection = function() {
        return (Input._isKeyboard) ? Input.dir4 : Input.lstick8();
    };

    I created the _isKeyboard property so the game can tell if the player is using the keyboard or the controller. When any button is pressed on a controller, _isKeyboard is turned to false and when any key is pressed on a keyboard, it's turned back to true.


    In my opinion, this code should work, but for some reason it doesn't. Any ideas ?
  16. It's starting to sound like the issue could be with how you implemented your _isKeyboard property. The default Input class will continue to combine keyboard and gamepad inputs, even with my plugin running, so it may not be distinguishing between them the way you want. Can you at least see if lstick8 works on its own?

    We can also take this to PM if you want me to look at any code that you don't want out in public.
  17. the issue was caused by the fact i use a pixel movement plugin, entirely rewriting how the movement inputs are handled

    I've done all my edits according to this and it works now. Thank you !
  18. Wow. I am definitely going to try this. I'd love to map an action to every ing button let's goooo yahoooo!!!!!!
  19. Kirby44 said:
    the issue was caused by the fact i use a pixel movement plugin, entirely rewriting how the movement inputs are handled

    I've done all my edits according to this and it works now. Thank you !
    And that would have been my second guess. Not the specific plugin, but that there was probably something else taking over the input handling. Glad you figured it out!
  20. It has been almost three years since the last update. Assuming anyone still cares, a new version has been released!

    This is an incredibly selfish update that improves support for certain pads I happen to own that don't get picked up correctly by NWJS, primarily the DualSense and DualSense Edge, as well as any other pads that report the D-pad as the 10th axis for some incredibly esoteric hardware reason. (Though all of these should have worked out-of-the-box, with some tradeoffs, if Steam Input was enabled.) The Switch Pro Controller, of all things, now works entirely independent of Steam Input, including force feedback, and I wasn't even targeting it beyond the ID check.

    Also included, by request, is an alternate hold-state tracking method that allows button holds to be checked regardless of whether or not it was the last button pressed, enabled via plugin settings. For compatibility, I've extended this capability to RMMZ's Input class, which can be enabled separately in the plugin settings.

    I am still watching this thread, so please drop any questions and feedback here for the public record (aside from usage inquiries, which should still go to PM).