~Site
Accueil
Forum
Admin

~Base de scripts
Scripts de base
Scripts Menu
Scripts Combat
Scripts Systθme
Scripts Modifiιs

Scripts de Base
Game_Temp
Game_System
Game_Switches
Game_Variables
Game_SelfSwitches
Game_Screen
Game_Picture
Game_Battler 1
Game_Battler 2
Game_Battler 3
Game_BattleAction
Game_Actor
Game_Enemy
Game_Actors
Game_Party
Game_Troop
Game_Map
Game_CommonEvent
Game_Character 1
Game_Character 2
Game_Character 3
Game_Event
Game_Player
Sprite_Character
Sprite_Battler
Sprite_Picture
Sprite_Timer
Spriteset_Map
Spriteset_Battle
Window_Base
Window_Selectable
Window_Command
Window_Help
Window_Gold
Window_PlayTime
Window_Steps
Window_MenuStatus
Window_Item
Window_Skill
Window_SkillStatus
Window_Target
Window_EquipLeft
Window_EquipRight
Window_EquipItem
Window_Status
Window_SaveFile
Window_ShopCommand
Window_ShopBuy
Window_ShopSell
Window_ShopNumber
Window_ShopStatus
Window_NameEdit
Window_NameInput
Window_InputNumber
Window_Message
Window_PartyCommand
Window_BattleStatus
Window_BattleResult
Window_DebugLeft
Window_DebugRight
Window_Dataset
Arrow_Base
Arrow_Enemy
Arrow_Actor
Interpreter 1
Interpreter 2
Interpreter 3
Interpreter 4
Interpreter 5
Interpreter 6
Interpreter 7
Scene_Title
Scene_Map
Scene_Menu
Scene_Item
Scene_Skill
Scene_Equip
Scene_Status
Scene_File
Scene_Save
Scene_Load
Scene_End
Scene_Battle 1
Scene_Battle 2
Scene_Battle 3
Scene_Battle 4
Scene_Shop
Scene_Name
Scene_Gameover
Scene_Debug
Main


Scene_Item ::: postι le 2006-02-16 @ 10:22:00
Auteur: Yukihiro matsumoto

#============================================
# ‘ Scene_Item
#----------------------------------------------
# @ƒAƒCƒeƒ€‰ζ–ʂ̏ˆ—‚πs‚€ƒNƒ‰ƒX‚Ε‚·B
#============================================

class Scene_Item
#------------------------------------------
# œ ƒƒCƒ“ˆ—
#------------------------------------------
def main
# ƒwƒ‹ƒvƒEƒBƒ“ƒhƒEAƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚πμ¬
@help_window = Window_Help.new
@item_window = Window_Item.new
# ƒwƒ‹ƒvƒEƒBƒ“ƒhƒE‚πŠΦ˜A•t‚―
@item_window.help_window = @help_window
# ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚πμ¬ (•s‰ΒŽ‹E”ρƒAƒNƒeƒBƒu‚ɐݒθ)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“Žΐs
Graphics.transition
# ƒƒCƒ“ƒ‹[ƒv
loop do
# ƒQ[ƒ€‰ζ–Κ‚πXV
Graphics.update
# “ό—͏ξ•ρ‚πXV
Input.update
# ƒtƒŒ[ƒ€XV
update
# ‰ζ–Κ‚ͺΨ‚θ‘Φ‚ν‚Α‚½‚烋[ƒv‚π’†’f
if $scene != self
break
end
end
# ƒgƒ‰ƒ“ƒWƒVƒ‡ƒ“€”υ
Graphics.freeze
# ƒEƒBƒ“ƒhƒE‚π‰π•ϊ
@help_window.dispose
@item_window.dispose
@target_window.dispose
end
#------------------------------------------
# œ ƒtƒŒ[ƒ€XV
#------------------------------------------
def update
# ƒEƒBƒ“ƒhƒE‚πXV
@help_window.update
@item_window.update
@target_window.update
# ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ͺƒAƒNƒeƒBƒu‚̏ꍇ: update_item ‚πŒΔ‚Τ
if @item_window.active
update_item
return
end
# ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚ͺƒAƒNƒeƒBƒu‚̏ꍇ: update_target ‚πŒΔ‚Τ
if @target_window.active
update_target
return
end
end
#------------------------------------------
# œ ƒtƒŒ[ƒ€XV (ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ͺƒAƒNƒeƒBƒu‚̏ꍇ)
#------------------------------------------
def update_item
# B ƒ{ƒ^ƒ“‚ͺ‰Ÿ‚³‚κ‚½κ‡
if Input.trigger?(Input::B)
# ƒLƒƒƒ“ƒZƒ‹ SE ‚π‰‰‘t
$game_system.se_play($data_system.cancel_se)
# ƒƒjƒ…[‰ζ–ʂɐ؂θ‘Φ‚¦
$scene = Scene_Menu.new(0)
return
end
# C ƒ{ƒ^ƒ“‚ͺ‰Ÿ‚³‚κ‚½κ‡
if Input.trigger?(Input::C)
# ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚ΕŒ»έ‘I‘π‚³‚κ‚Δ‚’‚ιƒf[ƒ^‚πŽζ“Ύ
@item = @item_window.item
# Žg—pƒAƒCƒeƒ€‚Ε‚Ν‚Θ‚’κ‡
unless @item.is_a?(RPG::Item)
# ƒuƒU[ SE ‚π‰‰‘t
$game_system.se_play($data_system.buzzer_se)
return
end
# Žg—p‚Ε‚«‚Θ‚’κ‡
unless $game_party.item_can_use?(@item.id)
# ƒuƒU[ SE ‚π‰‰‘t
$game_system.se_play($data_system.buzzer_se)
return
end
# Œˆ’θ SE ‚π‰‰‘t
$game_system.se_play($data_system.decision_se)
# Œψ‰Κ”ΝˆΝ‚ͺ–‘•ϋ‚̏ꍇ
if @item.scope >= 3
# ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚πƒAƒNƒeƒBƒu‰»
@item_window.active = false
@target_window.x = (@item_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# Œψ‰Κ”ΝˆΝ (’P‘Μ/‘S‘Μ) ‚Ι‰ž‚Ά‚ΔƒJ[ƒƒ‹ˆΚ’u‚πέ’θ
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# Œψ‰Κ”ΝˆΝ‚ͺ–‘•ϋˆΘŠO‚̏ꍇ
else
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ͺ—LŒψ‚̏ꍇ
if @item.common_event_id > 0
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒgŒΔ‚яo‚΅—–ρ
$game_temp.common_event_id = @item.common_event_id
# ƒAƒCƒeƒ€‚ΜŽg—pŽž SE ‚π‰‰‘t
$game_system.se_play(@item.menu_se)
# Α–Υ•i‚̏ꍇ
if @item.consumable
# Žg—p‚΅‚½ƒAƒCƒeƒ€‚π 1 ŒΈ‚η‚·
$game_party.lose_item(@item.id, 1)
# ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚̍€–Ϊ‚πΔ•`‰ζ
@item_window.draw_item(@item_window.index)
end
# ƒ}ƒbƒv‰ζ–ʂɐ؂θ‘Φ‚¦
$scene = Scene_Map.new
return
end
end
return
end
end
#------------------------------------------
# œ ƒtƒŒ[ƒ€XV (ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚ͺƒAƒNƒeƒBƒu‚̏ꍇ)
#------------------------------------------
def update_target
# B ƒ{ƒ^ƒ“‚ͺ‰Ÿ‚³‚κ‚½κ‡
if Input.trigger?(Input::B)
# ƒLƒƒƒ“ƒZƒ‹ SE ‚π‰‰‘t
$game_system.se_play($data_system.cancel_se)
# ƒAƒCƒeƒ€Ψ‚κ‚Θ‚Η‚ΕŽg—p‚Ε‚«‚Θ‚­‚Θ‚Α‚½κ‡
unless $game_party.item_can_use?(@item.id)
# ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚Μ“ΰ—e‚πΔμ¬
@item_window.refresh
end
# ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚πΑ‹Ž
@item_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# C ƒ{ƒ^ƒ“‚ͺ‰Ÿ‚³‚κ‚½κ‡
if Input.trigger?(Input::C)
# ƒAƒCƒeƒ€‚πŽg‚’Ψ‚Α‚½κ‡
if $game_party.item_number(@item.id) == 0
# ƒuƒU[ SE ‚π‰‰‘t
$game_system.se_play($data_system.buzzer_se)
return
end
# ƒ^[ƒQƒbƒg‚ͺ‘S‘̂̏ꍇ
if @target_window.index == -1
# ƒp[ƒeƒB‘S‘Μ‚ΙƒAƒCƒeƒ€‚ΜŽg—pŒψ‰Κ‚π“K—p
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ƒ^[ƒQƒbƒg‚ͺ’P‘̂̏ꍇ
if @target_window.index >= 0
# ƒ^[ƒQƒbƒg‚ΜƒAƒNƒ^[‚ΙƒAƒCƒeƒ€‚ΜŽg—pŒψ‰Κ‚π“K—p
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# ƒAƒCƒeƒ€‚πŽg‚Α‚½κ‡
if used
# ƒAƒCƒeƒ€‚ΜŽg—pŽž SE ‚π‰‰‘t
$game_system.se_play(@item.menu_se)
# Α–Υ•i‚̏ꍇ
if @item.consumable
# Žg—p‚΅‚½ƒAƒCƒeƒ€‚π 1 ŒΈ‚η‚·
$game_party.lose_item(@item.id, 1)
# ƒAƒCƒeƒ€ƒEƒBƒ“ƒhƒE‚̍€–Ϊ‚πΔ•`‰ζ
@item_window.draw_item(@item_window.index)
end
# ƒ^[ƒQƒbƒgƒEƒBƒ“ƒhƒE‚Μ“ΰ—e‚πΔμ¬
@target_window.refresh
# ‘S–ł̏ꍇ
if $game_party.all_dead?
# ƒQ[ƒ€ƒI[ƒo[‰ζ–ʂɐ؂θ‘Φ‚¦
$scene = Scene_Gameover.new
return
end
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒg ID ‚ͺ—LŒψ‚̏ꍇ
if @item.common_event_id > 0
# ƒRƒ‚ƒ“ƒCƒxƒ“ƒgŒΔ‚яo‚΅—–ρ
$game_temp.common_event_id = @item.common_event_id
# ƒ}ƒbƒv‰ζ–ʂɐ؂θ‘Φ‚¦
$scene = Scene_Map.new
return
end
end
# ƒAƒCƒeƒ€‚πŽg‚ν‚Θ‚©‚Α‚½κ‡
unless used
# ƒuƒU[ SE ‚π‰‰‘t
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
Design By RaZ © Watery Build 2005