Szibes

Villager
Member
Joined
Mar 5, 2021
Messages
19
Reaction score
3
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,078
Reaction score
15,498
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,352
Reaction score
791
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
19
Reaction score
3
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,352
Reaction score
791
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

Sizzle sizzle sizzle...
zbf1dCZ.gif
Sharing my past was a mistake. Will delete the post when I get access to a working internet connection again.
TFW you get a plugin working correctly with your other plugins ♡\( ̄▽ ̄)/♡

(CW for minor gore - Einar's Y incision is gone for his test portrait)

Cs5kAbZ.png
Doing some winter related edits for a cozy cottage!
I think it's the third time I am changing my skill info plugin, but as I get better at programming, I want to fix the trash I made earlier :p

Streaming while I am programming the plugin. Join in if you wish :)

Forum statistics

Threads
116,981
Messages
1,103,496
Members
152,845
Latest member
Zynarith2
Top