Starting Game step count Help

I'm looking for a method where the player's step count is added in a variable. Steps should be counted on a map and it should be a condition for activating an event. This means that as soon as you have walked a certain number of steps on the same map, an event should be activated. The problem is, under the variable control, there is a method that counts the steps, but only the total number since the game started. I want to try to count the steps from the start of a common event. I've currently tried the following shortcut:


$game_variables[46] = $game_map.events[104].starting_step_count + $game_party.steps


However, it doesn't work. Can someone correct me or give me another way to do this? Both would be fine with me.
Where did you get that starting_step_count from? And why/how is it the property of an event? I don't see it when I Google it, so unless it's added by another script you installed it looks like you just made it up, which will never work.

It seems like you should be able to do this simply with event commands.
I want to try to count the steps from the start of a common event.
So in that common event you store the current steps: Control Variables -> Game Data -> Other -> Steps

Then you turn on a switch which activates a parallel event on the map.

In that parallel event you Wait some frames, then do the same thing as the above into a second variable. Subtract the first variable from the second to see how many steps have been made since you ran the common event. Then use that in a conditional branch.

You could use script commands in your parallel event for the conditional branch to not need a second variable, but this is very doable with no scripting at all.
of course it doesn't work that way - you can't simply create functions or variables that way.

on the other hand, there is absolutely no need for something that complex - all you'll need is two regular game variables and some math.

You'll name one variable "steps start map" and one variable "steps current".

then on entry to the map (or on the transfer event on the previous map, that is often easier), you'll use
control variable "steps start map" = current total game steps (the function you already found)

and whenever you need the number of current steps on the map, you'll do two control variable commands:
control variable "steps current" = current total game steps
control variable "steps current" -= "steps start map" (substract the step count from the beginning of the map)

after the second command, the variable contains the steps since the map entry

EDIT: Ninja'd by a second
Are you really using VX? Or is it VX ACE?
Where did you get that starting_step_count from? And why/how is it the property of an event? I don't see it when I Google it, so unless it's added by another script you installed it looks like you just made it up, which will never work.
Yes, I had experimented a bit with the scripting and tried my own idea. That's what came out of it. Actually I'm missing a lot of knowledge.
OK, I'll give it a try.
Are you really using VX? Or is it VX ACE?

I use VX ACE.
I use VX ACE.
Then report your post to a mod and ask it to be moved to VXAce support.

Those are two different programs, and Ace has a lot of improvements over VX

I've moved this thread to VXAce Support. Thank you.

I came up with an idea that works on all Ruby based editions of the engine.
You'll just need a single Game Variable to keep track of the current map's steps.

Outdated code - Please visit my MapSteps thread.
Kyonides's little script inspired me to do this
Spoiler: Track step count per map
Ruby:
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: Map Step Count                         ║  Version: 1.00     ║
# ║ Author: Roninator2                            ║                    ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function:                                     ║   Date Created     ║
# ║   Allows to keep track of steps taken         ╠════════════════════╣
# ║   on any given map                            ║    21 Feb 2023     ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions:                                                      ║
# ║   Specify the variable to use below.                               ║
# ║                                                                    ║
# ║   The data is saved in the variable and can be pulled out          ║
# ║   anytime you need to get the value saved.                         ║
# ║                                                                    ║
# ║   Use the following commands                                       ║
# ║   add_step_count(map_id, value) # <- will add the number           ║
# ║     specified to the map count                                     ║
# ║                                                                    ║
# ║   reset_step_count(map_id) # <- will reset map count to 0          ║
# ║                                                                    ║
# ║   get_step_count(map_id) # <- will get the map step count          ║
# ║                                                                    ║
# ║   subtract_step_count(map_id, value) # <- will subtract the        ║
# ║     number from the map step count                                 ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates:                                                           ║
# ║ 1.00 - 21 Feb 2023 - Script finished                               ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use:                                                      ║
# ║ Free for all RPG Maker uses - except nudity                        ║
# ╚════════════════════════════════════════════════════════════════════╝

module R2_Map_Steps
  Variable = 10
end
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Do not edit anything below this.                                   ║
# ╚════════════════════════════════════════════════════════════════════╝

#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
  #--------------------------------------------------------------------------
  # * alias Setup = set value to variable if nil
  #--------------------------------------------------------------------------
  alias r2_map_step_count_setup setup
  def setup(map_id)
    r2_map_step_count_setup(map_id)
    $game_variables[R2_Map_Steps::Variable] = [] if $game_variables[R2_Map_Steps::Variable] == 0
    $game_variables[R2_Map_Steps::Variable][map_id] ||= 0
  end
end

#==============================================================================
# ** Game_Player = add steps to variable
#==============================================================================
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # * alias Increase Steps
  #--------------------------------------------------------------------------
  alias r2_increase_map_step_count  increase_steps
  def increase_steps
    r2_increase_map_step_count
    $game_variables[R2_Map_Steps::Variable][$game_map.map_id] += 1
  end
end

#==============================================================================
# ** Game_Interpreter = commands
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Add Step Count
  #--------------------------------------------------------------------------
  def add_step_count(id, i)
    $game_variables[R2_Map_Steps::Variable][id] += i
  end
  #--------------------------------------------------------------------------
  # * Reset Step Count
  #--------------------------------------------------------------------------
  def reset_step_count(id)
    $game_variables[R2_Map_Steps::Variable][id] = 0
  end
  #--------------------------------------------------------------------------
  # * Subtract Step Count
  #--------------------------------------------------------------------------
  def subtract_step_count(id, i)
    $game_variables[R2_Map_Steps::Variable][id] -= i
    $game_variables[R2_Map_Steps::Variable][id] = 0 if $game_variables[R2_Map_Steps::Variable][id] < 0
  end
  #--------------------------------------------------------------------------
  # * Get Step Count
  #--------------------------------------------------------------------------
  def get_step_count(id)
    return $game_variables[R2_Map_Steps::Variable][id]
  end 
end
I have updated my script in its respective thread.

kyonides said:
Assign a Game Variable ID to VAR_ID and you're ready to go! 😀
There is also the LAST_VAR_ID that will help you keep track of your previous map's steps.
And you can also count on the TOTAL_VAR_ID to check if your player has reached the maximum number of steps for a given couple of maps.

The steps will be reset every single time you move to another map!

Original thread: https://forums.rpgmakerweb.com/threads/starting-game-step-count-help.158555/