The RPG Maker Resource Kit

Other Game Creation => Program Troubleshooting => Topic started by: Doyora on April 10, 2006, 03:23:01 PM

Title: Making your character move quicker when you press a button.
Post by: Doyora on April 10, 2006, 03:23:01 PM
I would like to know of a way to make your character run when you press a button. I would prefer run toggling rather than holding. I HAVE searched to see if it is on this forum, or any other, and I have found nowt.

If anyone could help, please?
Title: Re: Making your character move quicker when you press a button.
Post by: Tyhan on April 10, 2006, 04:51:06 PM
Theres a dash script somewhere, but you'd need running sprites.  Also this can easily be done with events.... make a common event...

Make a switch called Dash
Make a conditional branch to check if the switch Dash is on.
If it is... Make it...
When button [A] is pressed walking speed = 4
Turn Switch [Dash] off.
Else
When Button [A] is pressed walking speed = 5
Turn Switch [Dash] on.
Title: Re: Making your character move quicker when you press a button.
Post by: Blizzard on April 10, 2006, 04:59:58 PM
Use this.

[code]if Input.trigger?(Input::L)
Title: Re: Making your character move quicker when you press a button.
Post by: Doyora on April 10, 2006, 06:49:56 PM
Thanks. But wait... I don't understand. Could you explain again please? I also forgot to say I'm using RPG maker XP. :oops:
Title: Re: Making your character move quicker when you press a button.
Post by: Blizzard on April 10, 2006, 07:52:23 PM
Okay, here:

red - scripts button, press it to open the scripts window
green - the script names, find Gaem_Character2 as I did.
cyan - find def update and paste the code below in
blue - just like I did (mine differs from yours, bcoz I use mine only for debug)

Just paste the code I posted in my post above there, where the code on this screenshot is.

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg449.imageshack.us%2Fimg449%2F529%2Fsnap387bx.png&hash=e6d9b4792f51631df7b0ed0a295cb47138ce5cd1)
Title: Re: Making your character move quicker when you press a button.
Post by: Sir Hiro on April 10, 2006, 09:57:21 PM
im using this code also :), but im wondering is there a way to make it last for like 3 second and then you have to wait like 10 seconds before you can use it again?
Title: Re: Making your character move quicker when you press a button.
Post by: Blizzard on April 10, 2006, 10:26:40 PM
It
Title: Re: Making your character move quicker when you press a button.
Post by: Doyora on April 11, 2006, 07:15:47 AM
 :mrgreen: Awww yeah. It works! thanks. Just one more thing... is there a way of making it so tha this only works after a switch has been turned on? Then, I'm done. Thanks!
Title: Re: Making your character move quicker when you press a button.
Post by: Blizzard on April 11, 2006, 11:09:22 AM
Sure. Use one of the game switches. Just replace the old code i gave you with this one. Replace the XXXX with the ID number of the in game switch you want to use. Now, turning on the switch will allow dash.

[code]if $game_switches[XXXX] == true
Title: Re: Making your character move quicker when you press a button.
Post by: Doyora on April 11, 2006, 12:06:18 PM
Aargh no! I put this in, but now when I trigger the switch ON nothing happens.  :-( (the switch ID is 0061 I think)

EDIT: also I forgot to ask if you could switch to a new set of sprites when you begin to run. this is because the idea is you hit a switch, you gain the ability to turn into a monster and run dead fast. You press the change into button, and you turn into the monster and can run quickly. you press it again and you change back.
Title: Re: Making your character move quicker when you press a button.
Post by: Blizzard on April 11, 2006, 05:35:47 PM
Then it
Title: Re: Making your character move quicker when you press a button.
Post by: Doyora on April 11, 2006, 09:23:39 PM
OK thanks, I think I've got it cracked now... I hadn't realised how you could change your own speed using events... DUH. I will report back my success. Thanks all!

UPDATE: Yep, I got it all working now. It's kind of a strange way to do it, but you 'activate' run mode by using an item. this toggles run mode on/off. It may sound clumsy, but it works well in practice.