Kingdom Hearts Another Side
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.



 
AccueilRechercherDernières imagesS'enregistrerConnexion
Le deal à ne pas rater :
Cartes Pokémon 151 : où trouver le coffret Collection Alakazam-ex ?
Voir le deal

 

 Menu 4

Aller en bas 
AuteurMessage
Wizard
Maître de la KeyBlade
Maître de la KeyBlade
Wizard


Nombre de messages : 90
Age : 34
Localisation : Tonnerre
Date d'inscription : 14/02/2006

Menu 4 Empty
MessageSujet: Menu 4   Menu 4 EmptyLun 17 Avr 2006, 18:37

Il pleut des scripts de menu!!!Laughing
Allez dans l'éditeur de script ( F11 ) créez un script au dessus de " Main " et nommez ce script " new menu " .

http://rpgcreative.free.fr/Site/RPG%20Maker/image%20tutorial/scripts/new%20menu_2.JPG

Code:
 class Window_Base
def draw_battlegraphic(actor, x, y, z)
bitmap = RPG::Cache.battler(actor.character_name, actor.character_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
when 7
parameter_name = "Evasion"
parameter_value = actor.eva
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end

class Window_Infos < Window_Base

def initialize
super(0, 0, 160, 256)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
refresh
end

def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Nombre de pas :")
self.contents.draw_text(124-cx, 96, cx, 32, $data_system.words.gold, 2)
self.contents.draw_text(4, 150, 120, 32, "Temps :")

self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 120, 32, $game_party.steps.to_s, 2)
self.contents.draw_text(4, 96, 120-cx-2, 32, $game_party.gold.to_s, 2)
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.draw_text(4, 182, 120, 32, text, 2)
end

def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end

class Window_MenuStatus < Window_Selectable
def initialize
super(0, 0, 480, 480)
@column_max = 2
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
refresh
self.active = false
self.index = -1
end

def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = i % 2 * 224
y = i / 2 * 224
actor = $game_party.actors[i]
draw_battlegraphic(actor, x + 80, y + 200, 99)
draw_actor_name(actor, x, y)
draw_actor_level(actor, x + 144, y)
draw_actor_class(actor, x, y + 32)
draw_actor_state(actor, x, y + 64)
draw_actor_exp(actor, x, y + 150)
draw_actor_hp(actor, x, y + 96)
draw_actor_sp(actor, x, y + 128)
end
end

def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@index % 2 * 224, @index / 2 * 224, 224, 224)
end
end
end

class Window_Item < Window_Selectable
def initialize
super(0, 64, 304, 416)
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
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...$data_items.size
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
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_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 = 4 + index % 1 * 304
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
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, 197, 32, item.name, 0)
self.contents.draw_text(x + 225, y, 16, 32, ":", 1)
self.contents.draw_text(x + 241, y, 24, 32, number.to_s, 2)
end
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end

class Window_Skill < Window_Selectable
def initialize(actor)
super(0, 128, 304, 352)
@actor = actor
@column_max = 1
refresh
self.index = 0
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
def skill
return @data[self.index]
end

def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
for i in 0...@item_max
draw_item(i)
end
end
end

def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 1 * 304
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.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, 189, 32, skill.name, 0)
self.contents.draw_text(x + 217, y, 48, 32, skill.sp_cost.to_s, 2)
end

def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end

