vindaca510

Telepotation System v1.0

Aug 4th, 2014
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.80 KB | None | 0 0
  1.  
  2. ################################################################################
  3. #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓#
  4. #↓ ↓#
  5. #↓ Teleportation System: Version 1.0 ↓#
  6. #↓ ↓#
  7. #↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕↕#
  8. #↑ ↑#
  9. #↑ Written By: Joe Pro ↑#
  10. #↑ Last Edited: July 31, 2014 ↑#
  11. #↑ ↑#
  12. #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑#
  13. ################################################################################
  14.  
  15. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  16. #◙ ** Disclaimer ◙#
  17. #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙#
  18. #◙ ◙#
  19. #◙ This script is not for commercial, if you wish to use this script in a ◙#
  20. #◙ game please PM me. All credit is to be given to me as the author of this ◙#
  21. #◙ script. ◙#
  22. #◙ ◙#
  23. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  24. #◙ ** How To Use ◙#
  25. #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙#
  26. #◙ ◙#
  27. #◙ * Cusomizable area below. ◙#
  28. #◙ ◙#
  29. #◙ * Use the following command in a script call to call the teleport scene. ◙#
  30. #◙ teleport ◙#
  31. #◙ ◙#
  32. #◙ * Use the following command in a script call to add a location. ◙#
  33. #◙ add_location(id_from_list_below) ◙#
  34. #◙ ◙#
  35. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  36. #◙ ** Updates / Version Notes ◙#
  37. #◙••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••◙#
  38. #◙ ◙#
  39. #◙ v0.1 ◙#
  40. #◙ ~◄◙◙◙◙►~ ◙#
  41. #◙ * This script creates a menu that displays areas the player can travel to. ◙#
  42. #◙ ◙#
  43. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  44.  
  45.  
  46.  
  47. ################################################################################
  48. #↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓#
  49. #↓ ↓#
  50. #↕ Teleportation System: Version 0.1 ↕#
  51. #↑ ↑#
  52. #↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑#
  53. ################################################################################
  54.  
  55.  
  56.  
  57. #==============================================================================
  58. # ** Teleportation System
  59. #------------------------------------------------------------------------------
  60. # This module manages the customizable and function modules.
  61. #==============================================================================
  62. module Teleportation_System
  63.  
  64.  
  65.  
  66. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  67. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  68. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  69. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  70. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  71.  
  72. #=============================================================================
  73. # * Fade Type
  74. #=============================================================================
  75. Fade_Type = "Normal"
  76.  
  77. #=============================================================================
  78. # * Menu Windows BG Options
  79. #=============================================================================
  80. Teleport_SE = "Teleport"
  81. Volume = 80
  82. Pitch = 100
  83.  
  84. #=============================================================================
  85. # * Teleport Header Text
  86. #=============================================================================
  87. Teleport_Header_Text = "Where would you like to teleport to?"
  88.  
  89. #=============================================================================
  90. # * Locations
  91. #=============================================================================
  92. Locations = {
  93.  
  94. #Location ID
  95. 0 => { :display_name => "Adomite Factory",
  96. #[Map_id, X_Tile, Y_Tile, Direction]
  97. :location => [ 4 , 8 , 4 , 2 ],
  98. },
  99.  
  100. 1 => { :display_name => "AEIOU Facility",
  101. #[Map_id, X_Tile, Y_Tile, Direction]
  102. :location => [ 5 , 3 , 55 , 2 ],
  103. },
  104.  
  105. 2 => { :display_name => "Creadair Chamber",
  106. #[Map_id, X_Tile, Y_Tile, Direction]
  107. :location => [ 6 , 3 , 4 , 4 ],
  108. },
  109.  
  110. }
  111.  
  112. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  113. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  114. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙End Customizeable Area◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  115. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  116. #◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙◙#
  117.  
  118.  
  119.  
  120. end
  121.  
  122. #==============================================================================
  123. # ** Game_System
  124. #------------------------------------------------------------------------------
  125. # This class handles system data. It saves the disable state of saving and
  126. # menus. Instances of this class are referenced by $game_system.
  127. #==============================================================================
  128.  
  129. class Game_System
  130.  
  131. #--------------------------------------------------------------------------
  132. # * Public Instance Variables
  133. #--------------------------------------------------------------------------
  134. attr_accessor :teleport_locations # Teleport Locations
  135. attr_accessor :teleporting # Teleport Locations
  136. attr_accessor :list_window_index # Teleport Locations
  137.  
  138. #--------------------------------------------------------------------------
  139. # * Aliasing Method: Object Initialization
  140. #--------------------------------------------------------------------------
  141. alias :gsi04506451 :initialize
  142.  
  143. #--------------------------------------------------------------------------
  144. # * Object Initialization
  145. #--------------------------------------------------------------------------
  146. def initialize
  147. gsi04506451()
  148. @teleport_locations = {}
  149. @teleporting = false
  150. @list_window_index = 0
  151. end
  152.  
  153. end
  154.  
  155.  
  156. #==============================================================================
  157. # ** Game_Map
  158. #------------------------------------------------------------------------------
  159. # This class handles maps. It includes scrolling and passage determination
  160. # functions. The instance of this class is referenced by $game_map.
  161. #==============================================================================
  162.  
  163. class Game_Map
  164.  
  165. #--------------------------------------------------------------------------
  166. # * Aliasing Method: Object Initialization
  167. #--------------------------------------------------------------------------
  168. alias :gmu046560 :update
  169.  
  170. #--------------------------------------------------------------------------
  171. # * Frame Update
  172. # main: Interpreter update flag
  173. #--------------------------------------------------------------------------
  174. def update(main = false)
  175. transfer_player if $game_system.teleporting == true
  176. gmu046560(main)
  177. end
  178.  
  179. #--------------------------------------------------------------------------
  180. # * Teleport Locations
  181. #--------------------------------------------------------------------------
  182. def fade_type
  183. Teleportion_System::Specs::Fade_Type
  184. end
  185.  
  186. #--------------------------------------------------------------------------
  187. # * Teleport Locations
  188. #--------------------------------------------------------------------------
  189. def teleport_se
  190. ["Audio/SE/" + Teleportation_System::Teleport_SE, Teleportation_System::Volume, Teleportation_System::Specs::Pitch]
  191. end
  192.  
  193. #--------------------------------------------------------------------------
  194. # * Teleport Locations
  195. #--------------------------------------------------------------------------
  196. def current_map_info
  197. $game_system.teleport_locations[$game_system.list_window_index][:location]
  198. end
  199.  
  200. #--------------------------------------------------------------------------
  201. # * Frame Update
  202. # main: Interpreter update flag
  203. #--------------------------------------------------------------------------
  204. def transfer_player
  205. $game_system.teleporting = false
  206. map_id = current_map_info[0]
  207. x = current_map_info[1]
  208. y = current_map_info[2]
  209. direction = current_map_info[3]
  210. $game_player.reserve_transfer(map_id, x, y, direction)
  211. $game_temp.fade_type = 1
  212. Audio.se_play(teleport_se[0], teleport_se[1], teleport_se[2])
  213. end
  214.  
  215. end
  216.  
  217.  
  218. #==============================================================================
  219. # ** Game_Interpreter
  220. #------------------------------------------------------------------------------
  221. # An interpreter for executing event commands. This class is used within the
  222. # Game_Map, Game_Troop, and Game_Event classes.
  223. #==============================================================================
  224.  
  225. class Game_Interpreter
  226.  
  227. #--------------------------------------------------------------------------
  228. # * Calls Scene_Teleport Class
  229. #--------------------------------------------------------------------------
  230. def teleport
  231. SceneManager.call(Scene_Teleport)
  232. end
  233.  
  234. #--------------------------------------------------------------------------
  235. # * Add Location by Name
  236. #--------------------------------------------------------------------------
  237. def add_location(id)
  238. $game_system.teleport_locations[id] = Teleportation_System::Locations[id]
  239. end
  240.  
  241. end
  242.  
  243.  
  244. #==============================================================================
  245. # ** Window_Base
  246. #------------------------------------------------------------------------------
  247. # This is a super class of all windows within the game.
  248. #==============================================================================
  249.  
  250. class Window_LocationHeader < Window_Base
  251.  
  252. #--------------------------------------------------------------------------
  253. # * Object Initialization
  254. #--------------------------------------------------------------------------
  255. def initialize(x, y, width, height)
  256. super
  257. refresh
  258. end
  259.  
  260. #--------------------------------------------------------------------------
  261. # * Refresh Processing
  262. #--------------------------------------------------------------------------
  263. def refresh
  264. contents.clear
  265. draw_text_ve(-10, -10, ((Graphics.width / 5) * 3), 50, Teleportation_System::Teleport_Header_Text, 1, 20)
  266. end
  267.  
  268. end
  269.  
  270.  
  271. #==============================================================================
  272. # ** Window_Command
  273. #------------------------------------------------------------------------------
  274. # This window deals with general command choices.
  275. #==============================================================================
  276.  
  277. class Window_ConfirmLocation < Window_Command
  278.  
  279. #--------------------------------------------------------------------------
  280. # * Refresh Processing
  281. #--------------------------------------------------------------------------
  282. def alignment
  283. return 1
  284. end
  285.  
  286. #--------------------------------------------------------------------------
  287. # * Refresh Processing
  288. #--------------------------------------------------------------------------
  289. def col_max
  290. return item_max
  291. end
  292.  
  293. #--------------------------------------------------------------------------
  294. # * Refresh Processing
  295. #--------------------------------------------------------------------------
  296. def window_width
  297. return (Graphics.width / 5) * 3
  298. end
  299.  
  300. #--------------------------------------------------------------------------
  301. # * Refresh Processing
  302. #--------------------------------------------------------------------------
  303. def window_height
  304. return 50
  305. end
  306.  
  307. #--------------------------------------------------------------------------
  308. # * Get Window Height
  309. #--------------------------------------------------------------------------
  310. def make_command_list
  311. add_command("Confirm", :confirm)
  312. add_command("Cancel", :cancel)
  313. end
  314.  
  315. end
  316.  
  317.  
  318. #==============================================================================
  319. # ** Window_Command
  320. #------------------------------------------------------------------------------
  321. # This window deals with general command choices.
  322. #==============================================================================
  323.  
  324. class Window_LocationList < Window_Command
  325.  
  326. #--------------------------------------------------------------------------
  327. # * Get Window Width
  328. #--------------------------------------------------------------------------
  329. def window_width
  330. (Graphics.width / 5) * 2
  331. end
  332.  
  333. #--------------------------------------------------------------------------
  334. # * Get Window Height
  335. #--------------------------------------------------------------------------
  336. def window_height
  337. (Graphics.height / 5) * 3
  338. end
  339.  
  340. #--------------------------------------------------------------------------
  341. # * Teleport Locations
  342. #--------------------------------------------------------------------------
  343. def teleport_locations
  344. $game_system.teleport_locations
  345. end
  346.  
  347. #--------------------------------------------------------------------------
  348. # * Check For Current Map
  349. #--------------------------------------------------------------------------
  350. def not_current_map?(index)
  351. return (teleport_locations[index][:location][0] != $game_map.map_id)
  352. end
  353.  
  354. #--------------------------------------------------------------------------
  355. # * Get Window Height
  356. #--------------------------------------------------------------------------
  357. def make_command_list
  358. teleport_locations.each_key { |i| add_command(teleport_locations[i][:display_name], :select, not_current_map?(i)) }
  359. end
  360.  
  361. end
  362.  
  363.  
  364. #==============================================================================
  365. # ** Scene_Teleport < Scene_MenuBase
  366. #------------------------------------------------------------------------------
  367. # This class performs basic processing related to the teleport screen.
  368. #==============================================================================
  369.  
  370. class Scene_Teleport < Scene_MenuBase
  371.  
  372. #--------------------------------------------------------------------------
  373. # * Object Initialization
  374. #--------------------------------------------------------------------------
  375. def initialize
  376. super
  377. create_windows
  378. end
  379.  
  380. #--------------------------------------------------------------------------
  381. # * Free Viewport
  382. #--------------------------------------------------------------------------
  383. def dispose_main_viewport
  384. @viewport.dispose if @viewport
  385. end
  386.  
  387. #--------------------------------------------------------------------------
  388. # * Create Windows
  389. #--------------------------------------------------------------------------
  390. def create_windows
  391. create_header_window
  392. create_list_window
  393. create_confirm_window
  394. end
  395.  
  396. #--------------------------------------------------------------------------
  397. # * Create List Window
  398. #--------------------------------------------------------------------------
  399. def create_header_window
  400. @location_header_window = Window_LocationHeader.new((Graphics.width / 5) * 1, ((Graphics.height / 5) * 1) - 50, (Graphics.width / 5) * 3, 50)
  401. end
  402.  
  403. #--------------------------------------------------------------------------
  404. # * Create List Window
  405. #--------------------------------------------------------------------------
  406. def create_list_window
  407. @location_list_window = Window_LocationList.new((Graphics.width / 5) * 1.5, (Graphics.height / 5) * 1)
  408. @location_list_window.set_handler(:select, method(:command_select))
  409. end
  410.  
  411. #--------------------------------------------------------------------------
  412. # * Create List Window
  413. #--------------------------------------------------------------------------
  414. def create_confirm_window
  415. @confirm_window = Window_ConfirmLocation.new((Graphics.width / 5), ((Graphics.height / 5) * 2) + 10)
  416. @confirm_window.set_handler(:confirm, method(:command_confirm))
  417. @confirm_window.set_handler(:cancel, method(:command_cancel))
  418. @confirm_window.deactivate
  419. @confirm_window.select(0)
  420. @confirm_window.openness = 0
  421. end
  422.  
  423. #--------------------------------------------------------------------------
  424. # * Create Windows
  425. #--------------------------------------------------------------------------
  426. def command_select
  427. @location_list_window.deactivate
  428. @confirm_window.open
  429. @confirm_window.select(0)
  430. @confirm_window.activate
  431. end
  432.  
  433. #--------------------------------------------------------------------------
  434. # * Create Windows
  435. #--------------------------------------------------------------------------
  436. def command_confirm
  437. $game_system.teleporting = true
  438. return_scene
  439. end
  440.  
  441. #--------------------------------------------------------------------------
  442. # * Create Windows
  443. #--------------------------------------------------------------------------
  444. def command_cancel
  445. @confirm_window.close
  446. @confirm_window.select(0)
  447. @confirm_window.deactivate
  448. @location_list_window.activate
  449. end
  450.  
  451. #--------------------------------------------------------------------------
  452. # * Update Processing
  453. #--------------------------------------------------------------------------
  454. def update
  455. super
  456. case
  457. when Input.trigger?(:B)
  458. return_scene
  459. when Input.trigger?(:UP)
  460. $game_system.list_window_index = @location_list_window.index
  461. when Input.trigger?(:DOWN)
  462. $game_system.list_window_index = @location_list_window.index
  463. end
  464. end
  465.  
  466. end
Advertisement
Add Comment
Please, Sign In to add comment