RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Reseting step counter and time (not the timer)

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 89
Hello,
I need to reset (set to 0) step counter and timer (both are build-in RM features) in RMVX Ace.
Want to do that via call script command, but how to...?
Regards,
Mike

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
To do the step counter, you could insert the following into its own slot in the Script Editor:

Code: [Select]
class Game_Party
  attr_writer :steps
end

Then, in a script command of an event, simply put:
Code: [Select]
$game_party.steps = 0

I'm not sure what you mean by the timer. If you are talking about the in-game timer, then it is controlled by the Control Timer event command. Just select start and the time to which you want to reset it.
« Last Edit: May 24, 2014, 11:53:39 PM by modern algebra »

***
Rep:
Level 89
By the time (not timer) I mean this one:
http://ifotos.pl/zobacz/thisPNG_eepepxs.PNG/
Need to reset this without exiting game to t he title.
Step command are just above. Tried to use your help, but didn't make it... I don't understand how to use this:
Code: [Select]
class Game_Party
  attr_writer :steps
end
« Last Edit: May 24, 2014, 11:59:52 PM by Fizzly »
Regards,
Mike

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Open the Script Editor (F11). Below Materials but above Main, insert a new slot. Paste that code into the blank page on the right-hand side. Give the slot a name so that you know it's there.

Playtime is a little more complicated, but do the same thing and create a new slot in the left-hand list around the same place. Then paste the following code into the blank page on the right-hand side:

Code: [Select]
class Game_System
  def reset_playtime
    @rp_frames_at_last_reset = Graphics.frame_count
  end
  def playtime
    @rp_frames_at_last_reset = 0 unless @rp_frames_at_last_reset
    (Graphics.frame_count - @rp_frames_at_last_reset) / Graphics.frame_rate
  end
end

In a script command in an event, use the following code:

Code: [Select]
$game_system.reset_playtime

***
Rep:
Level 89
Thanks for the help, modern, but it does not work. No error or something, but both steps and playtime are still not 0. Tried with both.
Regards,
Mike

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Ah, well go to Game_Interpreter and find line 617:

Code: [Select]
      when 4  # play time
        return Graphics.frame_count / Graphics.frame_rate

Change it to:

Code: [Select]
      when 4  # play time
        return $game_system.playtime

Why do you want to reset playtime anyway?

Also, you could have done that much through events anyway. You only need scripts to change them in the save menu.

The steps one works.

***
Rep:
Level 89
I can do this through events? How?

Code: [Select]
      when 4  # play time
        return $game_system.playtime
Also don't work for me. Dont know why, but still can't set play time to 0  ;9
Why do I need to reset time and steps? Making Sokoban-like game, and need to reset moves while reseting level.

Edit: Found answer for the steps: http://forums.rpgmakerweb.com/index.php?/topic/21155-step-counter-deleting-steps/
And I think I'll do the time (seconds) via variable with incrementation. Thank you anyway modern for your help!
« Last Edit: May 25, 2014, 12:12:21 PM by Fizzly »
Regards,
Mike

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Both of those work for me, so it might be that you have another script interfering.

Anyway, to do it with events, you'd use two in-game variables; let's call them X and Y.

Whenever you want to reset the playtime, set Variable X to Play Time through the Control Variables command:

@>Control Variables: [0001: X] = Play Time

Then, whenever you want to retrieve the current playtime, set Y to play time, then subtract X, like this:

@>Control Variables: [0001: X] = Play Time
@>Control Variables: [0002: Y] -= Variable [0001: X]

Variable Y would then hold the play time since the last time it was reset.

Again though, that would not affect playtime as it is shown on the save file.

***
Rep:
Level 89
Thanks modern_algebra for your kind help.
Regards,
Mike