Jump to content
aghostcat

Coding timers

Recommended Posts

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 by aghostcat

Share this post


Link to post
Share on other sites

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

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

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 by Aletheos

Share this post


Link to post
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted