Guest User

Untitled

a guest
Jul 4th, 2015
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.99 KB | None | 0 0
  1. #=======================================================
  2. # Lune World Map (Templeton Map Mod)
  3. # Original Author: Raizen
  4. # Modifications: William Couillard ([email protected])
  5. # Contact: www.centrorpg.com
  6. # Compatibility: RMVXAce
  7. #=======================================================
  8. # Adds a world map to your game, to be viewed.
  9. # Call Script: SceneManager.call(Scene_Templeton_Map)
  10. #=======================================================
  11. module MAPVOCAB
  12. SHOP_TITLE = "Shopping" # Title of Shops Window
  13. SHOP1_NAME = "Inn" # Name of Shop #1
  14. SHOP2_NAME = "Item Shop" # Name of Shop #2
  15. SHOP3_NAME = "Weapons" # Name of Shop #3
  16. SHOP4_NAME = "Armor" # Name of Shop #4
  17. SHOP5_NAME = "Accessory" # Name of Shop #5
  18. SHOP6_NAME = "Magic" # Name of Shop #6
  19. SHOP7_NAME = "Synthesis" # Name of Shop #7
  20. end
  21. #============================================================================
  22. module Templeton_Map
  23. # World Map Filename
  24. Map_Name = "newplanet"
  25. # Cursor Filename
  26. Map_Cursor = ""
  27. # Cursor's X offset
  28. Cursor_X = 0
  29. # Cursor's Y offset
  30. Cursor_Y = 0
  31. Map_Info = Array.new
  32. # Create locations on your world map below using these instructions
  33. # "Name" => 'Map Image Name', (The filename of the map image )
  34. # "Switch" => Switch ID, (ID of the switch used to unlock location)
  35. # "Position" => [X, Y], (Position of location icon on world map )
  36. # "Icon" => 'Map Icon', (Filename of map location icon )
  37. # "Desc" => 'Description', (Line 1 of map description )
  38. # "Desc2" => 'Description' (Line 2 of map description )
  39. # "Shop1" => true/false, (Shows SHOP1 as either true or false )
  40. # "Shop2" => true/false, (Shows SHOP2 as either true or false )
  41. # "Shop3" => true/false, (Shows SHOP3 as either true or false )
  42. # "Shop4" => true/false, (Shows SHOP4 as either true or false )
  43. # "Shop5" => true/false, (Shows SHOP5 as either true or false )
  44. # "Shop6" => true/false, (Shows SHOP6 as either true or false )
  45. # "Shop7" => true/false (Shows SHOP7 as either true or false )
  46. #=========================================================================
  47. # Map_Info[0]
  48. #=========================================================================
  49. Map_Info[0] =
  50. {
  51. "Name" => 'Fort Casca',
  52. "Switch" => 1,
  53. "Position" => [200, 960],
  54. "Icon" => 'worldmapcursor',
  55. "Desc" => 'Formerly an old base, now a forward operating fort fighting the rebellion.',
  56. "Desc2" => 'Nothing cool ever happens here.',
  57. "Shop1" => true, # Inn
  58. "Shop2" => true, # Item Shop
  59. "Shop3" => true, # Weapons Shop
  60. "Shop4" => true, # Armor Shop
  61. "Shop5" => true, # Accessories Shop
  62. "Shop6" => false, # Magic Shop
  63. "Shop7" => false # Synthesis Shop
  64. }
  65. #=========================================================================
  66. # Map_Info[1]
  67. #=========================================================================
  68. Map_Info[1] =
  69. {
  70. "Name" => 'Barstow Road',
  71. "Switch" => 1,
  72. "Position" => [315, 940],
  73. "Icon" => 'worldmapcursor',
  74. "Desc" => 'Dirt road through the Barstow Forest that dominates much of Landore.',
  75. "Desc2" => 'The rivers cutting through the wood run frigid all times of the year.',
  76. "Shop1" => false, # Inn
  77. "Shop2" => false, # Item Shop
  78. "Shop3" => false, # Weapons Shop
  79. "Shop4" => false, # Armor Shop
  80. "Shop5" => false, # Accessories Shop
  81. "Shop6" => false, # Magic Shop
  82. "Shop7" => false # Synthesis Shop
  83. }
  84. #=========================================================================
  85. # Map_Info[2]
  86. #=========================================================================
  87. Map_Info[2] =
  88. {
  89. "Name" => 'Levitt',
  90. "Switch" => 13,
  91. "Position" => [310, 883],
  92. "Icon" => 'worldmapcursor',
  93. "Desc" => 'Small city once famous for its steel industry, now run dry.',
  94. "Desc2" => '',
  95. "Shop1" => false, # Inn
  96. "Shop2" => false, # Item Shop
  97. "Shop3" => false, # Weapons Shop
  98. "Shop4" => false, # Armor Shop
  99. "Shop5" => false, # Accessories Shop
  100. "Shop6" => false, # Magic Shop
  101. "Shop7" => false # Synthesis Shop
  102. }
  103.  
  104. #=========================================================================
  105. # Map_Info[3]
  106. #=========================================================================
  107. Map_Info[3] =
  108. {
  109. "Name" => 'Fort Varna',
  110. "Switch" => 14,
  111. "Position" => [315, 853],
  112. "Icon" => 'worldmapcursor',
  113. "Desc" => 'Centuries old fort built to protect this area of the Tyr Highroad.',
  114. "Desc2" => '',
  115. "Shop1" => false, # Inn
  116. "Shop2" => false, # Item Shop
  117. "Shop3" => false, # Weapons Shop
  118. "Shop4" => false, # Armor Shop
  119. "Shop5" => false, # Accessories Shop
  120. "Shop6" => false, # Magic Shop
  121. "Shop7" => false # Synthesis Shop
  122. }
  123.  
  124. #=========================================================================
  125. # Map_Info[4]
  126. #=========================================================================
  127. Map_Info[4] =
  128. {
  129. "Name" => 'Tyr Highroad',
  130. "Switch" => 17,
  131. "Position" => [315, 853],
  132. "Icon" => 'worldmapcursor',
  133. "Desc" => 'Massive, ancient road built with the intention of linking the entire Arkwall continent through trade. Many modern roads branch from it.',
  134. "Desc2" => '',
  135. "Shop1" => false, # Inn
  136. "Shop2" => false, # Item Shop
  137. "Shop3" => false, # Weapons Shop
  138. "Shop4" => false, # Armor Shop
  139. "Shop5" => false, # Accessories Shop
  140. "Shop6" => false, # Magic Shop
  141. "Shop7" => false # Synthesis Shop
  142. }
  143.  
  144. #=========================================================================
  145. # Map_Info[5]
  146. #=========================================================================
  147. Map_Info[5] =
  148. {
  149. "Name" => 'Raels Tomb',
  150. "Switch" => 18,
  151. "Position" => [315, 853],
  152. "Icon" => 'worldmapcursor',
  153. "Desc" => 'Recently discovered Prelude ruin, hidden by and built into a cliff face.',
  154. "Desc2" => '',
  155. "Shop1" => false, # Inn
  156. "Shop2" => false, # Item Shop
  157. "Shop3" => false, # Weapons Shop
  158. "Shop4" => false, # Armor Shop
  159. "Shop5" => false, # Accessories Shop
  160. "Shop6" => false, # Magic Shop
  161. "Shop7" => false # Synthesis Shop
  162. }
  163. #===========================================================================
  164. # End of script
  165. #===========================================================================
  166. end
  167. #===========================================================================
  168. # Cache Module
  169. #===========================================================================
  170. module Cache
  171. #--------------------------------------------------------------------------
  172. # * Cache
  173. #--------------------------------------------------------------------------
  174. def self.world_map(filename)
  175. load_bitmap("Graphics/World Map/", filename)
  176. end
  177. end
  178.  
  179. #==============================================================================
  180. # ** Scene_Templeton_Map
  181. #==============================================================================
  182. class Scene_Templeton_Map < Scene_ItemBase
  183. #--------------------------------------------------------------------------
  184. # * start
  185. #--------------------------------------------------------------------------
  186. def start
  187. super
  188. @get_index = 0
  189. $templeton_map_info = Array.new
  190. Templeton_Map::Map_Info.each {|map| $templeton_map_info.push(map) if $game_switches[map['Switch']]}
  191. create_category_window
  192. create_map_window
  193. create_shop_window
  194. end
  195. #--------------------------------------------------------------------------
  196. # * create_category_window
  197. #--------------------------------------------------------------------------
  198. def create_category_window
  199. @help_window = Window_Help_MapT.new
  200. @help_window.viewport = @viewport
  201. @category_window = Window_MapListT.new
  202. @category_window.viewport = @viewport
  203. @category_window.y = @help_window.height
  204. @help_window.z = @category_window.z = 400
  205. @category_window.set_handler(:cancel, method(:return_scene))
  206. end
  207. #--------------------------------------------------------------------------
  208. # * create_map_window
  209. #--------------------------------------------------------------------------
  210. def create_map_window
  211. @item_window = Window_ShowMapT.new
  212. @item_window.viewport = @viewport
  213. @category_window.item_window = @item_window
  214. end
  215. #--------------------------------------------------------------------------
  216. # * create_shop_window
  217. #--------------------------------------------------------------------------
  218. def create_shop_window
  219. @shop_window = Window_ShowShopsT.new
  220. @shop_window.viewport = @viewport
  221. @shop_window.z = 400
  222. @shop_window.y = @help_window.height + @category_window.height
  223. end
  224. #--------------------------------------------------------------------------
  225. # * update
  226. #--------------------------------------------------------------------------
  227. def update
  228. super
  229. @item_window.refresh(@category_window.index) unless $templeton_map_info == []
  230. @help_window.refresh(@category_window.index) unless $templeton_map_info == []
  231. @shop_window.refresh(@category_window.index) unless $templeton_map_info == []
  232. end
  233. #--------------------------------------------------------------------------
  234. # * Category [Confirm]
  235. #--------------------------------------------------------------------------
  236. def on_category_ok
  237. @item_window.activate
  238. @item_window.select_last
  239. end
  240. #--------------------------------------------------------------------------
  241. # * Item [Confirm]
  242. #--------------------------------------------------------------------------
  243. def on_item_ok
  244. $game_party.last_item.object = item
  245. determine_item
  246. end
  247. #--------------------------------------------------------------------------
  248. # * Item [Cancel]
  249. #--------------------------------------------------------------------------
  250. def on_item_cancel
  251. @item_window.unselect
  252. @category_window.activate
  253. end
  254. #--------------------------------------------------------------------------
  255. # * play_se_for_item
  256. #--------------------------------------------------------------------------
  257. def play_se_for_item
  258. Sound.play_use_item
  259. end
  260. #--------------------------------------------------------------------------
  261. # * use_item
  262. #--------------------------------------------------------------------------
  263. def use_item
  264. super
  265. @item_window.redraw_current_item
  266. end
  267. def terminate
  268. super
  269. @shop_window.dispose
  270. @help_window.dispose
  271. @item_window.dispose
  272. @category_window.dispose
  273. end
  274. end
  275.  
  276. #==============================================================================
  277. # ** Window_MapListT
  278. #==============================================================================
  279. class Window_MapListT < Window_Command
  280. include Templeton_Map
  281. #--------------------------------------------------------------------------
  282. # * Public instance variables
  283. #--------------------------------------------------------------------------
  284. attr_reader :item_window
  285. #--------------------------------------------------------------------------
  286. # * initialize
  287. #--------------------------------------------------------------------------
  288. def initialize
  289. super(0, 0)
  290. end
  291. #--------------------------------------------------------------------------
  292. # * window_width
  293. #--------------------------------------------------------------------------
  294. def window_width
  295. 175
  296. end
  297. def window_height
  298. Graphics.height - fitting_height(2) - fitting_height(5)
  299. end
  300. #--------------------------------------------------------------------------
  301. # * process_ok
  302. #--------------------------------------------------------------------------
  303. def process_ok
  304. if current_item_enabled?
  305. Sound.play_ok
  306. Input.update
  307. deactivate
  308. call_ok_handler
  309. else
  310. Sound.play_buzzer
  311. end
  312. end
  313. #--------------------------------------------------------------------------
  314. # * col_max
  315. #--------------------------------------------------------------------------
  316. def col_max
  317. return 1
  318. end
  319. #--------------------------------------------------------------------------
  320. # * update
  321. #--------------------------------------------------------------------------
  322. def update
  323. super
  324. end
  325. #--------------------------------------------------------------------------
  326. # * make_command_list
  327. #--------------------------------------------------------------------------
  328. def make_command_list
  329. for i in 0...$templeton_map_info.length
  330. command = $templeton_map_info[i]['Name']
  331. add_command(command, nil)
  332. end
  333. end
  334. #--------------------------------------------------------------------------
  335. # * item_window
  336. #--------------------------------------------------------------------------
  337. def item_window=(item_window)
  338. @item_window = item_window
  339. update
  340. end
  341. end
  342.  
  343. #==============================================================================
  344. # ** Window_ShowShopsT
  345. #==============================================================================
  346. class Window_ShowShopsT < Window_Base
  347. include Templeton_Map
  348. #--------------------------------------------------------------------------
  349. # * Object initialization
  350. #--------------------------------------------------------------------------
  351. def initialize
  352. super(0, 0, window_width, window_height)
  353. end
  354. #--------------------------------------------------------------------------
  355. # * window_width
  356. #--------------------------------------------------------------------------
  357. def window_width
  358. 175
  359. end
  360. #--------------------------------------------------------------------------
  361. # * window_height
  362. #--------------------------------------------------------------------------
  363. def window_height
  364. Graphics.height - 272
  365. end
  366. #--------------------------------------------------------------------------
  367. # * disabled_color
  368. #--------------------------------------------------------------------------
  369. def disabled_color
  370. text_color(7)
  371. end
  372. #--------------------------------------------------------------------------
  373. # * refresh
  374. #--------------------------------------------------------------------------
  375. def refresh(index)
  376. unless index == nil
  377. self.contents.clear
  378. change_color(system_color)
  379. draw_text(0, 24 * 0, Graphics.width, 24, MAPVOCAB::SHOP_TITLE, 0)
  380. change_color(normal_color)
  381. if $templeton_map_info[index]['Shop1'] == true
  382. change_color(normal_color)
  383. draw_text(0, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP1_NAME, 0)
  384. else
  385. change_color(disabled_color)
  386. draw_text(0, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP1_NAME, 0)
  387. end
  388. if $templeton_map_info[index]['Shop2'] == true
  389. change_color(normal_color)
  390. draw_text(window_width / 2, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP2_NAME, 0)
  391. else
  392. change_color(disabled_color)
  393. draw_text(window_width / 2, 24 * 1, window_width - 24, 24, MAPVOCAB::SHOP2_NAME, 0)
  394. end
  395. if $templeton_map_info[index]['Shop3'] == true
  396. change_color(normal_color)
  397. draw_text(0, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP3_NAME, 0)
  398. else
  399. change_color(disabled_color)
  400. draw_text(0, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP3_NAME, 0)
  401. end
  402. if $templeton_map_info[index]['Shop4'] == true
  403. change_color(normal_color)
  404. draw_text(window_width / 2, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP4_NAME, 0)
  405. else
  406. change_color(disabled_color)
  407. draw_text(window_width / 2, 24 * 2, window_width - 24, 24, MAPVOCAB::SHOP4_NAME, 0)
  408. end
  409. if $templeton_map_info[index]['Shop5'] == true
  410. change_color(normal_color)
  411. draw_text(0, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP5_NAME, 0)
  412. else
  413. change_color(disabled_color)
  414. draw_text(0, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP5_NAME, 0)
  415. end
  416. if $templeton_map_info[index]['Shop6'] == true
  417. change_color(normal_color)
  418. draw_text(window_width / 2, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP6_NAME, 0)
  419. else
  420. change_color(disabled_color)
  421. draw_text(window_width / 2, 24 * 3, window_width - 24, 24, MAPVOCAB::SHOP6_NAME, 0)
  422. end
  423. if $templeton_map_info[index]['Shop7'] == true
  424. change_color(normal_color)
  425. draw_text(0, 24 * 4, window_width - 24, 24, MAPVOCAB::SHOP7_NAME, 0)
  426. else
  427. change_color(disabled_color)
  428. draw_text(0, 24 * 4, window_width - 24, 24, MAPVOCAB::SHOP7_NAME, 0)
  429. end
  430. end
  431. end
  432. end
  433. #==============================================================================
  434. # ** Window_ShowMapT
  435. #==============================================================================
  436. class Window_ShowMapT < Window_Base
  437. include Templeton_Map
  438. #--------------------------------------------------------------------------
  439. # * Object initialization
  440. #--------------------------------------------------------------------------
  441. def initialize
  442. super(160, fitting_height(2) - 12, window_width, window_height)
  443. self.opacity = 0
  444. @x = 0
  445. @y = 0
  446. @nx = 0
  447. @ny = 0
  448. @cursor = Sprite.new
  449. @cursor.bitmap = Cache.world_map(Map_Cursor)
  450. @icon = Sprite.new
  451. @icon.z = 201
  452. @cursor.z = 200
  453. @bitmap = Cache.world_map(Map_Name)
  454. refresh(0) unless $templeton_map_info == []
  455. end
  456. def draw_horz_line(y)
  457. line_y = y + line_height / 2 - 1
  458. contents.fill_rect(0, line_y, contents_width, 2, line_color)
  459. end
  460. #--------------------------------------------------------------------------
  461. # * window_width
  462. #--------------------------------------------------------------------------
  463. def window_width
  464. Graphics.width - 100
  465. end
  466. #--------------------------------------------------------------------------
  467. # * window_height
  468. #--------------------------------------------------------------------------
  469. def window_height
  470. Graphics.height - fitting_height(2) + 24
  471. end
  472. #--------------------------------------------------------------------------
  473. # * line_color
  474. #--------------------------------------------------------------------------
  475. def line_color
  476. color = normal_color
  477. color.alpha = 48
  478. color
  479. end
  480. #--------------------------------------------------------------------------
  481. # * refresh
  482. #--------------------------------------------------------------------------
  483. def refresh(index)
  484. self.contents.clear
  485. @x += 10 if @x <= $templeton_map_info[index]['Position'][0] - window_width/2
  486. @x -= 10 if @x >= $templeton_map_info[index]['Position'][0] - window_width/2
  487. @y += 10 if @y <= $templeton_map_info[index]['Position'][1] - window_height/2
  488. @y -= 10 if @y >= $templeton_map_info[index]['Position'][1] - window_height/2
  489. @cursor.x = @x + 126 + Cursor_X - @nx + window_width/2
  490. @cursor.y = @y + fitting_height(2) + 24 + Cursor_Y - @ny + window_height/2
  491. unless @index == index
  492. @index = index
  493. @icon.bitmap = Cache.world_map($templeton_map_info[index]['Icon'])
  494. end
  495. @icon.x = $templeton_map_info[index]['Position'][0] + 160 - @nx
  496. @icon.y = $templeton_map_info[index]['Position'][1] + 80 - @ny
  497. if @x > @bitmap.width + 24 - window_width
  498. @nx = @bitmap.width + 24 - window_width
  499. elsif @x < 0
  500. @nx = 0
  501. else
  502. @nx = @x
  503. end
  504. if @y > @bitmap.height + 24 - window_height
  505. @ny = @bitmap.height + 24 - window_height
  506. elsif @y < 0
  507. @ny = 0
  508. else
  509. @ny = @y
  510. end
  511. rect = Rect.new(@nx, @ny, self.width , self.height)
  512. contents.blt(0, 0, @bitmap, rect)
  513. end
  514. end
  515. #--------------------------------------------------------------------------
  516. # * dispose
  517. #--------------------------------------------------------------------------
  518. def dispose
  519. super
  520. @icon.bitmap.dispose
  521. @icon.dispose
  522. @cursor.bitmap.dispose
  523. @cursor.dispose
  524. end
  525.  
  526.  
  527. #=================================================================
  528. # ** Window_Help_MapT
  529. #==============================================================================
  530. class Window_Help_MapT < Window_Base
  531. include Templeton_Map
  532. #--------------------------------------------------------------------------
  533. # * Object initialization
  534. #--------------------------------------------------------------------------
  535. def initialize
  536. super(0, 0, Graphics.width, fitting_height(2))
  537. refresh(nil)
  538. end
  539. #--------------------------------------------------------------------------
  540. # * refresh
  541. #--------------------------------------------------------------------------
  542. def refresh(index)
  543. unless index == nil
  544. self.contents.clear
  545. draw_text(0, -12, Graphics.width, fitting_height(1), $templeton_map_info[index]['Desc'], 0)
  546. draw_text(0, 12, Graphics.width, fitting_height(1), $templeton_map_info[index]['Desc2'], 0)
  547. end
  548. end
  549. #==============================================================================
  550. end # of script
Advertisement
Add Comment
Please, Sign In to add comment