class Window_SkillStat < Window_Base
def initialize(actor)
super(0, 64, 304, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
end
end

class Window_SkillStatus < Window_Base
def initialize(actor)
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_state(@actor, 140, 0)
draw_actor_hp(@actor, 284, 0)
draw_actor_sp(@actor, 460, 0)
end
end

class Window_Target < Window_Selectable

def initialize
super(304, 64, 336, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.z += 10
@item_max = $game_party.actors.size
refresh
end

def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = i * 84
actor = $game_party.actors[i]
draw_actor_name(actor, x, y)
draw_actor_state(actor, x + 144, y)
draw_actor_hp(actor, x, y + 32)
draw_actor_sp(actor, x + 152, y + 32)
end
end

def update_cursor_rect
if self.active == false
self.cursor_rect.empty
end
if self.index >= 0 and self.active
self.cursor_rect.set(0, @index * 84, self.width - 32, 64)
elsif self.index >= -1 and self.active
self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
end
end
end

class Window_EquipRight < Window_Selectable
def initialize(actor)
super(272, 64, 368, 192)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
self.index = 0
end

def item
return @data[self.index]
end

def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
end

def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end


class Window_EquipLeft < Window_Base

def initialize(actor)
super(0, 64, 272, 416)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 4, 32)
draw_actor_parameter(@actor, 4, 64, 0)
draw_actor_parameter(@actor, 4, 96, 1)
draw_actor_parameter(@actor, 4, 128, 2)

draw_actor_parameter(@actor, 4, 160, 3)
draw_actor_parameter(@actor, 4, 192, 4)
draw_actor_parameter(@actor, 4, 224, 5)
draw_actor_parameter(@actor, 4, 256, 6)
draw_actor_parameter(@actor, 4, 288, 7)

if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 160, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 160, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 192, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 192, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 224, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 224, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 256, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 256, 36, 32, @new_int.to_s, 2)
end
if @new_eva != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 288, 40, 32, "→", 1)
self.contents.font.color = normal_color
self.contents.draw_text(200, 288, 36, 32, @new_eva.to_s, 2)
end
end

Revenir en haut Aller en bas
https://kingdomheartsas.forum2jeux.com
Wizard
Maître de la KeyBlade
Maître de la KeyBlade
Wizard


Nombre de messages : 90
Age : 34
Localisation : Tonnerre
Date d'inscription : 14/02/2006

Menu 4 Empty
MessageSujet: Re: Menu 4   Menu 4 EmptyLun 17 Avr 2006, 18:38

Deuxieme partie:

Code:
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
new_agi, new_int, new_eva)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or
@new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or
@new_int != new_int or @new_eva != new_eva

@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
@new_eva = new_eva
refresh
end
end
end

class Window_EquipItem < Window_Selectable

def initialize(actor, equip_type)
super(272, 256, 368, 224)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end

def item
return @data[self.index]
end

def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
@data.push(nil)
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = $fontface
for i in 0...@item_max-1
draw_item(i)
end
end

def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end

def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end

class Window_Status < Window_Base

def initialize(actor)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
@actor = actor
refresh
end

def refresh
self.contents.clear
draw_battlegraphic(@actor, 550, 200, 100)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 112, 172)
draw_actor_sp(@actor, 96, 144, 172)
draw_actor_parameter(@actor, 96, 192, 0)
draw_actor_parameter(@actor, 96, 224, 1)
draw_actor_parameter(@actor, 96, 256, 2)
draw_actor_parameter(@actor, 96, 288, 3)
draw_actor_parameter(@actor, 96, 320, 4)
draw_actor_parameter(@actor, 96, 352, 5)
draw_actor_parameter(@actor, 96, 384, 6)
draw_actor_parameter(@actor, 96, 416, 7)
text = @actor.skills.size
self.contents.draw_text(320 + 155, 112, 32, 32, text.to_s)
self.contents.font.color = system_color
self.contents.draw_text(320, 112, 120, 32, "Tech. learned")
self.contents.draw_text(320, 48, 80, 32, "EXP")
self.contents.draw_text(320, 80, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 160, 96, 32, "Equipment")
draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
end
end

class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end

def main
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Statut"
s5 = "Sauvegarder"
s6 = "Quitter"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
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
if $game_system.save_disabled
@command_window.disable_item(4)
end
@info_window = Window_Infos.new
@info_window.y = 224
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@info_window.dispose
@status_window.dispose
end

def update
@command_window.update
@info_window.update
@status_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end

def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0 # アイテム
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1 # スキル
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # 装備
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # ステータス
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # セーブ
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5 # ゲーム終了
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end

def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1 # スキル
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2 # 装備
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3 # ステータス
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end

class Scene_Item

def main
@help_window = Window_Help.new
@item_window = Window_Item.new
@item_window.help_window = @help_window
@target_window = Window_Target.new
@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
if @item_window.active
update_item
return
end
if @target_window.active
update_target
return
end
end

