09-01-2006, 01:00 PM
(This post was last modified: 05-13-2017, 04:30 AM by DerVVulfman.)
Leon's CMS Main Menu
Leon Westbrooke
Sep 1, 2006
Most CMS's require you use the whole CMS to use it. I hope that others will do something similar to this and make them close to 'plug and play', where with just a few tweaks, you can take elements from various CMS and put them all together in 1 Menu. (Such as 1 person's Skill menu in their CMS, and another's Main menu, etc.) I hope to make more things similar to this to take compatibility issues between a bunch of scripts closer to the next level.
UPDATE: Due to a flamer, i added the '%' sign into the coding. (big whoop, really...) but it is also untested as of at this moment due to lack-of-laptop at the moment. Will test soon.
To use this script: Put it above Main, and change every instance that says
SDK Compatible?
Yes. It is.
FAQ:
Q: How do I add to the game completion?
A: Use the Call Script in the Event setup and type: $game_party.completion_add That adds 0.1% each time.
Demo:
Game_Completion.zip (Size: 213.57 KB / Downloads: 9)
Leon Westbrooke
Sep 1, 2006
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Most CMS's require you use the whole CMS to use it. I hope that others will do something similar to this and make them close to 'plug and play', where with just a few tweaks, you can take elements from various CMS and put them all together in 1 Menu. (Such as 1 person's Skill menu in their CMS, and another's Main menu, etc.) I hope to make more things similar to this to take compatibility issues between a bunch of scripts closer to the next level.
UPDATE: Due to a flamer, i added the '%' sign into the coding. (big whoop, really...) but it is also untested as of at this moment due to lack-of-laptop at the moment. Will test soon.
To use this script: Put it above Main, and change every instance that says
Code:
$scene = Scene_Menu
Code:
$scene = Scene_menu2
SDK Compatible?
Yes. It is.
FAQ:
Q: How do I add to the game completion?
A: Use the Call Script in the Event setup and type: $game_party.completion_add That adds 0.1% each time.
Demo:
Game_Completion.zip (Size: 213.57 KB / Downloads: 9)
Code:
#+++++++++++++++++++++++++++++++++++
# Leon's CMS Main Menu v.2.0
#===================================
=begin
If you use this CMS main menu, please, just give me a bit of credit. Tis all I ask.
Now, many CMS scripts make it so you must use the entire CMS in your game, but
this one is just the Main Menu. It is designed to be used with any Item System, Skill
System, Equip, etc. It is also SDK compatible. It takes a small amount of script knowledge
to use this, but that information can be found in the tutorial section. Check Dubealex's
tutorials on script. Chapters 1-3.
=end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Party
alias leon_gp_completion_initialize initialize
def initialize
leon_gp_completion_initialize
@completion = 0
@completion1 = 0
end
def completion_add
@completion += 1
if @completion == 10
@completion1 += 1
@completion -= 10
end
end
def completion
@completion
end
def completion1
@completion1
end
end
#----------------------------------------------------------------------
# Window_Info
#----------------------------------------------------------------------
class Window_Info < Window_Base #Defines the class of Window_Info, my small info window.
def initialize #Initializes the Window.
super(0, 0, 398,60) #Size of Window
self.contents = Bitmap.new(width - 32, height - 32) #Defines the text area.
self.contents.font.name = $defaultfonttype #Sets Font Type
self.contents.font.size = $defaultfontsize #Sets Font Size
end #Ends Initilization
def update(help_text) #Updates the window so the text changes.
self.contents.clear #Clears Contents so it can show the new data
self.contents.draw_text(0, 0, 440, 32, help_text) #Shows help_Text variable
end #Ends the update method
end #Ends Window_Info
#----------------------------------------------------------------------
# Window_Gold2
#----------------------------------------------------------------------
class Window_Gold2 < Window_Base #Defines class Window_Gold2 as a window_base
def initialize
super(397, 0, 245, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(45, 0, 160-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(190-cx, 0, cx+20, 32, $data_system.words.gold, 2)
end
end
#----------------------------------------------------------------------
# Window_Menuactors
#----------------------------------------------------------------------
class Window_Menuactors < Window_Selectable
def initialize
super(136, 60, 505, 360)
@column_max = 2
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
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 + 40) % 2 * 242
y = i / 2 * 169
actor = $game_party.actors[i]
draw_actor_graphic(actor, x + 22, y + 58)
draw_actor_name(actor, x + 45, y + 5)
draw_actor_class(actor, x + 45, y + 30)
draw_actor_level(actor, x + 130, y + 30)
draw_actor_state(actor, x + 10, y + 104)
draw_actor_exp(actor, x + 10, y + 126)
draw_actor_hp(actor, x + 10, y + 60)
draw_actor_sp(actor, x + 10, y + 82)
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
x = index % 2 * 242
y = index / 2 * 169
self.cursor_rect.set(x, y, 230, 165)
end
end
end
#----------------------------------------------------------------------
# Window_Location
#----------------------------------------------------------------------
class Window_Location< Window_Base
def initialize
super(0, 420, 346, 61)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
data = load_data("Data/MapInfos.rxdata")
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 248, 32, "Location:")
self.contents.font.color = normal_color
self.contents.draw_text(90, 0, 208, 32, data[$game_map.map_id].name, 2)
end
end
#----------------------------------------------------------------------
# Window_Playtime2
#----------------------------------------------------------------------
class Window_Playtime2< Window_Base
def initialize
super(0, 320, 136, 100)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 100, 32, "Play Time:")
@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.font.color = normal_color
self.contents.draw_text(9, 17, 140, 64, text)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#----------------------------------------------------------------------
# Window_GameCompletion
#----------------------------------------------------------------------
class Window_GameCompletion < Window_Base
def initialize
super(346, 420, 294, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
end
def update
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, 0, 440, 32, "Game Completion:")
self.contents.font.color = normal_color
self.contents.draw_text(158, 0, 102, 32, $game_party.completion1.to_s + "." + $game_party.completion.to_s + "%", 2)
end
end
#=====================================
# Scene_Menu2
#=====================================
class Scene_Menu2
def initialize(menu_index = 0)
@menu_index = menu_index
end
#----------------------------------------------------------------
def main
@info_window = Window_Info.new
@gold2_window = Window_Gold2.new
@location_window = Window_Location.new
@playtime2_window = Window_Playtime2.new
@menuactors_window = Window_Menuactors.new
@gamecomp_window = Window_GameCompletion.new
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Exit"
@menu2_window = Window_Command.new(136, [s1,s2,s3,s4,s5])
@menu2_window.y=59
@menu2_window.height=261
@menu2_window.index = @menu_index
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@info_window.dispose
@gold2_window.dispose
@location_window.dispose
@playtime2_window.dispose
@menu2_window.dispose
@menuactors_window.dispose
@gamecomp_window.dispose
end
#----------------------------------------------------------------
def update
@playtime2_window.update
@location_window.update
@gold2_window.update
@menu2_window.update
@menuactors_window.update
@gamecomp_window.update
case @menu2_window.index #window_a2 is the menu... index is it's cursor position !
when 0 #Remember that the cursor position start at 0, because it's an Array !!
@info_window.update("Shows the items you are carrying.") #item - s1
when 1
@info_window.update("Shows the hero's skills.") #infos -s2
when 2
@info_window.update("Opens the 'Equipment' menu.") #Music A - s3
when 3
@info_window.update("Shows the stats of the heros.") #Music B - s4
when 4
@info_window.update("Opens the 'End Game' menu.")
end
if @menu2_window.active
update_menu2
return
end
if @menuactors_window.active
update_menuactors
return
end
end
#---------------------------------------------------------------------
def update_menu2
if Input.trigger?(Input::cool.gif
$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 @menu2_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
@info_window.update("Opens the 'Items' menu.")
when 1
$game_system.se_play($data_system.decision_se)
@menu2_window.active = false
@menuactors_window.active = true
@menuactors_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@menu2_window.active = false
@menuactors_window.active = true
@menuactors_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@menu2_window.active = false
@menuactors_window.active = true
@menuactors_window.index = 0
when 4
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
def update_menuactors
if Input.trigger?(Input::cool.gif
$game_system.se_play($data_system.cancel_se)
@menu2_window.active = true
@menuactors_window.active = false
@menuactors_window.index = -1
return
end
if Input.trigger?(Input::C)
case @menu2_window.index
when 1
if $game_party.actors[@menuactors_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(@menuactors_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@menuactors_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@menuactors_window.index)
end
return
end
end
end