Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Input Mapping and Calling Common Events

Above all things, I am trying to avoid having 1 event that is 100 lines long on 100 different maps, because having to change one of them would spell disaster pretty quickly. For instance, treasure chests. If they draw from a loot table and that loot table is not a common event... welp.

So I am trying to have an input map which can then allow the player to do things in certain maps.
The easiest way I can think of how to do this is to use common events, but I cannot see an easy way to do this because:
http://www.rpgmakermv.co/resources/keyboard-plugin.143/

This plugin does not yet take variable values into account, but I can see it would be an issue if I wanted to. Right now, I'd have to put a parallel process event on every map that checks for Y being pressed, and if it is pressed, to call common event X.
What if Y changes? Then all the events break.
So I'd like scripts to be able to take variables into account whilst in the engine, but I cannot really see a way to do this very easily - at least, RM doesn't make it intuitive.

If you use Y...

if(Input.keyTriggered("Y")){
$gamePlayer.requestBalloon(1);
console.log("You pressed Y");
}

This will bring up a balloon. Ok.

What if I wanted, say, shootButton instead of Y?
(I am assuming at this point I'll be using an inputmapping script that will allow the player to bind Y to shootButton or whatever - I am assuming that if it is really this simple (it never is...) that I'll be able to call a certain variable and it'll check its mapping)

if(Input.keyTriggered(shootButton)){
$gamePlayer.requestBalloon(1);
console.log("You pressed Y");
}

yes?

How about calling a common event?

if(Input.keyTriggered(shootButton)){
callCommonEventFunctionHere(); + commonEventID
}

Which of these functions do I actually need?

http://rgss.razelon.com/class/Game_CommonEvent

Thanks ;-;

(Basically I'm trying to set up an ABS-lite but I'd rather avoid repeating events over multiple maps, and just have them all in one place in a few common events if I can!)
 

Chaucer

Towns Guard
Xy$
0.00
So, not sure if I quite understood this right, but from what I'm getting, you want to be able to call a key as a variable you can change ingame or change in a plugin value? I modified the script a little, the script has a variable button you can call(same as before) but the button can be changed. I added a Plugin Parameter that you can assign the button a value before the game starts, and I added a Plugin Command that you can change the button ingame by typing
JavaScript:
//key being the key you want to assign
shootButton=Key
and you can check if that button just like before simply by calling

Code:
if(Input.keyTriggered(Input.shootButton)){
     $gamePlayer.requestBalloon(1);
     console.log("You pressed shootButton");
not sure if this was what you wanted, apologies in advance if it's not, I didn't quite understand it all too clearly, hope it helps tho~
 

Attachments

Last edited:

eivl

Local Hero
Xy$
0.00
What if I wanted, say, shootButton instead of Y?
(I am assuming at this point I'll be using an inputmapping script that will allow the player to bind Y to shootButton or whatever - I am assuming that if it is really this simple (it never is...) that I'll be able to call a certain variable and it'll check its mapping)
Missed this part of the question.
Y is mapped to a keycode on the keyboard. your shootButton should just use the keycode instead and you are set.

JavaScript:
if(Input.keyTriggered(Input.shootButton)){
$gameTemp.reserveCommonEvent(1); //shootButton will call common event 1
 
The part with the Balloon is working fine when i tryed it. But the part with the common Event always gives me Error.
I dont know anything about Scripts and Plugins, i just copy paste things i did read here.
So i wanted to call CommonEvent Nr0004 by pressing Y key. And if i press Y it shows this Error: "callCommonEventFunctionHere is not defined". I would be crazy happy if somebody could explain me what exactly i have to write in this script to call CommonEvent0004 :)

 

eivl

Local Hero
Xy$
0.00
It would work just fine. It is limited to only using the K letter and it also depend on keyup, so you have to release it for it to call the event.
With my keyboard plugin you can micromanage any key, with any options and to call any script. It does need some knowleage so maybe i should add this to the documentation ;)
 
Top