Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

a few questions

A probably very simple to answer question, how would one go about wait some amount of frames. Also how could I change variables?
 

Zeriab

Sponsor

It is indeed simple. If you have trouble with waiting some amount of frames then I suggest you play around a bit first so you get a feeling of the program.
This will both help you when asking question and reduce the chance of people seeing your question as a joke.

I assume you know how to create events.

You can find the event command you have to use for waiting here:
http://img244.imageshack.us/img244/8818/waitgh7.th.png[/img]

For changing variables this is the button you should press:
http://img139.imageshack.us/img139/4917/changevariablesrq7.th.png[/img]
Note that changing variables in itself may not be enough. Instead you should tell us what you are trying to do.
After all, changing variables IS easy, but using them in a context to get the wanted functionality may be hard.

*hugs*
- Zeriab
 
Another tip, and I know it's hard, I hate doing it myself too, is reading the help files. There's a little question mark in the corner of each windowin RMXP/RMVX. If you click that, and then click something on the window, it'll give you a description and often instructions on how to use something.I had no clue about before, when I did that
 

e

Sponsor

If you want to change game variables using scripting (RGSS\2), that is, variables that are assigned through events or the likes, you use :

Code:
$game_variables

This is a global object, an array, which holds all the variables, up to 5000 I think.

Such as :

Code:
$game_variables[VARIABLE_ID] = new_value

For example: I want to change the variable 50 from 0 to 1.

Code:
$game_variables[50] = 1

Now, if you want to wait a set number of frames, I never had to, but I believe (I'd double check if I had access to a reference, but eh) it's a method of the Graphics module. Something like Graphic.wait(10) or something. I'm not sure, but if it does exist, it'll be in the help file under the Graphic module.

I'll get back to you when I get back home.
 
well for the variable changing, i was kind of thinking of adding to the variable.
and I was looking for a place to test the wait and found it by default in Scene_Map.
And how would i make a script that runs all the time no matter what?
 
To add to the variable, instead of writing
Code:
$game_variables[ID] = value
you simply make it
Code:
$game_variables[ID] += value

This is shorthand for
Code:
$game_variables[ID] = $game_variables[ID] + value

The same notation can be used for other operations too, like subtraction, devision and multiplication

As for a script that runs all the time, what exactly do you want to do with it? because that makes a difference in how you'd set it up
 

e

Sponsor

What do you mean? A script that is run every frame, no matter in what scene?

You could edit the Scene_Base class's main method or the likes. I'm not sure exactly what WOULD be the best way to do this though; there's several, and you'll probably have to test them out to see which fits your need.

There's the Scene_Base class methods (which, in theory, all scene classes use). There's the Main loop (script: Main, in the begin/end block). Maybe more.
 

Zeriab

Sponsor

Are using RPG Maker XP or VX?

When you say you want to wait a certain amount of frames. Is it everything that has to wait or is it a script you are executing?
If it is everything then use this for waiting half a second (10 frames):
Code:
sleep(0.5)[/b]

You can also modify Graphics.update to run your script. It's bad style but probably the easiest should you use XP.
 

Zeriab

Sponsor

The ruby sleep statement is very rarely useful in RMXP since its generally single threaded. The sleep statement pauses the thread for the given amount of seconds.
The player will have no control during the wait. Windows will consider the program as 'Not Responding' if you sleep for enough seconds.

@ultiomos:
Are you using RPG Maker XP or RPG Maker VX?
 

Zeriab

Sponsor

Whoops >_>
Now I do feel stupid.

In this case you can do something like this:
Code:
class Scene_Base
  alias :zeriab_update :update
  def update
    # Do your stuff
    
    # Normal update
    zeriab_update
  end
end

*hugs*
- Zeriab
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top