Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[XP]Calling a common event with button press

Acera

Sponsor

Hello, I'm looking for a script which can call a common event when I press a button, I'm using Aleworks' scripts for the input. According to his script this checks if a button is being pressed:

Code:
Input.press?(vk)

Furthermore I want to show 2 variables at a certain location. I can figure out the coords myself, so you can just fill in x,y instead of coords. There is no need for a window around it, I will make that with a picture. Also, these variables should update (like the playtime updates in the default menu).

If you could be so kind to comment as much as possible, I'd like to learn this myself (I *think* it's not that hard, but I can't figure out how to do this myself yet >.<)

I think I covered everything, else just poke me and I'll add it asap.

Thanks in advance,
~Acera
 
I know, I know.  I shouldn't just turn around and say you can use events.  But you can and I'm an administrator with power to abuse :)

Create a switch. For this example I'm going to call it "input switch"
Create your common event (if you haven't already).  I'll call it "result event"
Create a secondary common event, and this is very simple and effective, I'm going to call this one "input event"

Make Input Event a parallel process, and set it's trigger to switch "input switch".
Add a conditional, the call script will work - you don't have to set it to have an else case if you don't want to.  Now what you do is you, inside the conditional in "input event", is put in a call common event command.  Have it call "result event".

All you do is turn the switch "input switch" on (possibly at start of game) and it will work.

My test was simple, the common event "result event" did only one thing, show text "!".  You can make it whatever you want obviously.

When I started a new game and pressed the A button nothing happens.  This way if I had cutscenes or parts of the game where I wanted the event not to happen, it won't.  When the switch is turned on and I press the A button the dialogue window shows "!" exactly as I set it.

If you had set "result event" to be a move route jump, or anything, it would have triggered.

I know it's not a script, but it's fairly quick and easy.  Hope that helps.
 

Acera

Sponsor

The problem with that is the variables, I need to show 2 of them at different locations. I currently have one set up like that, but it doesn't have to show any 'special things'. I also prefer to do as much with events as possible, but I can't do this one :<
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top