Szibes

Veteran
Veteran
Joined
Mar 5, 2021
Messages
30
Reaction score
5
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,647
Reaction score
15,736
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
967
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,524
Reaction score
852
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

Veteran
Veteran
Joined
Mar 5, 2021
Messages
30
Reaction score
5
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
402
Reaction score
157
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,524
Reaction score
852
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 Profile Posts

And here I thought I've lost my music sense. Good exercise once in a while
Made Edits to a Character Art from 'Hibiki Katakura MV Monsters' (DLC), to Look More like One of My Own Characters. :LZScheeze:

Decided to retake an old concept I was working on long ago, first change I decided to tackle on right away is the sprites. Never been fan of the default chibis, so I edited it a bit... :kaoswt:
8YavqRj.png

Not sure if this will be the final take, but I like it more than the regular one.
Need a few testers for my new plugin, any takers?
Good night (or day) to everyone! :smile:

Forum statistics

Threads
118,529
Messages
1,116,698
Members
155,558
Latest member
LuckyCatOtome
Top