def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(0)
return
end
if Input.trigger?(Input::C)
@item = @item_window.item
unless @item.is_a?(RPG::Item)
$game_system.se_play($data_system.buzzer_se)
return
end
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @item.scope >= 3
@item_window.active = false
@target_window.active = true
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
else
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$game_system.se_play(@item.menu_se)
if @item.consumable
$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
if Input.trigger?(Input::B)
$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.active = false
return
end
if Input.trigger?(Input::C)
if $game_party.item_number(@item.id) == 0
$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
$game_system.se_play(@item.menu_se)
if @item.consumable
$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
if @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end

Revenir en haut Aller en bas
https://kingdomheartsas.forum2jeux.com
Wizard
Maître de la KeyBlade
Maître de la KeyBlade
Wizard


Nombre de messages : 90
Age : 34
Localisation : Tonnerre
Date d'inscription : 14/02/2006

Menu 4 Empty
MessageSujet: Re: Menu 4   Menu 4 EmptyLun 17 Avr 2006, 18:39

Troisième et derniére partie:

Code:
class Scene_Skill
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end

def main
@actor = $game_party.actors[@actor_index]
@status_window = Window_SkillStat.new(@actor)
@help_window = Window_Help.new
@skill_window = Window_Skill.new(@actor)
@skill_window.help_window = @help_window
@target_window = Window_Target.new
@target_window.active = false
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@status_window.dispose
@help_window.dispose
@skill_window.dispose
@target_window.dispose
end

def update
@status_window.update
@help_window.update
@skill_window.update
@target_window.update
if @skill_window.active
update_skill
return
end
if @target_window.active
update_target
return
end
end

def update_skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(1)
return
end
if Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill == nil or not @actor.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
if @skill.scope >= 3
@skill_window.active = false
@target_window.active = true
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
else
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@skill_window.refresh
@target_window.refresh
$scene = Scene_Map.new
return
end
end
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end

def update_target
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@target_window.active = false
return
end
if Input.trigger?(Input::C)
unless @actor.skill_can_use?(@skill.id)
$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.skill_effect(@actor, @skill)
end
end
if @target_window.index <= -2
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
if @target_window.index >= 0
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
if used
$game_system.se_play(@skill.menu_se)
@actor.sp -= @skill.sp_cost
@status_window.refresh
@skill_window.refresh
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
return
end
if @skill.common_event_id > 0
$game_temp.common_event_id = @skill.common_event_id
$scene = Scene_Map.new
return
end
end
unless used
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end

class Scene_Equip

def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end

def main
@actor = $game_party.actors[@actor_index]
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@right_window.index = @equip_index
refresh
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
end

def refresh
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
item1 = @right_window.item
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
end
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
new_eva = @actor.eva

@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
new_dex, new_agi, new_int, new_eva)
end
end

def update
@left_window.update
@right_window.update
@item_window.update
refresh
if @right_window.active
update_right
return
end
if @item_window.active
update_item
return
end
end

def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(2)
return
end
if Input.trigger?(Input::C)
if @actor.equip_fix?(@right_window.index)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Equip.new(@actor_index, @right_window.index)
return
end
end

def update_item
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
item = @item_window.item
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
@right_window.active = true
@item_window.active = false
@item_window.index = -1
@right_window.refresh
@item_window.refresh
return
end
end
end

class Scene_Status

def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end

def main
@actor = $game_party.actors[@actor_index]
@status_window = Window_Status.new(@actor)
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@status_window.dispose
end

def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(3)
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Status.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Status.new(@actor_index)
return
end
end
end
Revenir en haut Aller en bas
https://kingdomheartsas.forum2jeux.com
Contenu sponsorisé





Menu 4 Empty
MessageSujet: Re: Menu 4   Menu 4 Empty

Revenir en haut Aller en bas
 
Menu 4
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Menu 2
» Menu 3
» Menu 1 (Final Fanasy VII)

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Kingdom Hearts Another Side :: RPG Maker XP :: Les Scripts-
Sauter vers:  
Ne ratez plus aucun deal !
Abonnez-vous pour recevoir par notification une sélection des meilleurs deals chaque jour.
IgnorerAutoriser