-
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...?
-
To do the step counter, you could insert the following into its own slot in the Script Editor:
class Game_Party
attr_writer :steps
end
Then, in a script command of an event, simply put: $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.
-
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:
class Game_Party
attr_writer :steps
end
-
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:
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:
$game_system.reset_playtime
-
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.
-
Ah, well go to Game_Interpreter and find line 617:
when 4 # play time
return Graphics.frame_count / Graphics.frame_rate
Change it to:
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.
-
I can do this through events? How?
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!
-
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.
-
Thanks modern_algebra for your kind help.