Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

Click here to join us on IRC (#charas on irc.freenode.net)!



  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Running !
« previous next »
  • Print
Pages: [1]

Author Topic: Running !  (Read 2439 times)

Offline Iori Raku

  • Otaku Ecchi
  • Initiate
  • *
  • Posts: 10
  • Anime Freak
Running !
« on: July 13, 2006, 05:14:10 PM »
Hi

My question is that how do i make my char run whenever i press
lets say the button "A" (it can be button "B") and when im not pressing it the char will walk normaly, i took this idea from Pokemon Ruby

Is it possible ?

By the way im using rpg maker 2003 but if you guys know it for rpg 2000 that will help me as well !

THANK YOU ! :hi:
Logged

Offline MrMister

  • damn u vile woman
  • Royal
  • *
  • Posts: 3,506
(No subject)
« Reply #1 on: July 13, 2006, 05:17:58 PM »
Totally doable.
This tut uses escape, I usually use shift.

"B Button" Run Tutorial
Devised by WhoopA / Dan Sandstrom
Contact: whoopa@whoopanetwork.com

--- Introduction
I almost always prefer a slower walking speed in an RPG. I really don't know why. However, this can sometimes be a pain in the *** on those larger maps. So I asked myself, "Why not make it so you can hold a button to run?"
"Wait just a minute," you're probably asking. "There's no way you han have two buttons held at once and have RM2k recognize it." Wrong.

--- Method of Attack
I'm going to show you a super-spiffy use of the Enter Password command... one that lets you hold down two keys at once. It's going to knock your socks off. This script uses a Common Event: Parallel Process that constantly watches the state of "Esc", or as I like to call it, the "B Button". Ah, now you know why funny named tutorial is called the B Button Run!
If "Esc" is pressed, then released, it goes into the menu as usual. If it's pressed and HELD, the player runs until the button is released, without going into the menu.

--- Conventions
Here's the standard conventions I use in all my tutorials.

* Numbers prefaced by "V[" or "Var[" are variables. Those without are switches.
* A line of script in an event begins with <>.
* All the scripts are displayed as how they should appear in the Event Commands dialog, with additional information in parenthesis.

--- Setup
The script is pure simplicity. Set up a Common Event: Parallel Process. I would recommend making it activate on switch - if you're using this script and an event is running, it can throw you into the menu at a bad time. You don't have to, but if you do (I repeat - it is recommended) check the "Appearance Conditions / Switch" box and select a switch to use. This must be ON in order for the script to take effect.
You'll also need to set aside one variable. It doesn't have to be permanently set aside - you can use it in other scripts if you like, but only as a temporary value as well.
Here we go!

--- The Script
Place this inside your common event.

<> Disable System menu

This way, we don't have that pesky menu opening at oddball times. We'll open it ourselves.

<> Enter Password: Var[0001: Temp] (Allowed keys: 6 (Esc), do not wait)
<> Fork: Var[0001: Temp] 6 (Same)

First, we check to see if Esc is down... since the entire script relies on Esc and all.

<> Wait: 0.2sec.

If the player wants to go into the menu, they need to release Esc before the second check. The Wait command gives them time to release the button. The average human reaction time is somewhere between 15 and 25 milliseconds - if you find you can't get into the menu easily, then change the wait duration to 0.3 or 0.4 seconds, but no more. The game appears lagged if it's anything more than that.

<> Enter Password: Var[0001: Temp] (Allowed keys: 6 (Esc), do not wait)
<> Fork: Var[0001: Temp] 6 (Same) (Add else case)

Check the state of Esc again. This time, add the else case because we have to go into the menu if it's been released.

<> Move event: Hero, Move speed up
<> Move all

Speed up the hero so it seems he's running. You may also want to change the hero walk graphic here.

<> Cycle

We next have to check the Esc button constantly so we can slow the hero back down if he's running. Best way to do that? Inside a loop.

<> Enter Password: Var[0001: Temp] (Allowed keys: 6 (Esc), do not wait)
<> Fork: Var[0001: Temp] 0 (Same) (Add else case)
<> Break cycle
<> End case

You see, we've constantly set the Enter Password to "do not wait for key" just because of this. If we told it to wait for a key and released Escape, it would stop at the Enter Password line and never continue... until we hit Esc again. Thus, we'd be stuck running forever, and never be able to get into the menu.

<> Wait: 0.0sec.

There's that infamous lag-killer again! Take it out and see what happens... if you dare.

<> End cycle
<> Move event: Hero, Move speed down
<> Move all

And slow the hero back down. I'll explain the "Move All"s in the Known Bugs section later on.

<> Else case
<> Call system menu
<> End case
<> End case

That ends the script. If you're using a custom menu, you can freely replace the "Call system menu" line with whatever code you are using to get into your menu, be it a teleport, call, change switch, show picture or whatever.

--- Known bugs
Remember those two Move All commands? When I was testing the script, I found if you held down the button just long enough so that it wouldn't go into the menu but your character wouldn't run, it would actually slow down your character... permanently. The move all commands prevent that, making sure the Speed Up and Speed Down commands are executed before the script continues. Of course, if you don't go into the menu your character might be treated to a sudden speedy step... it's a small price to pay though.
The other possible bug is if you don't use the Appearance Conditions switch and press Esc in the middle of an event, you'll suddenly jump into the menu. It's only minorly annoying if you're using the default menu but can be downright disastrous if you use a custom menu. Take heed young one.
Logged
you look like an orphan

Offline Iori Raku

  • Otaku Ecchi
  • Initiate
  • *
  • Posts: 10
  • Anime Freak
(No subject)
« Reply #2 on: July 13, 2006, 05:23:54 PM »
SWEETNES and AWASOMENESS !!!

I will put it to the test RIGHT NOW !!!

THANKS DUDE !!! :D
Logged

Offline Iori Raku

  • Otaku Ecchi
  • Initiate
  • *
  • Posts: 10
  • Anime Freak
(No subject)
« Reply #3 on: July 13, 2006, 06:18:05 PM »
Uhhh

Question....

When you open a Fork condition and cycle, do things go in there ?

Because the tutorial just says "add fork condition, add else"
but it never says what goes in "else" option same with cycle...

Is it too much asking if i ask someone to show me how the script
looks like when is done ?

I will apretiate it  ALOT !!!

THANKYOU !!!  :bend:
Logged

Offline Emerates

  • A. Hermit Esquire
  • Exemplar
  • *
  • Posts: 1,027
    • Emerates' Freewebs Site
(No subject)
« Reply #4 on: July 13, 2006, 08:05:02 PM »
Yeah, when you put in a fork condition, you put the stuff you want it to do between the condition and the part that says 'End'.
It should look like this, I think

:Condtional Branch: Hero Facing Up
<>; (What you want to do here)
-:End

That's the gist of it.
Logged

Offline oooog

  • Space Cowboy
  • Exemplar
  • *
  • Posts: 1,105
(No subject)
« Reply #5 on: July 13, 2006, 08:16:01 PM »
Also, just for future reference, to project yourself from some members.  Don't post more than one time in a row unless it's a bump.  That brings me to my next point.  Don't post a "Please anyone" post within a period of a week or so.  Final thing, the second post in your third post sequence, could have been put into your post through an edit.

This is just to help you out on the forum.
Logged

Offline Iori Raku

  • Otaku Ecchi
  • Initiate
  • *
  • Posts: 10
  • Anime Freak
(No subject)
« Reply #6 on: July 13, 2006, 08:24:14 PM »
Im going to get yell at after this.....

But first of all...THANKS MAN FOR RESPONDING !!

Now...i know that anything can go in the fork and cycle conditions...
but in the tutorial above it doesnt say what should be in there...
or thats how it works ?

Has anyone tried this tutorial before ?

And im sorry if i sound like a retard noob but i am a noob (i dont know about retard) >.<'

Please if anyone can make it abit clear for me  I WILL BOW DOWN !
i really need this for my game... :(

THANKS AGAIN FOR YOUR TIME !  
Logged

Offline MrMister

  • damn u vile woman
  • Royal
  • *
  • Posts: 3,506
(No subject)
« Reply #7 on: July 13, 2006, 09:28:02 PM »
I haven't used this script in a long time, test it with nothing in there and see what happens :D
Logged
you look like an orphan

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Game Creation »
  • Requests »
  • RPG Maker Programming »
  • Running !
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum