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.

Running a Scene_Map method...

How can I run a Scene_Map method through "call script"?

I tried these:

Scene_Map.do_stuff
and
Scene_Map::do_stuff

Both come up with "Undefined method 'do_stuff' for Scene_Map:class"

do_stuff is currently this:

Code:
class Scene_Map
  def do_stuff
    p 'Hello World'
  end
end





Edit:

Also, how can I do a wait(x) command in a script, where "x" is a number of frames?
 
It's this way
Code:
$scene.do_stuff
Just don't use it in battle events, unless you add the "do_stuff" method to Scene_Battle too.
About waiting in scripts, I'm not sure, but I think you can use
Code:
@wait_count = frames
in event script calling.
 
That works, thanks.

Waiting still seems to do nothing however. This is my script: (excuse the cruddyness :p)

Code:
class Scene_Map
  def something
    @load_bar = Sprite.new
    @load_bar.z = 9999
    # Start process
    @load_bar.bitmap = RPG::Cache.picture('load_bar1')
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar2')
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar3')
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar4')
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar5')    
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar6')    
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar7')    
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar8')    
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar9')
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('load_bar10')    
    @load_bar.update
    @wait_count = 10
    @load_bar.bitmap = RPG::Cache.picture('no_image')
  end
end

(I know it says load_bar a lot, but believe me this isn't some sort of fake loading bar script or anything.)
 
After update a sprite, you must update Graphics.
But I'm not sure if that'll work, as I don't know the rest of your script
Code:
class Scene_Map
  def something
    @load_bar = Sprite.new
    @load_bar.z = 9999
    # Start process
    @load_bar.bitmap = RPG::Cache.picture('load_bar1')
    @load_bar.update
    @wait_count = 10
    Graphics.update
    @load_bar.bitmap = RPG::Cache.picture('load_bar2')
    @load_bar.update
    @wait_count = 10
    Graphics.update
    # ...
  end
end
 

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