- 2,273
- Posts
- 19
- Years
- Age 33
- Maybe rivendell i have heard its nice there
- Seen Apr 11, 2010
i am having toruble putting mmy bacground into RM2K3 for a title scree. can someone tell me how to do it.|?
#==============================================================================
# ■ Scene_Item
#------------------------------------------------------------------------------
# アイテム画面の処理を行うクラスです。
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# ヘルプウィンドウ、アイテムウィンドウを作成
@help_window = Window_Help.new
@item_window = Window_Item.new
@card = Sprite.new
@card.bitmap = RPG::Cache.picture("bag")
@card.zoom_x = 2
@card.zoom_y = 2
@help_window.windowskin = RPG::Cache.windowskin("infosys")
# ヘルプウィンドウを関連付け
@item_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
@item_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@help_window.update
@item_window.update
@target_window.update
# アイテムウィンドウがアクティブの場合: update_item を呼ぶ
if @item_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
if Input.press?(Input::RIGHT)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item2.new
return
end
if Input.press?(Input::LEFT)
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item4.new
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @item_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
# ターゲットウィンドウをアクティブ化
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# 効果範囲 (単体/全体) に応じてカーソル位置を設定
if @item.scope == 4 || @item.scope == 10
@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)
# アイテムウィンドウの項目を再描画
@item_window.draw_item(@item_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)
# アイテムウィンドウの内容を再作成
@item_window.refresh
end
# ターゲットウィンドウを消去
@item_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)
# アイテムウィンドウの項目を再描画
@item_window.draw_item(@item_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
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面、バトル画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(175, 12, 292, 200)
@column_max = 1
refresh
self.index = 0
self.opacity = 0
self.back_opacity = 0
# 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
if $game_temp.in_battle
self.y = 0
self.height = 0
super(175, 12, 292, 195)
@column_max = 1
refresh
self.index = 0
end
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# アイテムを追加
for i in 1...47
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# 戦闘中以外なら武器と防具も追加
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width-32, row_max * 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 12 + index % 2 * (0 + 0)
y = index /-1 * -32
rect = Rect.new(x, y, self.width / @column_max - 100,100)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
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.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 200, y, 30, 32, ":", 1)
self.contents.draw_text(x + 200, y, 40, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
OverTheBelow said:I'm really puzzeled.
Please can someone tell me how to let you through if you have atleast 1 pokemon, and not let you through when you don't?
Thanks tons
i think it's in the battle.[_DarkDragon_] said:create a variable to hold a boolean value, when you are in a battle turn the variable to true and when you leave the battle turn it to false, then make a conditional branch for the bag system so that it returns to the battle if the variable is true or to the menu if it's not :)
here's how i did it in my version[NoLeAfCloVeR0987] said:does anybody have an idea about how to make a bag show how much of a certaint item you have.....i have my bag displaying a number but the number is Zero...all the tiem it never changes...any ideas on how to fix this?
Thanks in advance
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
item = $data_items[i]
# element id is the attribute in the database
if item != nil and (item.element_set.include?(Element_ID))
@data.push($data_items[i])
end
end
end
for i in 1...47
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
no its not that i figured it out....BTW that controles what goes into what poket of the bag.........Flameguru said:is it this that u replace?
Code:for i in 1...47 if $game_party.item_number(i) > 0 @data.push($data_items[i]) end end
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 200, y, 16, 32, "x", 2)
self.contents.font.color = normal_color
self.contents.draw_text(100, 0, 0, 0, number.to_s, 2)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 200, y, 30, 32, "x", 1)
self.contents.draw_text(x + 200, y, 40, 32, number.to_s, 2)
when RPG::Item
number = $game_party.weapon_number(item.id)
when RPG::Item
number = $game_party.item_number(item.id)
1. do this with eventsaxlefoley said:Hi I have a few questions all are related to RMXP
1. How do I do random encounters on certain tiles with events or scrip
2. How do I make the font appear
3. Would it be possible for some one to either write or direct me to a place that has a bag system tutorial, A PKMN Battle System Tutorial and a Menu Tutorial
before you say anything about the Starter Kit yes I did Download it and it has been wonderful thanks to the creator
<>variable [x:random] = rand(6)
<>branch if var [x:random] == 3
<> make encounter
:end
Font.default_name = "Font_name"
in Window_Message def update add:[NoLeAfCloVeR0987] said:okay... i need to knwo how to change the font color in RMXP but only for the battles....liek when you get into a battle i want the font to be white but when you get out of battle i want the font back to the normal pokemon color (i am useing blizzys starter kit if that helps at all)
if $game_temp.in_battle
self.contents.font.color = Color.new(r,g,b,a)
else
self.contents.font.color = normal_color
end