Advertisement
Guest User

non rpg menu item with weapon

a guest
Sep 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.97 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - Non RPG Main Menu
  3. # Version : 0.8 (In development)
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. # -----------------------------------------------------------------------------
  7. # Requires :
  8. # >> Theo - Object Core Movement (can be found in Theo - Basic Modules)
  9. # =============================================================================
  10. # Change Logs :
  11. # -----------------------------------------------------------------------------
  12. # 2013.07.23 - Finished script
  13. # =============================================================================
  14. =begin
  15.  
  16. Perkenalan :
  17. Script ini didesain untuk game non-RPG yang hanya berisi item, load, save
  18. dan game end
  19.  
  20. Cara penggunaan :
  21. Pasang dibawah material namun diatas main
  22. Edit konfigurasinya kalo perlu
  23.  
  24. Terms of Use :
  25. Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  26. keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  27. dipake buat komersil, jangan lupa, gw dibagi gratisannya.
  28.  
  29. Note :
  30. 1. Kalo kamu pengen menumu ada show location dan playtime, gunakan juga
  31. script gw yg namanya Theo - Simple Menu Info
  32. 2. Karena gw ga tau apa aja yg dibutuhin di game non-RPG, jadi kalo ada
  33. saran-saran untuk perkembangan script ini, kasi tau gw
  34. 3. Kalo kamu pake script gw yg Theo - Non-RPG Actor Biography, taruh script
  35. ini dibawahnya.
  36.  
  37. =end
  38. # =============================================================================
  39. # Konfigurasi :
  40. # =============================================================================
  41. module THEO
  42. module NONRPG
  43.  
  44. # Deskripsi help untuk command
  45. Command_Helps = {
  46. "Items" => "Check Your Inventory",
  47. "Load" => "Load Game",
  48. "Save" => "Save Game",
  49. "Game End" => "End the Game",
  50. }
  51.  
  52. Load_Vocab = "Load"
  53.  
  54. ItemWindow_DisplayAmount = true # Kalo true, item ditampilin jumlahnya
  55. ItemWindow_DisplayOnly = false # Kalo true, item ga bisa digunain
  56. ItemWindow_Width = 200 # Lebar item window
  57.  
  58. Display_HelpWindow = true # Centang true kalo pengen nampilih help window
  59. HelpWindow_ItemOnly = true # Help window hanya untuk item
  60. HelpWindow_BackType = 2 # Tipe background help window (0,1,2)
  61. # 0 = Windowskin Biasa
  62. # 1 = Dim Background
  63. # 2 = Transparan background
  64.  
  65. end
  66. end
  67. # =============================================================================
  68. # Akhir dari konfigurasi
  69. # =============================================================================
  70. if ($imported ||= {})[:Theo_Movement]
  71. $imported[:Theo_NonRPGMenu] = true
  72. class Window_MenuCommand < Window_Command
  73.  
  74. # Overwrite Command List
  75. def make_command_list
  76. add_main_commands
  77. add_original_commands
  78. add_load_command
  79. add_save_command
  80. add_game_end_command
  81. end
  82.  
  83. def add_main_commands
  84. add_command(Vocab::item, :item, main_commands_enabled)
  85. add_command("Weapon", :weapon, main_commands_enabled)
  86. if $imported[:Theo_NonRPGBioGraphy]
  87. add_command(Vocab::status,:status,main_commands_enabled)
  88. end
  89. end
  90.  
  91. def add_load_command
  92. add_command(THEO::NONRPG::Load_Vocab, :continue, continue_enabled)
  93. end
  94.  
  95. def continue_enabled
  96. DataManager.save_file_exists?
  97. end
  98.  
  99. def update_help
  100. help = THEO::NONRPG::Command_Helps[command_name(index)]
  101. @help_window.set_text(help)
  102. end
  103.  
  104. end
  105.  
  106. class Window_MenuHelp < Window_Help
  107.  
  108. def initialize(line_number = 2)
  109. super(line_number)
  110. self.opacity = 0 if THEO::NONRPG::HelpWindow_BackType > 0
  111. self.openness = THEO::NONRPG::HelpWindow_ItemOnly ? 0 : 255
  112. create_background
  113. check_visibility
  114. end
  115.  
  116. def create_background
  117. create_back_bitmap
  118. create_back_sprite
  119. end
  120.  
  121. def create_back_bitmap
  122. @back_bitmap = Bitmap.new(width, height)
  123. rect1 = Rect.new(0, 0, width, 12)
  124. rect2 = Rect.new(0, 12, width, height - 24)
  125. rect3 = Rect.new(0, height - 12, width, 12)
  126. @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
  127. @back_bitmap.fill_rect(rect2, back_color1)
  128. @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  129. end
  130.  
  131. def back_color1
  132. Color.new(0, 0, 0, 160)
  133. end
  134.  
  135. def back_color2
  136. Color.new(0, 0, 0, 0)
  137. end
  138.  
  139. def create_back_sprite
  140. @back_sprite = Sprite.new
  141. @back_sprite.bitmap = @back_bitmap if THEO::NONRPG::HelpWindow_BackType == 1
  142. end
  143.  
  144. def check_visibility
  145. @back_sprite.visible = self.visible = THEO::NONRPG::Display_HelpWindow
  146. end
  147.  
  148. def dispose
  149. @back_sprite.dispose
  150. @back_bitmap.dispose
  151. super
  152. end
  153.  
  154. end
  155.  
  156. class Window_MenuItem < Window_ItemList
  157.  
  158. def initialize(*args)
  159. super(*args)
  160. self.category = :item
  161. end
  162.  
  163. def draw_item_number(rect, item)
  164. super if THEO::NONRPG::ItemWindow_DisplayAmount
  165. end
  166.  
  167. def col_max
  168. return 1
  169. end
  170.  
  171. def update_open
  172. self.openness += 20
  173. @opening = false if open?
  174. end
  175.  
  176. def update_close
  177. self.openness -= 20
  178. @closing = false if close?
  179. end
  180.  
  181. def translucent_alpha
  182. return 255
  183. end
  184.  
  185. end
  186.  
  187. class Scene_Menu < Scene_MenuBase
  188.  
  189. include THEO::NONRPG
  190.  
  191. alias theo_non_rpg_menu_start start
  192. def start
  193. theo_non_rpg_menu_start
  194. create_menu_help
  195. create_item_window
  196. create_windows_notify
  197. update_windows_placement
  198. end
  199.  
  200. alias theo_nonrpg_command_window create_command_window
  201. def create_command_window
  202. theo_nonrpg_command_window
  203. @command_window.set_handler(:continue, method(:on_load_ok))
  204. @command_window.set_handler(:weapon, method(:on_weapon_ok))
  205. end
  206.  
  207. def update_windows_placement
  208. @command_window.x = (Graphics.width - @command_window.width)/2
  209. @command_window.y = Graphics.height/2 - (@command_window.height/2 +
  210. @gold_window.height/2)
  211. update_gold_window_placement
  212. update_item_window_position
  213. end
  214.  
  215. def create_menu_help
  216. @help_window = Window_MenuHelp.new
  217. @command_window.help_window = @help_window
  218. end
  219.  
  220. def create_item_window
  221. width = THEO::NONRPG::ItemWindow_Width
  222. height = @command_window.height + @gold_window.height
  223. @item_window = Window_MenuItem.new(0,0,width,height)
  224. @item_window.set_handler(:ok, method(:on_item_ok))
  225. @item_window.set_handler(:cancel, method(:on_item_cancel))
  226. @item_window.help_window = @help_window
  227. @item_window.openness = 0
  228. end
  229.  
  230. def create_windows_notify
  231. end
  232.  
  233. def update_gold_window_placement
  234. @gold_window.x = @command_window.x
  235. @gold_window.y = @command_window.y + @command_window.height
  236. end
  237.  
  238. def update_item_window_position
  239. @item_window.x = @command_window.x + @command_window.width
  240. @item_window.y = @command_window.y
  241. end
  242.  
  243. def command_item
  244. @item_window.category = :item
  245. @help_window.open if HelpWindow_ItemOnly
  246. xpos = Graphics.width/2 - (@command_window.width/2 + @item_window.width/2)
  247. ypos = @command_window.y
  248. @command_window.goto(xpos,ypos,10)
  249. @item_window.activate
  250. @item_window.select(0)
  251. @item_window.open
  252. end
  253.  
  254. def on_item_ok
  255. if ItemWindow_DisplayOnly
  256. @item_window.activate
  257. return
  258. end
  259. play_se_for_item
  260. $game_party.members[0].use_item(@item_window.item)
  261. check_common_event
  262. check_gameover
  263. @item_window.activate
  264. @item_window.refresh
  265. end
  266.  
  267. def on_weapon_ok
  268. @item_window.category = :weapon
  269. @help_window.open if HelpWindow_ItemOnly
  270. xpos = Graphics.width/2 - (@command_window.width/2 + @item_window.width/2)
  271. ypos = @command_window.y
  272. @command_window.goto(xpos,ypos,10)
  273. @item_window.activate
  274. @item_window.select(0)
  275. @item_window.open
  276. end
  277.  
  278. def on_item_cancel
  279. @help_window.openness = 0 if HelpWindow_ItemOnly
  280. if @command_window.moving?
  281. @item_window.activate
  282. return
  283. end
  284. xpos = (Graphics.width - @command_window.width)/2
  285. ypos = @command_window.y
  286. @command_window.goto(xpos,ypos,10)
  287. @command_window.activate
  288. @item_window.close
  289. @item_window.unselect
  290. end
  291.  
  292. def on_load_ok
  293. SceneManager.call(Scene_Load)
  294. end
  295.  
  296. # Overwrite command personal
  297. def command_personal
  298. SceneManager.call(Scene_Status)
  299. end
  300.  
  301. alias theo_non_rpg_menu_update update
  302. def update
  303. theo_non_rpg_menu_update
  304. update_gold_window_placement
  305. update_item_window_position
  306. end
  307.  
  308. # Delete Status Window
  309. def create_status_window
  310. end
  311.  
  312. def check_common_event
  313. SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?
  314. end
  315.  
  316. def play_se_for_item
  317. Sound.play_use_item
  318. end
  319.  
  320. end
  321. else
  322. msgbox "Theo - Non-RPG Main Menu Requires Theo - Core Movement \n" +
  323. "It can be found in Theo - Basic Modules \n" +
  324. "Please visit http://theolized.blogspot.com"
  325. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement