Szibes

Veteran
Veteran
Joined
Mar 5, 2021
Messages
35
Reaction score
8
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
45,566
Reaction score
16,455
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
1,017
Reaction score
504
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
4,701
Reaction score
1,329
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
35
Reaction score
8
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
885
Reaction score
425
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
4,701
Reaction score
1,329
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

Shoot.gif
Because The Fury from Metal Gear Solid 3 is one of my favorite bosses of all time, I felt the need to make a somewhat similar boss for my own game. taking cues from both the Fury and another awesome astronaut boss, Captain Vladimir from No More Heroes 2.
RE4make almost had me with their demo until I got to the dog stuck in a bear trap and realized that he was dead and could no longer be saved. Just not the kind of reimagining I'm interested in.
Here's some dudes that I'm drawing for Jimmy's Quest!
autredo.png
Autism Acceptance Month 2023!


Did this randomly in my free time, I guess today is a good day to show it.

Forum statistics

Threads
130,023
Messages
1,207,114
Members
171,288
Latest member
oscerr
Top