Szibes

Villager
Member
Joined
Mar 5, 2021
Messages
21
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,160
Reaction score
15,541
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,375
Reaction score
802
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
21
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,375
Reaction score
802
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

I think it's ready - Chapter Selection:
unknown.png
On another more gaming topic, I paid 20 bucks for a visual novel to emotionally destroy me. I may write an entry about that.
1638611395177.png
Reading about metaverses recently. I can totally imagine myself in the future, logging in with VR glasses to a virtual beach villa sitting in a virtual chair, with a virtual laptop facing the sea...coding 16-bit RM.
Mod name: "[Game name] Gameplay Overhaul"
What they actually mean: "Here is a mod that makes the game harder."
I decided to reinstall one of my most favourite game of all times, Gothic 2. Time to get back to Khorinis!

Forum statistics

Threads
117,171
Messages
1,105,130
Members
153,267
Latest member
Christopher626
Top