Szibes

Villager
Member
Joined
Mar 5, 2021
Messages
22
Reaction score
4
First Language
Polish
Primarily Uses
RMVXA
The engine counts how many steps player has taken, but I noticed that steps taken by player with "set move route" are not counted, is there a way to change that?

Context:
I was trying to make an event that checks the distance between itself and nearest impassable objects in a straight line. I tried to do that by setting variable-a=steps, setting player move route with "skip if cannot move" enabled, setting variable-b=steps and the subtracting a from b. Then I checked variables with messages and noticed what I mentioned above.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,170
Reaction score
15,542
First Language
English
Primarily Uses
RMMV

I've moved this thread to RGSS3 Script Requests. Thank you.

 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
965
Reaction score
470
First Language
PT-BR
Primarily Uses
RM2k3
You can do a constant verification with a parallel process:
Code:
@>Conditional Branch: Script: !$game_player.moving?
    @>Comment: Player is not moving
    @>
 :  Branch End
@>

Command:
Is Moving -----> $game_player.moving?
Stoped -----> !$game_player.moving?

It's possible to do only with events, but the event gets big unnecessarily.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,384
Reaction score
804
First Language
English
Primarily Uses
RMVXA
Ruby:
class Game_Character < Game_CharacterBase
  alias r2_move_route_update_step   process_move_command
  def process_move_command(command)
    r2_move_route_update_step(command)
    case command.code
    when ROUTE_MOVE_DOWN;         $game_party.increase_steps
    when ROUTE_MOVE_LEFT;         $game_party.increase_steps
    when ROUTE_MOVE_RIGHT;        $game_party.increase_steps
    when ROUTE_MOVE_UP;           $game_party.increase_steps
    when ROUTE_MOVE_LOWER_L;      $game_party.increase_steps
    when ROUTE_MOVE_LOWER_R;      $game_party.increase_steps
    when ROUTE_MOVE_UPPER_L;      $game_party.increase_steps
    when ROUTE_MOVE_UPPER_R;      $game_party.increase_steps
    when ROUTE_MOVE_RANDOM;       $game_party.increase_steps
    when ROUTE_MOVE_TOWARD;       $game_party.increase_steps
    when ROUTE_MOVE_AWAY;         $game_party.increase_steps
    when ROUTE_MOVE_FORWARD;      $game_party.increase_steps
    when ROUTE_MOVE_BACKWARD;     $game_party.increase_steps
    end
  end
end
 

Szibes

Villager
Member
Joined
Mar 5, 2021
Messages
22
Reaction score
4
First Language
Polish
Primarily Uses
RMVXA
I think problem was solved, Roninator's solutions worked as intended, thanks.
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
376
Reaction score
136
First Language
English
Primarily Uses
RMXP
This code should avoid making too many checks only to let you increase the party's steps. Let's say it's an optimization of ronin's.

Ruby:
class Game_Character
  alias r2_move_route_update_step   process_move_command
  def process_move_command(command)
    r2_move_route_update_step(command)
    range = ROUTE_MOVE_DOWN..ROUTE_MOVE_BACKWARD
    $game_party.increase_steps if range.include?(command.code)
  end
end

By the way, you don't need to redefine nor redeclare the superclass of an existing class, @Roninator2
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
3,384
Reaction score
804
First Language
English
Primarily Uses
RMVXA
@kyonides I guess it depends on what you are defining. In my experience, it always gave me an error for mismatched class.

But that is definitely a good short form for my code
 

Latest Threads

Latest Posts

Latest Profile Posts

both love and pain have no boundaries
Happy Saint Nicholas Day! May there nice stuff in your shoes when you wake up!
Choosing Beggars are the best source of entertainment.
DavidUchina wrote on caethyril's profile.
You chad, thanks a lot for your plugins. You helped me costumize the buttons in my game.
I created the first teaser for my game! I decided to make an animation of Cabaret Helen advertising the Pizza Time Theater, set to an actual radio commercial. But this is no ordinary advertisement...

Forum statistics

Threads
117,216
Messages
1,105,546
Members
153,362
Latest member
Luxxusburger
Top