Loki
Preferowany:
Pomógł: 12 razy Dołączył: 25 Kwi 2012 Posty: 162
Wysłany: Sob 19 Maj, 2012 18:55
Zmiana klasy bohatera
~ Class changing - V1.0 ~
Autor:
HamsterMan
Kompatybilność:
RPG Maker XP
Skrypt:
Spoiler:
Kod: #==============================
# Class Changing By HamsterMan
#------------------------------
# 30/09/06
#==============================
class Window_ClassChangingHelp < Window_Base
def initialize
super(150, 48, 340, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 16
refresh
end
def refresh
self.contents.draw_text(0, -20, 340, 64, "Press 'C' to change gender")
end
end
#========================================
class Window_CurrentClass < Window_Base
def initialize
super(300, 112, 190, 320)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 20
refresh
end
def refresh
self.contents.clear
draw_actor_graphic($game_party.actors[0], 40, 50)
draw_actor_battler($game_party.actors[0], 140, 270)
self.contents.font.bold = true
self.contents.font.italic = true
draw_actor_class($game_party.actors[0], 60, 0)
self.contents.draw_text(60, 15, 100, 50, "Level")
self.contents.draw_text(110, 15, 50, 50, $game_party.actors[0].level.to_s)
end
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw, y - ch, bitmap, src_rect)
end
end
#========================================
class Window_ClassHelp < Window_Base
def initialize
super(150, 48, 340, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = "Arial"
self.contents.font.size = 16
refresh
end
def refresh
self.contents.draw_text(0, -20, 340, 64, "Press 'C' to change class - Then select 'Confirm'")
end
end
#========================================
class Scene_ClassChanging
def main
m1 = "Male"
m2 = "Female"
@command_window = Window_Command.new(150, [m1, m2])
@command_window.x = 150
@command_window.y = 112
@classchanginghelp_window = Window_ClassChangingHelp.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@classchanginghelp_window.dispose
end
#----------------------------------------
def update
@command_window.update
@classchanginghelp_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_ClassChangeMale.new
when 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_ClassChangeFemale.new
end
return
end
end
end
#========================================
class Scene_ClassChangeMale
def main
s1 = "Fighter"
s2 = "Lancer"
s3 = "Mage"
s4 = "Warrior"
s5 = "Cleric"
s6 = "Gunner"
s7 = "Hunter"
s8 = "Thief"
s9 = "Confirm"
@command_window = Window_Command.new(150, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
@command_window.x = 150
@command_window.y = 112
@currentclass_window = Window_CurrentClass.new
@classhelp_window = Window_ClassHelp.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@currentclass_window.dispose
@classhelp_window.dispose
end
#----------------------------------------
def update
@command_window.update
@currentclass_window.update
@classhelp_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
$scene = Scene_ClassChanging.new
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
$game_party.actors[0].set_graphic("001-Fighter01", 0, "001-Fighter01", 0)
$game_party.actors[0].class_id = 1
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 1
$game_party.actors[0].set_graphic("010-Lancer02", 0, "010-Lancer02", 0)
$game_party.actors[0].class_id = 2
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 2
$game_party.actors[0].set_graphic("035-Mage03", 0, "035-Mage03", 0)
$game_party.actors[0].class_id = 8
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 3
$game_party.actors[0].set_graphic("013-Warrior01", 0, "013-Warrior01", 0)
$game_party.actors[0].class_id = 3
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 4
$game_party.actors[0].set_graphic("025-Cleric01", 0, "025-Cleric01", 0)
$game_party.actors[0].class_id = 7
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 5
$game_party.actors[0].set_graphic("023-Gunner01", 0, "023-Gunner01", 0)
$game_party.actors[0].class_id = 6
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 6
$game_party.actors[0].set_graphic("020-Hunter01", 0, "020-Hunter01", 0)
$game_party.actors[0].class_id = 5
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 7
$game_party.actors[0].set_graphic("016-Thief01", 0, "016-Thief01", 0)
$game_party.actors[0].class_id = 4
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 8
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
return
end
end
end
#========================================
class Scene_ClassChangeFemale
def main
s1 = "Fighter"
s2 = "Lancer"
s3 = "Mage"
s4 = "Warrior"
s5 = "Cleric"
s6 = "Gunner"
s7 = "Hunter"
s8 = "Thief"
s9 = "Confirm"
@command_window = Window_Command.new(150, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
@command_window.x = 150
@command_window.y = 112
@currentclass_window = Window_CurrentClass.new
@classhelp_window = Window_ClassHelp.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@currentclass_window.dispose
@classhelp_window.dispose
end
#----------------------------------------
def update
@command_window.update
@currentclass_window.update
@classhelp_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.buzzer_se)
$scene = Scene_ClassChanging.new
end
if Input.trigger?(Input::C)
case @command_window.index
when 0
$game_party.actors[0].set_graphic("002-Fighter02", 0, "002-Fighter02", 0)
$game_party.actors[0].class_id = 1
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 1
$game_party.actors[0].set_graphic("012-Lancer04", 0, "012-Lancer04", 0)
$game_party.actors[0].class_id = 2
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 2
$game_party.actors[0].set_graphic("039-Mage07", 0, "039-Mage07", 0)
$game_party.actors[0].class_id = 8
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 3
$game_party.actors[0].set_graphic("015-Warrior03", 0, "015-Warrior03", 0)
$game_party.actors[0].class_id = 3
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 4
$game_party.actors[0].set_graphic("029-Cleric05", 0, "029-Cleric05", 0)
$game_party.actors[0].class_id = 7
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 5
$game_party.actors[0].set_graphic("024-Gunner02", 0, "024-Gunner02", 0)
$game_party.actors[0].class_id = 6
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 6
$game_party.actors[0].set_graphic("022-Hunter03", 0, "022-Hunter03", 0)
$game_party.actors[0].class_id = 5
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 7
$game_party.actors[0].set_graphic("019-Thief04", 0, "019-Thief04", 0)
$game_party.actors[0].class_id = 4
$game_system.se_play($data_system.decision_se)
$game_player.refresh
@currentclass_window.refresh
when 8
$game_system.se_play($data_system.decision_se)
$scene = Scene_Map.new
end
return
end
end
end
Screeny:
Dodatkowe informacje:
Wywołanie skryptu:
$scene = Scene_ClassChanging.new