Hi I am using the teleport script found Here.
and I am trying to make a menu that shows a list of all memorised locations, where they all have a keyname as their map ID, ie. a single number.
Here are the two scripts that I am working on:
and yes, they are modified item screens.
the problem I'm having is getting it to show anything at all. It currently shows a blank list.
[EDIT] Demo Here
and I am trying to make a menu that shows a list of all memorised locations, where they all have a keyname as their map ID, ie. a single number.
Here are the two scripts that I am working on:
PHP:
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Teleport < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def location
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add location
for i in 1...$MemLocation.size
if $MemLocation.has_key?(i)
@data.push($MemLocation[i].mapID)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = $MemLocation[index].name
self.contents.font.color = normal_color
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.font.color = system_color
self.contents.draw_text(2, 95, 120, 32, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(- 2, 115, 124, 32, $data_map_infos[index].name, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text("Where do you want to go today?")
end
end
PHP:
#==============================================================================
# â– Scene_Item
#------------------------------------------------------------------------------
#  アイテム画é¢ã®å‡¦ç†ã‚’è¡Œã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ◠メイン処ç†
#--------------------------------------------------------------------------
def main
# ヘルプウィンドウã€ã‚¢ã‚¤ãƒ†ãƒ ウィンドウを作æˆ
@help_window = Window_Help.new
@teleport_window = Window_Teleport.new
# ヘルプウィンドウを関連付ã‘
@teleport_window.help_window = @help_window
# ã‚¿ãƒ¼ã‚²ãƒƒãƒˆã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’ä½œæˆ (ä¸å¯è¦–・éžã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã«è¨å®š)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画é¢ã‚’æ›´æ–°
Graphics.update
# å…¥åŠ›æƒ…å ±ã‚’æ›´æ–°
Input.update
# フレーム更新
update
# ç”»é¢ãŒåˆ‡ã‚Šæ›¿ã‚ã£ãŸã‚‰ãƒ«ãƒ¼ãƒ—ã‚’ä¸æ–
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@help_window.dispose
@teleport_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@help_window.update
@teleport_window.update
@target_window.update
# アイテムウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_item を呼ã¶
if @teleport_window.active
update_item
return
end
# ターゲットウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_target を呼ã¶
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (アイテムウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_item
# B ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
# メニュー画é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Menu.new(0)
return
end
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# アイテムウィンドウã§ç¾åœ¨é¸æŠžã•ã‚Œã¦ã„るデータをå–å¾—
@item = @teleport_window.item
# 使用アイテムã§ã¯ãªã„å ´åˆ
unless @item.is_a?(RPG::Item)
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用ã§ããªã„å ´åˆ
unless $game_party.item_can_use?(@item.id)
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE ã‚’æ¼”å¥
$game_system.se_play($data_system.decision_se)
# 効果範囲ãŒå‘³æ–¹ã®å ´åˆ
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@teleport_window.active = false
@target_window.x = (@teleport_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# 効果範囲 (å˜ä½“/全体) ã«å¿œã˜ã¦ã‚«ãƒ¼ã‚½ãƒ«ä½ç½®ã‚’è¨å®š
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# 効果範囲ãŒå‘³æ–¹ä»¥å¤–ã®å ´åˆ
else
# コモンイベント ID ãŒæœ‰åŠ¹ã®å ´åˆ
if @item.common_event_id > 0
# コモンイベント呼ã³å‡ºã—予約
$game_temp.common_event_id = @item.common_event_id
# アイテムã®ä½¿ç”¨æ™‚ SE ã‚’æ¼”å¥
$game_system.se_play(@item.menu_se)
# 消耗å“ã®å ´åˆ
if @item.consumable
# 使用ã—ãŸã‚¢ã‚¤ãƒ†ãƒ ã‚’ 1 減らã™
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウã®é …目をå†æç”»
@teleport_window.draw_item(@teleport_window.index)
end
# マップ画é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (ターゲットウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ)
#--------------------------------------------------------------------------
def update_target
# B ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã‚ャンセル SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
# アイテム切れãªã©ã§ä½¿ç”¨ã§ããªããªã£ãŸå ´åˆ
unless $game_party.item_can_use?(@item.id)
# アイテムウィンドウã®å†…容をå†ä½œæˆ
@teleport_window.refresh
end
# ターゲットウィンドウを消去
@teleport_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# アイテムを使ã„切ã£ãŸå ´åˆ
if $game_party.item_number(@item.id) == 0
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# ターゲットãŒå…¨ä½“ã®å ´åˆ
if @target_window.index == -1
# パーティ全体ã«ã‚¢ã‚¤ãƒ†ãƒ ã®ä½¿ç”¨åŠ¹æžœã‚’é©ç”¨
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ターゲットãŒå˜ä½“ã®å ´åˆ
if @target_window.index >= 0
# ターゲットã®ã‚¢ã‚¯ã‚¿ãƒ¼ã«ã‚¢ã‚¤ãƒ†ãƒ ã®ä½¿ç”¨åŠ¹æžœã‚’é©ç”¨
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# アイテムを使ã£ãŸå ´åˆ
if used
# アイテムã®ä½¿ç”¨æ™‚ SE ã‚’æ¼”å¥
$game_system.se_play(@item.menu_se)
# 消耗å“ã®å ´åˆ
if @item.consumable
# 使用ã—ãŸã‚¢ã‚¤ãƒ†ãƒ ã‚’ 1 減らã™
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウã®é …目をå†æç”»
@teleport_window.draw_item(@teleport_window.index)
end
# ターゲットウィンドウã®å†…容をå†ä½œæˆ
@target_window.refresh
# 全滅ã®å ´åˆ
if $game_party.all_dead?
# ゲームオーãƒãƒ¼ç”»é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Gameover.new
return
end
# コモンイベント ID ãŒæœ‰åŠ¹ã®å ´åˆ
if @item.common_event_id > 0
# コモンイベント呼ã³å‡ºã—予約
$game_temp.common_event_id = @item.common_event_id
# マップ画é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_Map.new
return
end
end
# アイテムを使ã‚ãªã‹ã£ãŸå ´åˆ
unless used
# ブザー SE ã‚’æ¼”å¥
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
and yes, they are modified item screens.
the problem I'm having is getting it to show anything at all. It currently shows a blank list.
[EDIT] Demo Here