Advertisement
Dekita

$D13x Teleport v1.3

May 21st, 2013
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.76 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Teleport
  5. # -- Author : Dekita
  6. # -- Version : 1.3
  7. # -- Level : Normal
  8. # -- Requires : $D13x - Core v1.8+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Teleport]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 17/o5/2o13 - Compatibility, ($D13x WindowSkins)
  21. # - ($D13x Scene BackGrounds)
  22. # - Changed List From Array => Hash (for ease of use)
  23. # 16/o5/2o13 - Update, (improved disable/enable code)
  24. # - (added Hidden_Name feature's)
  25. # - (fixed typo's)
  26. # 14/o5/2o13 - Update, (added auto-jump selection cursor)
  27. # 12/o5/2o13 - Finished,
  28. # 1o/o5/2o13 - Started
  29. #
  30. #===============================================================================
  31. # ☆ Introduction
  32. #-------------------------------------------------------------------------------
  33. # This script enables a reasonably animated teleportation scene.
  34. # Each teleport location can cost gold.
  35. # Easy script calls to add/remove each teleport location and
  36. # disable/enable each available teleport location.
  37. #
  38. # This script also replicates the "Search" feature from FF10.
  39. # This feature allows the player to "search" the map for specific co-ordinates,
  40. # if certain co-ordinates are found it will activate/enable a new
  41. # location.
  42. #
  43. # Remember. This script needs images to function, Check the $D13x Master Demo
  44. # If you need the images.
  45. #
  46. # NOTE: You MUST!! have at least 1 telepoprt location available before calling
  47. # the teleport scene. the easiest way of doing this is to add a teleport before
  48. # calling the scene.
  49. # If party already has a location it cannot be re-added and will be ignored.
  50. #
  51. #===============================================================================
  52. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  53. #===============================================================================
  54. # 1. You MUST give credit to "Dekita" !!
  55. # 2. You are NOT allowed to repost this script.(or modified versions)
  56. # 3. You are NOT allowed to convert this script.
  57. # 4. You are NOT allowed to use this script for Commercial games.
  58. # 5. ENJOY!
  59. #
  60. # "FINE PRINT"
  61. # By using this script you hereby agree to the above terms and conditions,
  62. # if any violation of the above terms occurs "legal action" may be taken.
  63. # Not understanding the above terms and conditions does NOT mean that
  64. # they do not apply to you.
  65. # If you wish to discuss the terms and conditions in further detail you can
  66. # contact me at http://dekitarpg.wordpress.com/
  67. #
  68. #===============================================================================
  69. # ☆ Instructions
  70. #-------------------------------------------------------------------------------
  71. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  72. #
  73. #===============================================================================
  74. # ☆ Script Calls
  75. #-------------------------------------------------------------------------------
  76. # $game_party.can_port = BOOL
  77. # use this script call to disable ALL unocked teleport id's,
  78. # it will also disable the menu command(if enabled).
  79. #
  80. # $game_party.add_teleport(ID)
  81. # Script call to add a teleport location to the available list.
  82. #
  83. # $game_party.find_new_teleport(ID)
  84. # Script call to add a teleport location to the available list.
  85. # This call will make the name initially hidden.
  86. #
  87. # $game_party.del_teleport(ID)
  88. # Call to remove a Teleport Location from the current list.
  89. #
  90. # $game_party.disable_port(ID)
  91. # Call to Disable an available teleport location.
  92. #
  93. # $game_party.enable_port(ID)
  94. # Call to enable a disabled teleport location.
  95. #
  96. # $game_party.hide_teleport_name(ID)
  97. # Call to hide a teleport location's name.
  98. #
  99. # $game_party.show_teleport_name(ID)
  100. # Call to show a teleport location's name (if name is hidden).
  101. #
  102. # $game_party.auto_port(ID, Cost Gold)
  103. # Call to automatically teleport to a location, also adds the teleport id
  104. # into the available list if not already added.
  105. #
  106. # BOOL = true / false (default is true)
  107. # ID = The Teleport::List[ id ] (defined below)
  108. # Cost_Gold = true / false (autoport automatically reduce gold? default = false)
  109. #
  110. #-------------------------------------------------------------------------------
  111. # SceneManager.call(Scene_Teleport)
  112. # ^ To call teleport scene.
  113. #
  114. #===============================================================================
  115. module Teleport
  116. #===============================================================================
  117. List=[] # << Keep
  118. General={# << Keep
  119. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  120. # ☆ General Vocab
  121. #--------------------------------------------------------------------------
  122. # << Used for help wind while confirming travel.
  123. :confirm => "Confirm Travel To %s for %s Gold ?",
  124. :cancel => "Cancel Travel To %s ?",
  125.  
  126. # << Used for confirm travel commands
  127. :conf_B => "Confirm",
  128. :canc_B => "Cancel",
  129.  
  130. # << Used in Co-Ordinate Screen
  131. :co_ords => "Co-ords :",
  132.  
  133. # << Used in gold Screen, format = [icon id, "Text" ]
  134. :gold => [361, "Gold :"],
  135.  
  136. }# << Keep
  137.  
  138. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  139. # ☆ Command Settings
  140. #--------------------------------------------------------------------------
  141. # << Max visible Commands
  142. Max_Commands = 2
  143.  
  144. # << Commands Alignment
  145. Command_Align = 1
  146.  
  147. # << Commands Shown
  148. Commands=[
  149. [:teleport, "Teleport", "Select Teleport Destination."],
  150. [:search , "Find", "Search Map Co-Ordinates For New Locations." ],
  151. [:exit, "Exit", "Return To Map."],
  152. ]
  153.  
  154. # Add Teleport command into menu ? format = [ show? , "Name" ]
  155. Add_2_Menu = [ true , "Teleport" ]
  156.  
  157. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  158. # ☆ Teleport Configuration
  159. #--------------------------------------------------------------------------
  160. # << Animation id's
  161. Start_Tele_Ani = 112
  162. End_Tele_Ani = 113
  163.  
  164. # This is where all teleport information is stored, things such as map id,
  165. # direction ect.. map img x/y are the map image display co-ordinates.
  166. # ie where you search to find the location and where the cursor moves to
  167. # when selecting location from available list.
  168. # [id] = [name , map, x, y, dir, 'info', cost, map img x, map img y]
  169. List[1] = {
  170. :name => 'Oak Forest',
  171. :map_ => [2, 18, 8, 2], # [map id, x, y, dir]
  172. :info => "Teleport To Oak Forest. \nPrice : Free",
  173. :cost => 0,
  174. :img_ => ["Teleport Map", 108, 86],
  175. }
  176.  
  177. List[2] = {
  178. :name => 'Stone Cavern',
  179. :map_ => [4, 12, 16, 2], # [map id, x, y, dir]
  180. :info => "Teleport To Stone Cavern. \nPrice : Free",
  181. :cost => 0,
  182. :img_ => ["Teleport Map", 102, 80],
  183. }
  184.  
  185. List[3] = {
  186. :name => 'Green Land',
  187. :map_ => [5, 8, 26, 8], # [map id, x, y, dir]
  188. :info => "Teleport To Green Land. \nPrice : Free",
  189. :cost => 0,
  190. :img_ => ["Teleport Map", 38, 271],
  191. }
  192.  
  193. List[4] = {
  194. :name => 'UnderGround',
  195. :map_ => [3, 5, 5, 2], # [map id, x, y, dir]
  196. :info => "Teleport Deep Underground. \nPrice : Free",
  197. :cost => 0,
  198. :img_ => ["Teleport Map", 38, 271],
  199. }
  200.  
  201. List[5] = {
  202. :name => 'Big Palace',
  203. :map_ => [3, 5, 5, 2], # [map id, x, y, dir]
  204. :info => "Teleport Inside The Big Palace. \nPrice : Free",
  205. :cost => 0,
  206. :img_ => ["Teleport Map", 38, 271],
  207. }
  208.  
  209. # << ADD More List[ id ] here. Follow the same format as above.
  210.  
  211. # The items in this list are "hidden" ie they can be found by searching
  212. # the map image for locations, simply enter the List[ id ] number for the
  213. # list items that should be found by searching.
  214. Hidden_List = [ 3, 4, 5 ]
  215.  
  216. # This will be the name for a newly found location using the search feature.
  217. # The name will change(to above setting) after teleporting to the area.
  218. Hidden_Name = '???'
  219.  
  220. # Use Hidden_Name feature ? true = yes, false = no.
  221. Use_Hid_Nam = true
  222.  
  223. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  224. # ☆ Graphic Settings
  225. #--------------------------------------------------------------------------
  226. # Graphics used for Map and Selector. MUST Be In The Graphics\\System Folder.
  227. # Map image should be (396*284) pixels in size (for default vx ace resolution)
  228. Sel_Image = "Teleport Selector"
  229. Opacity = 155 # Map image opacity
  230.  
  231. # Selection Cursor Move Type. Can be :scroll or :select
  232. # :scroll = cursor slowly moves to set co-ordinates
  233. # :select = cursor auto-jumps to set co-ordinates
  234. # Does NOT effect Search feature.
  235. Sel_Type = :select # :scroll
  236.  
  237. #--------------------------------------------------------------------------
  238. # This option only works if using my $D13x Scene Backgrounds Script.
  239. # The background folder is set in the Scene BackGrounds script.
  240. #--------------------------------------------------------------------------
  241. BGs=[
  242. # ['NAME' , x, y, x scroll, y scroll, z, hue, init opac, max opac],
  243. ['Sunbeam_Overlay_by ShinGamix',0,0, 0, 0, 1, 0, 105, 155],
  244. ['ShinGamox_by ShinGamix',0,0, 0, 0, 1, 0, 105, 145],
  245. ['Fog_By_hyde' , 100, 100, 2, -2, 1, 0, 74, 75],
  246. ]# << end
  247.  
  248. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  249. # ☆ Window Settings
  250. #--------------------------------------------------------------------------
  251. # This is where you set the windowskin for each window.
  252. # Simply put a # at the start of lines you want to keep the default
  253. # NOTE : This setting requires $D13x Window Skins Script.
  254. # The windowskin folder is set in the WindowSkins script also.
  255. #--------------------------------------------------------------------------
  256. Skins={ # << KEEP !!
  257. # :window type => ["Skin Name" , hue, opacity]
  258. :command => ["PWI_Style_Blu", 0, 225],
  259. :help => ["PWI_Style_Blu", 0, 225],
  260. :tele_list => ["PWI_Style_Blu", 0, 225],
  261. :tele_map => ["PWI_Style_Blu", 0, 225],
  262. :tele_gold => ["PWI_Style_Blu", 0, 225],
  263. :tele_time => ["PWI_Style_Blu", 0, 225],
  264. :tele_posi => ["PWI_Style_Blu", 0, 225],
  265. } # << Keep
  266. #####################
  267. # CUSTOMISATION END #
  268. end #####################
  269. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  270. # #
  271. # http://dekitarpg.wordpress.com/ #
  272. # #
  273. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  274. #===============================================================================#
  275. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  276. # YES?\.\. #
  277. # OMG, REALLY? \| #
  278. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  279. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  280. #===============================================================================#
  281. class Game_Temp
  282. #===============================================================================
  283. #--------------------------------------------------------------------------
  284. # Pi Variables
  285. #--------------------------------------------------------------------------
  286. attr_accessor :tele_search
  287. #--------------------------------------------------------------------------
  288. # Alias List
  289. #--------------------------------------------------------------------------
  290. alias :init_de_tele :initialize
  291. #--------------------------------------------------------------------------
  292. # * Object Initialization
  293. #--------------------------------------------------------------------------
  294. def initialize
  295. init_de_tele
  296. @tele_search = [0,0]
  297. end
  298.  
  299. end
  300.  
  301. #===============================================================================
  302. class Game_Party < Game_Unit
  303. #===============================================================================
  304. #-----------------------------------------------------------------------------
  305. # Pi Variables
  306. #-----------------------------------------------------------------------------
  307. attr_accessor :can_port
  308. attr_accessor :tp_list
  309. attr_accessor :new_tp_id
  310. attr_accessor :tps_disabled
  311. attr_accessor :just_ported
  312. #-----------------------------------------------------------------------------
  313. # Alias List
  314. #-----------------------------------------------------------------------------
  315. alias :init_tp_list :initialize
  316. #-----------------------------------------------------------------------------
  317. # Object Initialization
  318. #-----------------------------------------------------------------------------
  319. def initialize
  320. init_tp_list
  321. @can_port = true
  322. @just_ported = false
  323. @tp_list = Array.new
  324. @tps_disabled = Array.new(Teleport::List.size) {false}
  325. @new_tp_id = Array.new(Teleport::Hidden_List.size) {true}
  326. end
  327. #-----------------------------------------------------------------------------
  328. # Add Teleport To List
  329. #-----------------------------------------------------------------------------
  330. def add_teleport(id)
  331. return unless Teleport::List[id] != nil
  332. @tp_list << id unless @tp_list.include?(id)
  333. @new_tp_id[id] = false if @new_tp_id[id] != false
  334. @tp_list.sort!
  335. end
  336. #-----------------------------------------------------------------------------
  337. # Add Teleport To List (via search)
  338. #-----------------------------------------------------------------------------
  339. def find_new_teleport(id)
  340. add_teleport(id)
  341. @new_tp_id[id] = true
  342. end
  343. #-----------------------------------------------------------------------------
  344. # Remove Teleport From List
  345. #-----------------------------------------------------------------------------
  346. def del_teleport(id)
  347. return unless @tp_list[id] != nil
  348. @new_tp_id[id] = true if @new_tp_id[id] != true
  349. @tp_list.delete(id)
  350. @tp_list.sort!
  351. end
  352. #-----------------------------------------------------------------------------
  353. # Disable Available Teleport
  354. #-----------------------------------------------------------------------------
  355. def disable_port(id)
  356. @tps_disabled[id] = true if @tps_disabled[id] != true
  357. end
  358. #-----------------------------------------------------------------------------
  359. # Enable Disabled Teleport
  360. #-----------------------------------------------------------------------------
  361. def enable_port(id)
  362. @tps_disabled[id] = false if @tps_disabled[id] != false
  363. end
  364. #-----------------------------------------------------------------------------
  365. # Hide Teleport Name
  366. #-----------------------------------------------------------------------------
  367. def hide_teleport_name(id)
  368. @new_tp_id[id] = true if @new_tp_id[id] != true
  369. end
  370. #-----------------------------------------------------------------------------
  371. # Show Teleport Name
  372. #-----------------------------------------------------------------------------
  373. def show_teleport_name(id)
  374. @new_tp_id[id] = false if @new_tp_id[id] != false
  375. end
  376. #-----------------------------------------------------------------------------
  377. # Automatic Teleport (also adds teleport if not in list)
  378. #-----------------------------------------------------------------------------
  379. def auto_port(id, cost_gold = false)
  380. add_teleport(id)
  381. info = Teleport::List[id]
  382. $game_party.gain_gold(-info[:cost]) if (info[:cost] > 0) && (cost_gold)
  383. $game_player.reserve_transfer(info[:map_][0],info[:map_][1],info[:map_][2],info[:map_][3])
  384. $game_player.transparent = true
  385. $game_player.animation_id = Teleport::Start_Tele_Ani
  386. $game_player.followers.each do |char|
  387. next unless char.actor != nil
  388. char.transparent = true
  389. char.animation_id = Teleport::Start_Tele_Ani
  390. end
  391. @just_ported = true
  392. show_teleport_name(id)
  393. end
  394.  
  395. end
  396.  
  397. #===============================================================================
  398. class Window_MenuCommand < Window_Command
  399. #===============================================================================
  400. #-----------------------------------------------------------------------------
  401. # Alias List
  402. #-----------------------------------------------------------------------------
  403. alias :add_teleport_commands :add_original_commands
  404. #-----------------------------------------------------------------------------
  405. # For Adding Original Commands
  406. #-----------------------------------------------------------------------------
  407. def add_original_commands
  408. add_teleport_commands
  409. add_tele_command if Teleport::Add_2_Menu[0]
  410. end
  411. #-----------------------------------------------------------------------------
  412. # Add Teleport Command
  413. #-----------------------------------------------------------------------------
  414. def add_tele_command
  415. add_command(Teleport::Add_2_Menu[1], :teleport, can_add_tele)
  416. end
  417. #-----------------------------------------------------------------------------
  418. # Can Enable Teleport ?
  419. #-----------------------------------------------------------------------------
  420. def can_add_tele
  421. return false unless $game_party.can_port
  422. return false if $game_party.tp_list.empty?
  423. return true
  424. end
  425.  
  426. end
  427.  
  428. #===============================================================================
  429. class Window_TeleportCommand < Window_Command
  430. #===============================================================================
  431. #-----------------------------------------------------------------------------
  432. # Object Initialization
  433. #-----------------------------------------------------------------------------
  434. def initialize(x, y)
  435. @type = :normal
  436. super(x, y)
  437. end
  438. #-----------------------------------------------------------------------------
  439. # Get Window Width
  440. #-----------------------------------------------------------------------------
  441. def window_width
  442. return Graphics.width / 4
  443. end
  444. #--------------------------------------------------------------------------
  445. # Get Window Height
  446. #--------------------------------------------------------------------------
  447. def window_height
  448. fitting_height(Teleport::Max_Commands)
  449. end
  450. #-----------------------------------------------------------------------------
  451. # Alignment
  452. #-----------------------------------------------------------------------------
  453. def alignment
  454. return Teleport::Command_Align
  455. end
  456. #-----------------------------------------------------------------------------
  457. # Set Type
  458. #-----------------------------------------------------------------------------
  459. def type=(val)
  460. return unless @type != val
  461. @type = val
  462. refresh
  463. end
  464. #-----------------------------------------------------------------------------
  465. # Get Type
  466. #-----------------------------------------------------------------------------
  467. def type
  468. return @type
  469. end
  470. #-----------------------------------------------------------------------------
  471. # Create Command List
  472. #-----------------------------------------------------------------------------
  473. def make_command_list
  474. case @type
  475. when :normal
  476. for command in Teleport::Commands
  477. add_command(command[1],command[0])
  478. end
  479. when :confirm
  480. add_command(Teleport::General[:conf_B],:confirm)
  481. add_command(Teleport::General[:canc_B] ,:cancelC)
  482. end
  483. end
  484.  
  485. end
  486.  
  487. #===============================================================================
  488. class Window_TeleportList < Window_Command
  489. #===============================================================================
  490. #-----------------------------------------------------------------------------
  491. # Object Initialization
  492. #-----------------------------------------------------------------------------
  493. def initialize(x, y, height)
  494. @height = height
  495. super(x, y)
  496. select(-1)
  497. deactivate
  498. end
  499. #-----------------------------------------------------------------------------
  500. # Get Window Width
  501. #-----------------------------------------------------------------------------
  502. def window_width
  503. return Graphics.width / 4
  504. end
  505. #-----------------------------------------------------------------------------
  506. # Window Height
  507. #-----------------------------------------------------------------------------
  508. def window_height
  509. return @height
  510. end
  511. #-----------------------------------------------------------------------------
  512. # Create Command List
  513. #-----------------------------------------------------------------------------
  514. def make_command_list
  515. for c in $game_party.tp_list
  516. list = Teleport::List[c]
  517. bool = Teleport::Use_Hid_Nam
  518. inew = $game_party.new_tp_id[c]
  519. name = Teleport::Hidden_Name
  520. name = list[:name] unless (bool && inew)
  521. add_command(name,:location, cle?(c))
  522. end
  523. end
  524. #-----------------------------------------------------------------------------
  525. # Can Enable Command (meets gold requirement?)
  526. #-----------------------------------------------------------------------------
  527. def cle?(c)
  528. return false unless Teleport::List[c]
  529. return false unless $game_party.can_port
  530. return false unless $game_party.gold >= Teleport::List[c][:cost]
  531. return (!$game_party.tps_disabled[c])
  532. end
  533.  
  534. end
  535.  
  536. #===============================================================================
  537. class Window_TeleMap < Window_Selectable
  538. #===============================================================================
  539. #--------------------------------------------------------------------------
  540. # Object Initialization
  541. #--------------------------------------------------------------------------
  542. def initialize(x,y,w,h)
  543. super(x, y, w, h)
  544. refresh
  545. end
  546. #--------------------------------------------------------------------------
  547. # Refresh
  548. #--------------------------------------------------------------------------
  549. def refresh
  550. contents.clear
  551. end
  552. end
  553.  
  554. #===============================================================================
  555. class Window_TeleGold < Window_Base
  556. #===============================================================================
  557. #--------------------------------------------------------------------------
  558. # Object Initialization
  559. #--------------------------------------------------------------------------
  560. def initialize
  561. y = Graphics.height - fitting_height(1)
  562. super(0, y, Graphics.width/3, fitting_height(1))
  563. refresh
  564. end
  565. #--------------------------------------------------------------------------
  566. # Refresh
  567. #--------------------------------------------------------------------------
  568. def refresh
  569. contents.clear
  570. wid = self.width - (standard_padding*2)
  571. draw_de_icon(Teleport::General[:gold][0],-3,-3, 0, true)
  572. draw_text(22,0,wid,line_height, Teleport::General[:gold][1])
  573. draw_text(0 ,0,wid,line_height, $game_party.gold.to_i ,2)
  574. end
  575. #--------------------------------------------------------------------------
  576. # Open Window
  577. #--------------------------------------------------------------------------
  578. def open
  579. refresh
  580. super
  581. end
  582.  
  583. end
  584.  
  585. #===============================================================================
  586. class Window_TeleTime < Window_Base
  587. #===============================================================================
  588. #--------------------------------------------------------------------------
  589. # Object Initialization
  590. #--------------------------------------------------------------------------
  591. def initialize
  592. y = Graphics.height - fitting_height(1)
  593. super(Graphics.width/3, y, Graphics.width/3, fitting_height(1))
  594. refresh
  595. end
  596. #--------------------------------------------------------------------------
  597. # Refresh
  598. #--------------------------------------------------------------------------
  599. def refresh
  600. contents.clear
  601. t = Time.now
  602. wid = self.width - (standard_padding*2)
  603. text = "#{t.strftime("%H")}:#{t.strftime("%M")}:#{t.strftime("%S")}"
  604. draw_text(0,0,wid,line_height, text, 1)
  605. end
  606.  
  607. end
  608.  
  609. #===============================================================================
  610. class Window_TelePosi < Window_Base
  611. #===============================================================================
  612. #--------------------------------------------------------------------------
  613. # Object Initialization
  614. #--------------------------------------------------------------------------
  615. def initialize
  616. y = Graphics.height - fitting_height(1)
  617. super(Graphics.width/3*2, y, Graphics.width/3, fitting_height(1))
  618. refresh
  619. end
  620. #--------------------------------------------------------------------------
  621. # Refresh
  622. #--------------------------------------------------------------------------
  623. def refresh
  624. contents.clear
  625. wid = self.width - (standard_padding*2)
  626. text = "#{$game_temp.tele_search[0]-142}, #{$game_temp.tele_search[1]-78}"
  627. text = "0, 0" if $game_temp.tele_search == [0,0]
  628. draw_text(0,0,wid,line_height, Teleport::General[:co_ords])
  629. draw_text(0,0,wid,line_height, text, 2)
  630. end
  631.  
  632. end
  633.  
  634. #===============================================================================
  635. class Scene_Map < Scene_Base
  636. #===============================================================================
  637. #-----------------------------------------------------------------------------
  638. # Alias List
  639. #-----------------------------------------------------------------------------
  640. alias :updt_tp_map :update
  641. #-----------------------------------------------------------------------------
  642. # Update
  643. #-----------------------------------------------------------------------------
  644. def update
  645. updt_tp_map
  646. update_port_ani
  647. end
  648. #-----------------------------------------------------------------------------
  649. # Update Teleport Animation
  650. #-----------------------------------------------------------------------------
  651. def update_port_ani
  652. return unless $game_party.just_ported
  653. $game_player.perform_transfer
  654. $game_map.autoplay
  655. $game_player.transparent = false
  656. $game_player.animation_id = Teleport::End_Tele_Ani
  657. $game_player.followers.each do |char|
  658. next unless char.actor != nil
  659. char.transparent = false
  660. char.animation_id = Teleport::End_Tele_Ani
  661. end
  662. $game_party.just_ported = false
  663. end
  664.  
  665. end
  666.  
  667. #===============================================================================
  668. class Scene_Menu < Scene_MenuBase
  669. #===============================================================================
  670. #-----------------------------------------------------------------------------
  671. # Alias List
  672. #-----------------------------------------------------------------------------
  673. alias :teleport_create_command_window :create_command_window
  674. #-----------------------------------------------------------------------------
  675. # Create Command Window
  676. #-----------------------------------------------------------------------------
  677. def create_command_window
  678. teleport_create_command_window
  679. add_port_com if Teleport::Add_2_Menu[0]
  680. end
  681. #-----------------------------------------------------------------------------
  682. # Add Teleport command
  683. #-----------------------------------------------------------------------------
  684. def add_port_com
  685. @command_window.set_handler(:teleport, method(:call_teleport))
  686. end
  687. #-----------------------------------------------------------------------------
  688. # Call Teleport Scene
  689. #-----------------------------------------------------------------------------
  690. def call_teleport
  691. SceneManager.call(Scene_Teleport)
  692. end
  693.  
  694. end
  695.  
  696. #===============================================================================
  697. class Scene_Teleport < Scene_MenuBase
  698. #===============================================================================
  699. #-----------------------------------------------------------------------------
  700. # Start Processing
  701. #-----------------------------------------------------------------------------
  702. def start
  703. super
  704. create_help_window
  705. create_command_window
  706. create_gold_window
  707. create_time_window
  708. create_posi_window
  709. create_list_window
  710. create_map
  711. end
  712. #--------------------------------------------------------------------------
  713. # Create Halp Window
  714. #--------------------------------------------------------------------------
  715. def create_help_window
  716. @help_window = Deki_Help.new
  717. @help_window.viewport = @viewport
  718. @help_window.x = Graphics.width / 4
  719. end
  720. #-----------------------------------------------------------------------------
  721. # Create Command Window
  722. #-----------------------------------------------------------------------------
  723. def create_command_window
  724. @command_window = Window_TeleportCommand.new(0, 0)
  725. @command_window.viewport = @viewport
  726. @command_window.help_window = @help_window
  727. @command_window.set_handler(:teleport,method(:command_sel_dest))
  728. @command_window.set_handler(:search, method(:command_search))
  729. @command_window.set_handler(:exit, method(:return_scene))
  730. @command_window.set_handler(:confirm, method(:confirm_tele))
  731. @command_window.set_handler(:cancelC, method(:cancel_tele))
  732. end
  733. #-----------------------------------------------------------------------------
  734. # Create Gold Window
  735. #-----------------------------------------------------------------------------
  736. def create_gold_window
  737. @gold_window = Window_TeleGold.new
  738. end
  739. #-----------------------------------------------------------------------------
  740. # Create Time Window
  741. #-----------------------------------------------------------------------------
  742. def create_time_window
  743. @time_window = Window_TeleTime.new
  744. @time_ref_ = Time.now.sec
  745. end
  746. #-----------------------------------------------------------------------------
  747. # Create Position Window
  748. #-----------------------------------------------------------------------------
  749. def create_posi_window
  750. @pos_window = Window_TelePosi.new
  751. end
  752. #-----------------------------------------------------------------------------
  753. # Create List Window
  754. #-----------------------------------------------------------------------------
  755. def create_list_window
  756. y = @command_window.height
  757. h = Graphics.height - y - @gold_window.height
  758. @list_window = Window_TeleportList.new(0,y,h)
  759. @list_window.viewport = @viewport
  760. @list_window.help_window = @help_window
  761. @list_window.set_handler(:location, method(:command_travel))
  762. @list_window.set_handler(:cancel, method(:back_to_coommand))
  763. end
  764. #-----------------------------------------------------------------------------
  765. # Create Map Window
  766. #-----------------------------------------------------------------------------
  767. def create_map
  768. x = @command_window.width
  769. y = @help_window.height
  770. w = Graphics.width - x
  771. h = Graphics.height - y - @gold_window.height
  772. @map_wind = Window_TeleMap.new(x,y,w,h)
  773. make_map_img(x,y,w,h)
  774. make_sel_img
  775. end
  776. #-----------------------------------------------------------------------------
  777. # Create Map Image
  778. #-----------------------------------------------------------------------------
  779. def make_map_img(x,y,w,h)
  780. p "#{x},#{y}"
  781. @map_view = Viewport.new(x+6,y+6,w-12,h-12)
  782. @map_view.z = 201
  783. @map_img = Plane.new
  784. @map_img.viewport = @map_view
  785. image = Teleport::List[$game_party.tp_list[0]][:img_][0]
  786. @map_img.bitmap = Cache.system(image)
  787. @map_img.opacity = Teleport::Opacity
  788. @map_image_data = image
  789. end
  790. #-----------------------------------------------------------------------------
  791. # Create Map Selector Image
  792. #-----------------------------------------------------------------------------
  793. def make_sel_img
  794. @map_sel = Sprite.new
  795. @map_sel.bitmap = Cache.system(Teleport::Sel_Image)
  796. wid = (@map_view.rect.width/2)-(@map_sel.bitmap.width/2)
  797. hei = (@map_view.rect.height/2)-(@map_sel.bitmap.height/2)
  798. @map_sel.ox = (@map_sel.bitmap.width/2)+6
  799. @map_sel.oy = (@map_sel.bitmap.height/2)+6
  800. @map_sel.opacity = Teleport::Opacity
  801. @map_sel.z = 201
  802. @map_sel.x = Teleport::List[$game_party.tp_list[0]][:img_][1]+(@map_view.rect.x)
  803. @map_sel.y = Teleport::List[$game_party.tp_list[0]][:img_][2]+(@map_view.rect.y)
  804. $game_temp.tele_search = [@map_sel.x,@map_sel.y]
  805. end
  806. #--------------------------------------------------------------------------
  807. # Termination Processing
  808. #--------------------------------------------------------------------------
  809. def terminate
  810. super
  811. @map_img.bitmap.dispose
  812. @map_img.dispose
  813. @map_sel.bitmap.dispose
  814. @map_sel.dispose
  815. @map_view.dispose
  816. $game_temp.tele_search = [0,0]
  817. end
  818. #-----------------------------------------------------------------------------
  819. # Command Select Destination
  820. #-----------------------------------------------------------------------------
  821. def command_sel_dest
  822. @command_window.deactivate
  823. @command_window.select(-1)
  824. @list_window.activate
  825. @list_window.select(0)
  826. end
  827. #-----------------------------------------------------------------------------
  828. # Command Search
  829. #-----------------------------------------------------------------------------
  830. def command_search
  831. @command_window.deactivate
  832. @command_window.select(-1)
  833. @map_wind.activate
  834. end
  835. #-----------------------------------------------------------------------------
  836. # Command Travel
  837. #-----------------------------------------------------------------------------
  838. def command_travel
  839. info = Teleport::List[$game_party.tp_list[@list_window.index]]
  840. return @list_window.activate unless info != nil
  841. return check_price(info)
  842. end
  843. #-----------------------------------------------------------------------------
  844. # Check Price
  845. #-----------------------------------------------------------------------------
  846. def check_price(info)
  847. cost = info[:cost]
  848. gold = $game_party.gold.to_i
  849. if gold >= cost
  850. confirm_price
  851. else
  852. @help_window.set_text('Not Enough Gold')
  853. 60.times { Graphics.update }
  854. @list_window.activate
  855. end
  856. end
  857. #-----------------------------------------------------------------------------
  858. # Confirm Price
  859. #-----------------------------------------------------------------------------
  860. def confirm_price
  861. @list_window.deactivate
  862. @command_window.type = :confirm
  863. @command_window.select(0)
  864. @command_window.activate
  865. end
  866. #-----------------------------------------------------------------------------
  867. # Confirm Teleport
  868. #-----------------------------------------------------------------------------
  869. def confirm_tele
  870. info = $game_party.tp_list[@list_window.index]
  871. perform_travel(info, true)
  872. end
  873. #-----------------------------------------------------------------------------
  874. # Cancel Teleport
  875. #-----------------------------------------------------------------------------
  876. def cancel_tele
  877. @command_window.type = :normal
  878. @command_window.select(-1)
  879. @command_window.deactivate
  880. @list_window.activate
  881. end
  882. #-----------------------------------------------------------------------------
  883. # Perform Travel
  884. #-----------------------------------------------------------------------------
  885. def perform_travel(info, bool)
  886. SceneManager.return
  887. $game_party.auto_port(info, bool)
  888. end
  889. #-----------------------------------------------------------------------------
  890. # Back To Command Window
  891. #-----------------------------------------------------------------------------
  892. def back_to_coommand
  893. @list_window.select(-1)
  894. @list_window.deactivate
  895. @command_window.select(0)
  896. @command_window.activate
  897. @map_wind.deactivate
  898. end
  899. #-----------------------------------------------------------------------------
  900. # Update
  901. #-----------------------------------------------------------------------------
  902. def update
  903. super
  904. updae_map_image
  905. update_cancel
  906. update_help
  907. update_time
  908. update_map
  909. update_map_II
  910. update_find
  911. end
  912. #-----------------------------------------------------------------------------
  913. # Update Map Image
  914. #-----------------------------------------------------------------------------
  915. def updae_map_image
  916. data = Teleport::List[$game_party.tp_list[@list_window.index]][:img_][0]
  917. return unless @map_image_data != data
  918. @map_img.bitmap.dispose
  919. @map_img.bitmap = Cache.system(data)
  920. @map_img.opacity = Teleport::Opacity
  921. @map_image_data = data
  922. end
  923. #-----------------------------------------------------------------------------
  924. # Update Cancel Key(s)
  925. #-----------------------------------------------------------------------------
  926. def update_cancel
  927. return unless @command_window.active
  928. return unless Input.trigger?(:B)
  929. return_scene if @command_window.type == :normal
  930. cancel_tele if @command_window.type == :confirm
  931. end
  932. #-----------------------------------------------------------------------------
  933. # Update Help
  934. #-----------------------------------------------------------------------------
  935. def update_help
  936. for data in Teleport::Commands
  937. if @command_window.current_symbol == data[0]
  938. @help_window.set_text(data[2])
  939. end
  940. end
  941. bool = Teleport::Use_Hid_Nam
  942. list = $game_party.tp_list[@list_window.index]
  943. info = Teleport::List[list]
  944. inew = $game_party.new_tp_id[list]
  945. case @command_window.current_symbol
  946. when :confirm
  947. name = Teleport::Hidden_Name
  948. name = info[:name] unless (bool && inew)
  949. text = sprintf(Teleport::General[:confirm], name, info[:cost])
  950. @help_window.set_text(text)
  951. when :cancelC
  952. info = Teleport::List[$game_party.tp_list[@list_window.index]]
  953. text = sprintf(Teleport::General[:cancel], info[:name])
  954. @help_window.set_text(text)
  955. end
  956. if @list_window.active
  957. name = Teleport::Hidden_Name
  958. name = info[:info] unless (bool && inew)
  959. @help_window.set_text(name)
  960. end
  961. end
  962. #-----------------------------------------------------------------------------
  963. # Update Time
  964. #-----------------------------------------------------------------------------
  965. def update_time
  966. return unless @time_ref_ != Time.now.sec
  967. @time_window.refresh
  968. end
  969. #-----------------------------------------------------------------------------
  970. # Update Map
  971. #-----------------------------------------------------------------------------
  972. def update_map
  973. return unless @list_window.active
  974. info = Teleport::List[$game_party.tp_list[@list_window.index]]
  975. @map_view.update
  976. case Teleport::Sel_Type
  977. when :scroll
  978. @map_sel.x += 1 if @map_sel.x < (info[:img_][1]+(@map_view.rect.x))
  979. @map_sel.x -= 1 if @map_sel.x > (info[:img_][1]+(@map_view.rect.x))
  980. @map_sel.y += 1 if @map_sel.y < (info[:img_][2]+(@map_view.rect.y))
  981. @map_sel.y -= 1 if @map_sel.y > (info[:img_][2]+(@map_view.rect.y))
  982. when :select
  983. @map_sel.x = (info[:img_][1]+(@map_view.rect.x))
  984. @map_sel.y = (info[:img_][2]+(@map_view.rect.y))
  985. end
  986. if $game_temp.tele_search != [@map_sel.x,@map_sel.y]
  987. $game_temp.tele_search = [@map_sel.x,@map_sel.y]
  988. @pos_window.refresh
  989. end
  990. end
  991. #-----------------------------------------------------------------------------
  992. # Update Map (search)
  993. #-----------------------------------------------------------------------------
  994. def update_map_II
  995. return unless @map_wind.active
  996. val = Input.press?(:SHIFT) ? 2 : 1
  997. @map_sel.y -= val if Input.press?(:UP)
  998. @map_sel.y += val if Input.press?(:DOWN)
  999. @map_sel.x -= val if Input.press?(:LEFT)
  1000. @map_sel.x += val if Input.press?(:RIGHT)
  1001. back_to_coommand if Input.press?(:B)
  1002. @map_sel.x = @map_view.rect.x+12 if @map_sel.x <= (@map_view.rect.x+12)
  1003. if @map_sel.x >= (@map_view.rect.x+@map_view.rect.width)
  1004. @map_sel.x = (@map_view.rect.x+@map_view.rect.width)
  1005. end
  1006. @map_sel.y = @map_view.rect.y+12 if @map_sel.y <= (@map_view.rect.y+12)
  1007. if @map_sel.y >= (@map_view.rect.y+@map_view.rect.height)
  1008. @map_sel.y = (@map_view.rect.y+@map_view.rect.height)
  1009. end
  1010. if $game_temp.tele_search != [@map_sel.x,@map_sel.y]
  1011. $game_temp.tele_search = [@map_sel.x,@map_sel.y]
  1012. @pos_window.refresh
  1013. end
  1014. end
  1015. #-----------------------------------------------------------------------------
  1016. # Update Find
  1017. #-----------------------------------------------------------------------------
  1018. def update_find
  1019. return unless @map_wind.active
  1020. if Input.trigger?(:C)
  1021. Teleport::Hidden_List.each do |data|
  1022. next unless data != nil
  1023. info = Teleport::List[data]
  1024. if info[:img_][1] == ($game_temp.tele_search[0]-(@map_view.rect.x)) &&
  1025. info[:img_][2] == ($game_temp.tele_search[1]-(@map_view.rect.y))
  1026. if !$game_party.tp_list.include?(data)
  1027. text = sprintf("Found Hidden Location")
  1028. @help_window.set_text(text)
  1029. $game_party.find_new_teleport(data)
  1030. @list_window.refresh
  1031. return 60.times { Graphics.update }
  1032. end
  1033. end
  1034. end
  1035. end
  1036. Teleport::Commands.each do |com|
  1037. next unless com[0] == :search
  1038. @help_window.set_text(com[2])
  1039. end
  1040. end
  1041. #-----------------------------------------------------------------------------
  1042. # Create Backgrounds
  1043. #-----------------------------------------------------------------------------
  1044. def get_all_bgs
  1045. return unless $D13x[:Scene_BGs]
  1046. @bg_set = Teleport::BGs
  1047. end
  1048.  
  1049. end
  1050.  
  1051. #==============================================================================#
  1052. # http://dekitarpg.wordpress.com/ #
  1053. #==============================================================================#
  1054. end # if true # << Make true to use this script, false to disable.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement