Main Menu
  • Welcome to The RPG Maker Resource Kit.

Character speed decreasing and increasing

Started by Demonic Blade, May 28, 2008, 01:11:41 PM

0 Members and 1 Guest are viewing this topic.

Demonic Blade

As most will probably already know, you can easily change the speed and frequency of characters in the game using simple events, or (I wager) with scripts. However, there are only 6 speeds to choose from. My question is this:

How would I go about using a 4.1 speed for example?
I'd like it for using call scripts, and being able to use it in conditional branches.

(I'm making a minigame where you race against an NPC - speed is of big matter here!)
I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!

Zeriab

First we need a way to access and write to the move speed.
This basically means that you should copy and paste the following code somewhere above main in the script editor.
class Game_Character
  attr_accessor :move_speed
end


After this you can set the movement speed through script calls
$game_player.move_speed = 4.5 # Set it to 4.5
$game_player.move_speed -= 0.1 # Decrease by 0.1
$game_player.move_speed += 0.1 # Increase by 0.1


For conditional branch you can put something like this in the script part:
$game_player.move_speed > 4.5
This will check if the movement speed is above 4.5. If not, then the else branch is run instead (if it exists).

The comparisons you can are:
>  # Greater than
>= # Greater than or equals
== # Equals
<= # Less than or equals
<  # Less than
!= # Not equals


I hope this is enough for you to figure out the rest

*hugs*
- Zeriab

Demonic Blade

I wonder how many of my-reps are there for a reason, and not just because some jackass wanted to show off in front of some other jackasses...?
Probably a lot of them - and those people sure as hell don't deserve my pity, let alone my disgust.
That's right, let's see some more -Rep'ing! BOOYEAH!!