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.

new scene with a picture as background

Try This:
#==============================================================================
# â–  Scene_Menu
#------------------------------------------------------------------------------
#  メニュー画面の処理を行うクラスです。
#==============================================================================
class Game_Party
attr_accessor :actors
end
class Scene_Scanner
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# menu_index : コマンドのカーソル初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
@bg = Window_BG.new
# コマンドウィンドウを作成
s1 = "Command_1_Text"
s2 = "Command_1_Text"
s3 = "Command_1_Text"
@command_window = Window_Command2.new(200, [s1, s2, s3])
@command_window.index = @menu_index
@command_window.opacity = 0
@bg.opacity = 0
@command_window.x = 240
@command_window.y = 160
# パーティ人数が 0 人の場合
if $game_party.actors.size == 0
# アイテム、スキル、装備、ステータスを無効化
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@command_window.dispose
@bg.dispose
@spriteset.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@command_window.update
@spriteset.update
# コマンドウィンドウがアクティブの場合: update_command を呼ぶ
if @command_window.active
update_command
return
end
# ステータスウィンドウがアクティブの場合: update_status を呼ぶ
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_command
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# パーティ人数が 0 人で、セーブ、ゲーム終了以外のコマンドの場合
if $game_party.actors.size == 0 and @command_window.index < 4
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 0 # アイテム
# 決定 SE を演奏
#Enter Command 1 Actions Here
common_event = $data_common_events[#] # add id of common event
if common_event != nil
# 子インタプリタを作成
@child_interpreter = Interpreter.new(@depth + 1)
@child_interpreter.setup(common_event.list, @event_id)
end
# 継続
return true
when 1 # スキル
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ステータスウィンドウをアクティブにする
#Enter Command 2 Actions Here
common_event = $data_common_events[#] # add id of common event
if common_event != nil
# 子インタプリタを作成
@child_interpreter = Interpreter.new(@depth + 1)
@child_interpreter.setup(common_event.list, @event_id)
end
# 継続
return true
when 2 # 装備
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ステータスウィンドウをアクティブにする
#Enter Command 3 Actions Here
common_event = $data_common_events[#] # add id of common event
if common_event != nil
# 子インタプリタを作成
@child_interpreter = Interpreter.new(@depth + 1)
@child_interpreter.setup(common_event.list, @event_id)
end
# 継続
return true
end
return
end
end
end

#==============================================================================
# â–  Window_MenuBG
#------------------------------------------------------------------------------
#  ゴールドを表示するウィンドウです。
#==============================================================================
class Window_BG < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(-16, 42, 800, 800)
self.contents = Bitmap.new(800, 800)
self.contents.font.name = $defaultfonttype # "Gold" window font
self.contents.font.size = $defaultfontsize
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = -3 #X Co-Ordinate of picture
y = -3 #Y Co-Ordinate of picture
bitmap = RPG::Cache.picture("Picture_name") #Add name of picture here
self.contents.blt(x, y, bitmap, Rect.new(-3, -3, 800, 800), 255)
end
end
Just Import the Background Picture Into the Pictures folder and mess around whith X and Y to position it!!
And to call them use call script then type:
$scene = Scene_Scanner.new
Hope that works!
 
Wow, thank you so much ^_^

Edit: looks like i thanked to early :(

i get an error in this line when i select an option

#Enter Command 1 Actions Here
common_event = $data_common_events[1] # add id of common event
if common_event != nil
# 子インタプリタを作成
@child_interpreter = Interpreter.new(@depth + 1) ----Error here
@child_interpreter.setup(common_event.list, @event_id)
end

nomethod error
Undefined Method `+´ for nil:nilclass
 
change all lines that look like this
Code:
@child_interpreter = Interpreter.new(@depth + 1)
@child_interpreter.setup(common_event.list, @event_id)

to this

Code:
@child_interpreter = Interpreter.new
@child_interpreter.setup(common_event.list, 0)

add this to the begining of your update method
Code:
    if @child_interpreter.running?
      @child_interpreter.update
    end

It will probably work after that
 
Okay, thank you, i'll post them.

Teleport: (Easiest i think)

Com system:

Scan Thingy:
a word to this scanner thing, at first i wanted to check the tile in Front of my
character but i found this impossible to do.
i had something like this in mind:

My Guy checks the Scanner
The Commonevent goes off and does this:
Check tile in front of Character for a comment placed in an inactive Event
take this comment text (a number or a some letters) and jump to the corresponding Label.


well....... i posted the stuff,
sorry to inconvenience you guys ...
 
Meh I just added an interpreter object to a scene and did all of the stuff I said on the last page created a common event and it worked I'll post the little script as soon as I'm done testing, but really the code for the event commands are given in the Interpreter class all you have to do is look for the code there
 
I swear If anyone submits a script that requires using a common event with event commands I will hunt them down :P With that out of the way

New script above main
Code:
class Game_System
  attr_accessor :scene_interpreter
  
  alias common_event_init initialize
  def initialize
    @scene_interpreter = Interpreter.new(0, false)
    common_event_init
  end
end

add this to the update method
Code:
    $game_system.scene_interpreter.update

When ever you want a common event to run use this
Code:
    common_event = $data_common_events[id]
    $game_system.scene_interpreter.setup(common_event.list, 0)

where id is the id of the common event to run
If something doesn't work then you haven't added the correct variables for that command to work (for example you need a Window_Message object in your scene to display messages)
 

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