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!)
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
GREAT! Thanks! Exactly what I needed. ;D