aghostcat 5 Posted April 14, 2016 (edited) Coding timers in VX Ace, how do they fricking work? I tried using $game_timers.set_timer in my code but nothing, nada, zilch. The script I am working on is in the script editor instead of the script event. After this I should be able to do much more with what I have planned, hopefully. def update_t7 $game_timer.set_timer(10, [$game_switches[065] = true]) if $game_switches[065] == false then @vy = 512 end if $game_switches[065] == true then @vy = 000 end end end Edited April 15, 2016 by aghostcat Share this post Link to post Share on other sites
Aletheos 41 Posted April 15, 2016 Looking at the default Game_Timer script, I find no reference to a set_timer method. There is, however, a start(count) method. I have a question about your code. Maybe it is that I don't understand Ruby well enough yet, but it looks like you're giving the set_timer method two arguments: The integer value 10 and an array containing the value in $game_switches[65], assigned the boolean value true every frame, I'm guessing, since this is in a method called update_t7. The question is this. Do you intend for the @vy variable to always be 0? There seem to be a lot going on that we don't see. Are you using some custom timer script? If so, it might be a good idea to tell us the name of the script. Share this post Link to post Share on other sites
aghostcat 5 Posted April 15, 2016 To be honest I'm not really using a custom timer script. I been trying to figure out how to code with timers, apparently a lot of places don't say much about how you can fiddle with them through script. The @vy variable will be stopped, and reactivated at the end of the battle for a character in a danmaku mini-game in my game. Share this post Link to post Share on other sites
Aletheos 41 Posted April 15, 2016 (edited) Maybe I'm completely off here, but it looks as though you set the $game_switches[65] to true, then ask if it's false, which it will never be. Edited April 15, 2016 by Aletheos Share this post Link to post Share on other sites
aghostcat 5 Posted April 15, 2016 Ah, is there a way to properly get a timer to change variables and switches through code by the way? Share this post Link to post Share on other sites
Aletheos 41 Posted April 15, 2016 Trying to decypher what your code means. Are you saying you want switch number 65 to be set to true(on) when the ten second timer expires? Share this post Link to post Share on other sites
Aletheos 41 Posted April 15, 2016 Override the on_expire method, is one way... class Game_Timer def on_expire #Make stuff happen here end end ...but I think it would be simpler to use events for this. A simple conditional branch that asks for the timer value being less than or equal to 0, should do the trick. Share this post Link to post Share on other sites