设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4553|回复: 1
打印 上一主题 下一主题

[已经解决] 关于VA交通工具扩展的脚本问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
88
在线时间
1906 小时
注册时间
2012-10-5
帖子
1991

开拓者

跳转到指定楼层
1
发表于 2012-10-24 21:43:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
12星屑
本帖最后由 Mic_洛洛 于 2012-11-7 00:20 编辑

请问有VA交通工具扩张设定脚本和交通工具能力值设定脚本吗?
没汉化无所畏.急求!!!

最佳答案

查看完整内容

定制交通工具

Lv2.观梦者

梦石
0
星屑
723
在线时间
530 小时
注册时间
2010-6-9
帖子
840
2
发表于 2012-10-24 21:43:50 | 只看该作者
定制交通工具
  1. #==============================================================================
  2. # ** Victor Engine - Custom Vehicles
  3. #------------------------------------------------------------------------------
  4. # Author : Victor Sant
  5. #
  6. # Version History:
  7. #  v 1.00 - 2011.12.30 > First relase
  8. #  v 1.01 - 2011.12.30 > Battleback2 fix
  9. #  v 1.02 - 2012.01.08 > Added move and idle sound while riding
  10. #  v 1.03 - 2012.01.15 > Fixed the Regular Expressions problem with "" and “”
  11. #------------------------------------------------------------------------------
  12. #  This scripts allow the creation of new vehicle types with a new set of
  13. # options available
  14. #------------------------------------------------------------------------------
  15. # Compatibility
  16. #   Requires the script 'Victor Engine - Basic Module' v 1.09 or higher
  17. #
  18. # * Overwrite methods (Default)
  19. #   class Game_Map
  20. #     def vehicle(type)
  21. #
  22. #   class Game_Player < Game_Character
  23. #     def get_on_vehicle
  24. #     def get_off_vehicle
  25. #     def in_airship?
  26. #
  27. # * Alias methods (Default)
  28. #   class Game_Map
  29. #     def create_vehicles
  30. #   
  31. #   class Game_CharacterBase
  32. #     def collide_with_vehicles?(x, y)
  33. #
  34. #   class Game_Player < Game_Character
  35. #     def update_vehicle_get_off
  36. #     def collide_with_characters?(x, y)
  37. #     def encounter_progress_value
  38. #     def map_passable?(x, y, d)
  39. #
  40. #   class Game_Vehicle < Game_Character
  41. #     def land_ok?(x, y, d)
  42. #
  43. #   class Spriteset_Battle
  44. #     def overworld_battleback1_name
  45. #     def overworld_battleback2_name
  46. #
  47. #   class Spriteset_Map
  48. #     def update_shadow
  49. #
  50. # * Alias methods (Basic Module)
  51. #   class Game_Interpreter
  52. #     def comment_call
  53. #
  54. #------------------------------------------------------------------------------
  55. # Instructions:
  56. #  To instal the script, open you script editor and paste this script on
  57. #  a new section on bellow the Materials section. This script must also
  58. #  be bellow the script 'Victor Engine - Basic'
  59. #
  60. #------------------------------------------------------------------------------
  61. # Comment calls note tags:
  62. #  Tags to be used in events comment box, works like a script call.
  63. #
  64. #  <move vehicle type: id, x, y>
  65. #   This tag allows to move the vehicle to a specif postion in a map.
  66. #     type : vehicle type
  67. #     id   : map ID
  68. #     x    : coodinate X
  69. #     y    : coodinate Y
  70. #
  71. #------------------------------------------------------------------------------
  72. # Script settings:
  73. #  The settings works very like the note tags, except they're set on the
  74. #  script, just add the tags between " ". Any setting here can be
  75. #  omitted.
  76. #
  77. #  <character name: x>
  78. #    Vehicle character graphic filename. Althogh it can be omitted, by doing so
  79. #    the vehicle will have no graphic.
  80. #      x : character filename
  81. #  
  82. #  <character index: x>
  83. #    Vehicle character index. Needed when using 8 characters charsets to set
  84. #    wich graphic use. Not needed for single charsets (with $ in the name)
  85. #      x : index (0-7)
  86. #
  87. #  <step animation>
  88. #   This tag makes the vehicle display the "walking" animation even when
  89. #   not moving while riding.
  90. #
  91. #  <character above>
  92. #   With this tag the chacter needs to step above the vehicle to ride it.
  93. #   Without it, you can't step above it, and must face it to ride.
  94. #
  95. #  <altitude x>
  96. #   This tag will make the vehicle fly while diring the drive.
  97. #     x : flight height
  98. #
  99. #  <passability: x>
  100. #    Makes the vehicle inherit the passability settings of the player, boat,
  101. #    ship or airship. if not set, the vehicle will have NO passability
  102. #    beside the terrain and region passability. This only the basic setting
  103. #    and can be changed with the terrains and regison.
  104. #      x : type (player, boat, ship, airship)
  105. #
  106. #  <pass terrain: x>
  107. #  <pass terrain: x, x>
  108. #   Set the terrain IDs that is passable when boarding the vehicle. Any tile
  109. #   with this terrain ID is passable unless blocked by anoterh setting.
  110. #     x : terrain ID (0-7)
  111. #
  112. #  <pass region: x>
  113. #  <pass region: x, x>
  114. #   Set the region IDs that is passable when boarding the vehicle. Any tile
  115. #   with this region ID is passable unless blocked by anoterh setting.
  116. #     x : region ID (1-64)
  117. #
  118. #  <land terrain: x>
  119. #  <land terrain: x, x>
  120. #   Set the terrain IDs that is landable when boarding the vehicle. You can
  121. #   only land o valid tiles.
  122. #     x : terrain ID (0-7)
  123. #
  124. #  <land region: x>
  125. #  <land region: x, x>
  126. #   Set the region IDs that is passable when boarding the vehicle. You can
  127. #   only land o valid tiles.
  128. #     x : region ID (1-64)
  129. #
  130. #  <block terrain: x>
  131. #  <block terrain: x, x>
  132. #   Set the terrain IDs that is blocked when boarding the vehicle, this
  133. #   setting have priority over passablity and landing.
  134. #     x : terrain ID (0-7)
  135. #
  136. #  <block region: x>
  137. #  <block region: x, x>
  138. #   Set the region IDs that is blocked when boarding the vehicle, this
  139. #   setting have priority over passablity and landing.
  140. #     x : region ID (1-64)
  141. #
  142. #  <speed: x>
  143. #   Character movement speed when driving the vehicle
  144. #     x : speed (1-6)
  145. #
  146. #  <init map: x>
  147. #   Inital map where the vehicle will be at the start of a new game.
  148. #   You must also set the <init pos: x, y> .
  149. #     x : map ID
  150. #
  151. #  <init pos: x, y>
  152. #   Inital map coodinate X and Y where the vehicle will be at the start of
  153. #   a new game. You must also set the <init map: x> .
  154. #     x : map coodinate X
  155. #     y : map coodinate Y
  156. #
  157. #  <music: 'name', x, y>
  158. #   Set the music played when riding the vehicle.
  159. #     name : BGM filename. ('filename')
  160. #
  161. #  <battleback 1: x>
  162. #   Set a specicf floor battleback when riding the vehicle
  163. #     x : battleback filename
  164. #
  165. #  <battleback 2: x>
  166. #   Set a specicf backgroun battleback when riding the vehicle
  167. #     x : battleback filename
  168. #
  169. #  <encounter rate: x%>
  170. #   Change the encounter rate when riding the vehicle in a % value.
  171. #   100% normal encounter rate, 0% no encounter.
  172. #     x : encounter rate modifier
  173. #
  174. #  <idle sound: x, y, z, w>
  175. #   Plays the sound effect continuously while ilde on vehicle.
  176. #     x : sound effect filename ("filename")
  177. #     v : sound effect volume (0-100, default = 100)
  178. #     p : sound effect pitch (50-150, default = 100)
  179. #     w : sound replay wait (numeric, the higher, the slower)
  180. #
  181. #  <move sound: x, y, z, w>
  182. #   Plays the sound effect continuously while moving on vehicle.
  183. #     x : sound effect filename ("filename")
  184. #     y : sound effect volume (0-100, default = 100)
  185. #     z : sound effect pitch (50-150, default = 100)
  186. #     w : sound replay wait (numeric, the higher, the slower)
  187. #
  188. #------------------------------------------------------------------------------
  189. # Additional instructions:
  190. #
  191. #  The names boat, ship, airship and walk are reserved for the default
  192. #  setting and can't be set as a vehicle type name.
  193. #
  194. #==============================================================================

  195. #==============================================================================
  196. # ** Victor Engine
  197. #------------------------------------------------------------------------------
  198. #   Setting module for the Victor Engine
  199. #==============================================================================

  200. module Victor_Engine
  201.   #--------------------------------------------------------------------------
  202.   # * VEHICLE SETTINGS
  203.   #   You can add here the settings for the custom vehicles following this
  204.   #   pattern:
  205.   #     name: "<setting> <setting>",
  206.   #      Don't forget the dots after name (name:) and the coma (,) in the end.
  207.   #--------------------------------------------------------------------------
  208.   VE_VEHICLE_SETTING = {
  209.     # The horse is a fast mount, while on it the chance of encounter is lowered
  210.     # but it doesn't enter into forests.
  211.     horse: "<speed: 5> <init map: 70> <init pos: 16, 9>
  212.             <character name: Animal> <character index: 5>
  213.             <music: 'Scene4', 100, 100> <passability: player>
  214.             <block region: 1> <encounter rate: 25>",
  215.             

  216.             
  217.     # The ballon can only land in forests and can't fly above deserts and
  218.     # tundras. The battleback is changed
  219.     ballon: "<speed: 5> <init map: 1> <init pos: 56, 108>
  220.              <character name: Vehicle> <character index: 2>
  221.              <music: 'Scene4', 100, 100> <altitude: 24>
  222.              <land region: 1> <pass terrain: 0>
  223.              <block region: 2, 3> <encounter rate: 50>
  224.              <battleback 1: Clouds> <battleback 2: Clouds>
  225.              <idle sound: 'Evasion1', 50, 100>
  226.              <move sound: 'Evasion1', 50, 100>",
  227.    
  228.   } # Don't remove

  229. end

  230. $imported[:ve_custom_vehicles] = true

  231. #==============================================================================
  232. # ** Game_Map
  233. #------------------------------------------------------------------------------
  234. #  This class handles maps. It includes scrolling and passage determination
  235. # functions. The instance of this class is referenced by $game_map.
  236. #==============================================================================

  237. class Game_Map
  238.   #--------------------------------------------------------------------------
  239.   # * Overwrite method: vehicle
  240.   #--------------------------------------------------------------------------
  241.   def vehicle(type)
  242.     @vehicles.each {|vehicle| return vehicle if vehicle.type == type }
  243.     return nil
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # * Alias method: create_vehicles
  247.   #--------------------------------------------------------------------------
  248.   alias :create_vehicles_ve_custom_vehicles :create_vehicles
  249.   def create_vehicles
  250.     create_vehicles_ve_custom_vehicles
  251.     VE_VEHICLE_SETTING.keys.each do |type|
  252.       next if [:boat, :ship, :airship, :walk].include?(type)
  253.       @vehicles.push(Game_Custom_Vehicle.new(type))
  254.     end
  255.   end
  256.   #--------------------------------------------------------------------------
  257.   # * New method: land_vehicles
  258.   #--------------------------------------------------------------------------
  259.   def land_vehicles
  260.     @vehicles.select {|vehicle| !vehicle.above? }.collect {|vehicle| vehicle }
  261.   end
  262. end

  263. #==============================================================================
  264. # ** Game_CharacterBase
  265. #------------------------------------------------------------------------------
  266. #  This class deals with characters. Common to all characters, stores basic
  267. # data, such as coordinates and graphics. It's used as a superclass of the
  268. # Game_Character class.
  269. #==============================================================================

  270. class Game_CharacterBase
  271.   #--------------------------------------------------------------------------
  272.   # * Alias method: collide_with_vehicles?
  273.   #--------------------------------------------------------------------------
  274.   alias :collide_with_vehicles_ve_custom_vehicles? :collide_with_vehicles?
  275.   def collide_with_vehicles?(x, y)
  276.     collision = collide_with_vehicles_ve_custom_vehicles?(x, y)
  277.     $game_map.land_vehicles.each do |obj|
  278.       collision |= obj.pos_nt?(x, y) unless obj == self
  279.     end
  280.     collision
  281.   end
  282.   #--------------------------------------------------------------------------
  283.   # * New method: above_vehicles?
  284.   #--------------------------------------------------------------------------
  285.   def above_vehicles?(x, y, vehicle)
  286.     collision = false
  287.     $game_map.vehicles.each do |obj|
  288.       collision |= obj.pos_nt?(x, y) if vehicle != obj
  289.     end
  290.     collision
  291.   end
  292. end

  293. #==============================================================================
  294. # ** Game_Player
  295. #------------------------------------------------------------------------------
  296. #  This class handles the player.
  297. # The instance of this class is referenced by $game_map.
  298. #==============================================================================

  299. class Game_Player < Game_Character
  300.   #--------------------------------------------------------------------------
  301.   # * Public Instance Variables
  302.   #--------------------------------------------------------------------------
  303.   attr_reader   :stop_count
  304.   attr_reader   :vehicle_type
  305.   #--------------------------------------------------------------------------
  306.   # * Overwrite method: get_on_vehicle
  307.   #--------------------------------------------------------------------------
  308.   def get_on_vehicle
  309.     front_x = $game_map.round_x_with_direction(@x, @direction)
  310.     front_y = $game_map.round_y_with_direction(@y, @direction)
  311.     $game_map.vehicles.each do |info|
  312.       type = info.type
  313.       @vehicle_type = type if !info.above? && info.pos?(front_x, front_y)
  314.       @vehicle_type = type if info.above? && info.pos?(@x, @y)
  315.       break if vehicle
  316.     end
  317.     if vehicle
  318.       @vehicle_getting_on = true
  319.       force_move_forward unless in_airship?
  320.       @followers.gather
  321.     end
  322.     @vehicle_getting_on
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # * Overwrite method: get_off_vehicle
  326.   #--------------------------------------------------------------------------
  327.   def get_off_vehicle
  328.     if vehicle.land_ok?(@x, @y, @direction)
  329.       set_direction(2) if in_airship?
  330.       @followers.synchronize(@x, @y, @direction)
  331.       vehicle.get_off
  332.       @getting_off = !in_airship?
  333.       @vehicle_getting_off = true
  334.       @move_speed = 4
  335.       @through = false
  336.       make_encounter_count
  337.     end
  338.     @vehicle_getting_off
  339.   end  
  340.   #--------------------------------------------------------------------------
  341.   # * Overwrite method: in_airship?
  342.   #--------------------------------------------------------------------------
  343.   def in_airship?
  344.     vehicle && vehicle.above?
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # * Alias method: update_vehicle_get_off
  348.   #--------------------------------------------------------------------------
  349.   alias :update_vehicle_get_off_ve_custom_vehicles :update_vehicle_get_off
  350.   def update_vehicle_get_off
  351.     if vehicle.altitude == 0 and @getting_off
  352.       force_move_forward
  353.       @transparent = false
  354.       @followers.gather
  355.       @getting_off = false
  356.     end
  357.     update_vehicle_get_off_ve_custom_vehicles
  358.   end
  359.   #--------------------------------------------------------------------------
  360.   # * Alias method: collide_with_characters?
  361.   #--------------------------------------------------------------------------
  362.   alias :collide_with_characters_ve_custom_vehicles? :collide_with_characters?
  363.   def collide_with_characters?(x, y)
  364.     return false if vehicle && vehicle.is_custom? && !vehicle.pass_type
  365.     collide_with_characters_ve_custom_vehicles?(x, y)
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # * Alias method: encounter_progress_value
  369.   #--------------------------------------------------------------------------
  370.   alias :encounter_progress_value_ve_custom_vehicles :encounter_progress_value
  371.   def encounter_progress_value
  372.     value = encounter_progress_value_ve_custom_vehicles
  373.     value *= vehicle.encounter_rate if vehicle && vehicle.is_custom?
  374.     value
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # * Alias method: map_passable?
  378.   #--------------------------------------------------------------------------
  379.   alias :map_passable_ve_custom_vehicles? :map_passable?
  380.   def map_passable?(x, y, d)
  381.     if vehicle && vehicle.is_custom?
  382.       passable_vehicles?(x, y, d)
  383.     else
  384.       map_passable_ve_custom_vehicles?(x, y, d)
  385.     end
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # * New method: passable_vehicles?
  389.   #--------------------------------------------------------------------------
  390.   def passable_vehicles?(x, y, d)
  391.     case vehicle.pass_type
  392.     when :player
  393.       map_passable_ve_custom_vehicles?(x, y, d) && pass_terrain?(x, y, d)
  394.     when :boat
  395.       $game_map.boat_passable?(x, y) && pass_terrain?(x, y, d)
  396.     when :ship
  397.       $game_map.ship_passable?(x, y)
  398.     else
  399.       pass_terrain?(x, y, d)
  400.     end
  401.   end
  402.   #--------------------------------------------------------------------------
  403.   # * New method: pass_terrain?
  404.   #--------------------------------------------------------------------------
  405.   def pass_terrain?(x, y, d)
  406.     x2 = $game_map.round_x_with_direction(x, d)
  407.     y2 = $game_map.round_y_with_direction(y, d)
  408.     valid     = $game_map.valid?(x2, y2)
  409.     passable  = vehicle.pass_terrain?(x2, y2)
  410.     collision = vehicle.vehicle_collision?(x2, y2)
  411.     block     = vehicle.block_terrain?(x2, y2)
  412.     valid && passable && !collision && !block
  413.   end
  414. end

  415. #==============================================================================
  416. # ** Game_Vehicle
  417. #------------------------------------------------------------------------------
  418. #  This class handles vehicles. It's used within the Game_Map class. If there
  419. # are no vehicles on the current map, the coordinates is set to (-1,-1).
  420. #==============================================================================

  421. class Game_Vehicle < Game_Character
  422.   #--------------------------------------------------------------------------
  423.   # * Alias method: land_ok?
  424.   #--------------------------------------------------------------------------
  425.   alias :land_ok_ve_custom_vehicles? :land_ok?
  426.   def land_ok?(x, y, d)
  427.     return false if above_vehicles?(x, y, self)
  428.     return land_ok_ve_custom_vehicles?(x, y, d)
  429.   end
  430.   #--------------------------------------------------------------------------
  431.   # * New method: type
  432.   #--------------------------------------------------------------------------
  433.   def type
  434.     @type
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # * New method: aerial?
  438.   #--------------------------------------------------------------------------
  439.   def aerial?
  440.     type == :airship
  441.   end
  442.   #--------------------------------------------------------------------------
  443.   # * New method: above?
  444.   #--------------------------------------------------------------------------
  445.   def above?
  446.     aerial?
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # * New method: is_custom?
  450.   #--------------------------------------------------------------------------
  451.   def is_custom?
  452.     return false
  453.   end
  454. end

  455. #==============================================================================
  456. # ** Game_Interpreter
  457. #------------------------------------------------------------------------------
  458. #  An interpreter for executing event commands. This class is used within the
  459. # Game_Map, Game_Troop, and Game_Event classes.
  460. #==============================================================================

  461. class Game_Interpreter
  462.   #--------------------------------------------------------------------------
  463.   # * Alias method: comment_call
  464.   #--------------------------------------------------------------------------
  465.   alias :comment_call_ve_custom_vehicles :comment_call
  466.   def comment_call
  467.     comment_call_ve_custom_vehicles
  468.     call_change_vehicle_position
  469.   end  
  470.   #--------------------------------------------------------------------------
  471.   # * New method: call_change_vehicle_position
  472.   #--------------------------------------------------------------------------
  473.   def call_change_vehicle_position
  474.     regexp = /<MOVE VEHICLE (\w+): (\d+) *, *(\d+) *, *(\d+)>/i
  475.     note.scan(regexp) do |type, id, x, y|
  476.       symbol = eval(":#{type}")
  477.       $game_map.vehicle(symbol).set_location(id.to_i, x.to_i, y.to_i)
  478.     end
  479.   end
  480.   
  481.   def value_test
  482.     @value_test ||= 0
  483.   end

  484.   def value_test=(x)
  485.     @value_test = x
  486.   end
  487. end

  488. #==============================================================================
  489. # ** Spriteset_Battle
  490. #------------------------------------------------------------------------------
  491. #  This class brings together battle screen sprites. It's used within the
  492. # Scene_Battle class.
  493. #==============================================================================

  494. class Spriteset_Battle
  495.   #--------------------------------------------------------------------------
  496.   # * Alias method: overworld_battleback1_name
  497.   #--------------------------------------------------------------------------
  498.   alias :overworld_battleback1_ve_custom_vehicles :overworld_battleback1_name
  499.   def overworld_battleback1_name
  500.     battleback1 = overworld_battleback1_ve_custom_vehicles
  501.     vehicle_battleback1 ? vehicle_battleback1 : battleback1
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # * Alias method: overworld_battleback2_name
  505.   #--------------------------------------------------------------------------
  506.   alias :overworld_battleback2_ve_custom_vehicles :overworld_battleback2_name
  507.   def overworld_battleback2_name
  508.     battleback2 = overworld_battleback2_ve_custom_vehicles
  509.     vehicle_battleback2 ? vehicle_battleback2 : battleback2
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # * New method: vehicle_battleback1
  513.   #--------------------------------------------------------------------------
  514.   def vehicle_battleback1
  515.     return nil unless $game_player.vehicle && $game_player.vehicle.is_custom?
  516.     $game_player.vehicle.vehicle_battleback1_name
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # * New method: vehicle_battleback2
  520.   #--------------------------------------------------------------------------
  521.   def vehicle_battleback2
  522.     return nil unless $game_player.vehicle && $game_player.vehicle.is_custom?
  523.     $game_player.vehicle.vehicle_battleback2_name
  524.   end
  525. end

  526. #==============================================================================
  527. # ** Spriteset_Map
  528. #------------------------------------------------------------------------------
  529. #  This class brings together map screen sprites, tilemaps, etc. It's used
  530. # within the Scene_Map class.
  531. #==============================================================================

  532. class Spriteset_Map
  533.   #--------------------------------------------------------------------------
  534.   # * Alias method: update_shadow
  535.   #--------------------------------------------------------------------------
  536.   alias :update_shadow_ve_custom_vehicles :update_shadow
  537.   def update_shadow
  538.     if $game_player.vehicle && $game_player.vehicle.aerial?
  539.       airship = $game_player.vehicle
  540.       @shadow_sprite.x = airship.screen_x
  541.       @shadow_sprite.y = airship.screen_y + airship.altitude
  542.       @shadow_sprite.opacity = airship.altitude * 8
  543.       @shadow_sprite.update
  544.     else
  545.       update_shadow_ve_custom_vehicles
  546.     end
  547.   end
  548. end

  549. #==============================================================================
  550. # ** Game_Custom_Vehicle
  551. #------------------------------------------------------------------------------
  552. #  This class handles custom vehicles. It's used within the Game_Map class.
  553. # If there are no vehicles on the current map, the coordinates is set to
  554. # (-1,-1).
  555. #==============================================================================

  556. class Game_Custom_Vehicle < Game_Vehicle
  557.   #--------------------------------------------------------------------------
  558.   # * initialize
  559.   #--------------------------------------------------------------------------
  560.   def initialize(type)
  561.     @note = VE_VEHICLE_SETTING[type].dup
  562.     super(type)
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # * note
  566.   #--------------------------------------------------------------------------
  567.   def note
  568.     @note
  569.   end
  570.   #--------------------------------------------------------------------------
  571.   # * is_custom?
  572.   #--------------------------------------------------------------------------
  573.   def is_custom?
  574.     return true
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # * update
  578.   #--------------------------------------------------------------------------
  579.   def update
  580.     super
  581.     @stop_count = $game_player.stop_count if $game_player.vehicle_type == type
  582.     update_airship_altitude if max_altitude > 0
  583.     update_move_sound
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # * update_move
  587.   #--------------------------------------------------------------------------
  588.   def update_move
  589.     super
  590.     update_move_sound
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # * update_stop
  594.   #--------------------------------------------------------------------------
  595.   def update_stop
  596.     update_stop_ve_step_sound
  597.     update_idle_sound if @stop_count > 1 || @locked
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   # * update_move_sound
  601.   #--------------------------------------------------------------------------
  602.   def update_move_sound
  603.     return unless @move_sound && @driving && $game_player.moving?
  604.     @idle_sound_update = 0
  605.     @move_sound_update ||= 0
  606.     @move_sound[:sound].play if @move_sound_update == 0
  607.     @move_sound_update += 5
  608.     @move_sound_update = 0 if @move_sound_update > [@move_sound[:wait], 60].max
  609.   end
  610.   #--------------------------------------------------------------------------
  611.   # * update_idle_sound
  612.   #--------------------------------------------------------------------------
  613.   def update_idle_sound
  614.     return unless @idle_sound && @driving && !$game_player.moving?
  615.     @move_sound_update = 0
  616.     @idle_sound_update ||= 0
  617.     @idle_sound[:sound].play if @idle_sound_update == 0
  618.     @idle_sound_update += 10
  619.     @idle_sound_update = 0 if @idle_sound_update > [@idle_sound[:wait], 60].max
  620.   end
  621.   #--------------------------------------------------------------------------
  622.   # * init_move_speed
  623.   #--------------------------------------------------------------------------
  624.   def init_move_speed
  625.     @move_speed = note =~ /SPEED: (\d+)/i ? $1.to_i : 4
  626.   end
  627.   #--------------------------------------------------------------------------
  628.   # * load_system_settings
  629.   #--------------------------------------------------------------------------
  630.   def load_system_settings
  631.     init_position
  632.     @max_altitude    = note =~ /<ALTITUDE: (\d+)>/i     ? $1.to_i : 0
  633.     @character_name  = note =~ /<CHARACTER NAME: ([^><]*)>/i ? $1 : ""
  634.     @character_index = note =~ /<CHARACTER INDEX: (\d+)>/i ? $1.to_i : 0
  635.     @character_above = note =~ /<CHARACTER ABOVE>/
  636.     @step_animation  = note =~ /<STEP ANIMATION>/
  637.     @land_terrain  = get_value_list(/<LAND TERRAIN: ((?:\d+,? *)+)>/i)
  638.     @land_regions  = get_value_list(/<LAND REGION: ((?:\d+,? *)+)>/i)
  639.     @pass_terrain  = get_value_list(/<PASS TERRAIN: ((?:\d+,? *)+)>/i)
  640.     @pass_regions  = get_value_list(/<PASS REGION: ((?:\d+,? *)+)>/i)
  641.     @block_terrain = get_value_list(/<BLOCK TERRAIN: ((?:\d+,? *)+)>/i)
  642.     @block_regions = get_value_list(/<BLOCK REGION: ((?:\d+,? *)+)>/i)
  643.     @battleback1  = note =~ /<BATTLEBACK 1: ([^><]*)>/i ? $1 : nil
  644.     @battleback2  = note =~ /<BATTLEBACK 2: ([^><]*)>/i ? $1 : nil
  645.     @encounter    = note =~ /<ENCOUNTER RATE: (\d+)\%?>/i ? $1.to_i : 100
  646.     @pass_type    = set_passability_type
  647.     @pass_terrain = [0] if @pass_terrain.empty? && @pass_type
  648.     @land_terrain = [0] if @land_terrain.empty? && @pass_type
  649.     @idle_sound = set_vehicle_sound("IDLE")
  650.     @move_sound = set_vehicle_sound("MOVE")
  651.   end
  652.   #--------------------------------------------------------------------------
  653.   # * init_position
  654.   #--------------------------------------------------------------------------
  655.   def init_position
  656.     @map_id = note =~ /<INIT MAP: (\d+)>/i ? $1.to_i : 4
  657.     @x = @y = -1
  658.     @x, @y = $1.to_i, $2.to_i if note =~ /<INIT POS: (\d+) *, *(\d+)>/i
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # * get_value_list
  662.   #--------------------------------------------------------------------------
  663.   def get_value_list(regexp)
  664.     list = []
  665.     $1.scan(/(\d+)/i) {list.push($1.to_i)} if note =~ regexp
  666.     list
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # * set_passability_type
  670.   #--------------------------------------------------------------------------
  671.   def set_passability_type
  672.     note =~ /<PASSABILITY: (\w+)>/i ? eval(":#{$1.downcase}") : nil
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # * set_vehicle_sound
  676.   #--------------------------------------------------------------------------
  677.   def set_vehicle_sound(type)
  678.     value = " *,? *(\d+)? *,? *(\d+)? *,? *(\d+)?"
  679.     if note =~ /<#{type} SOUND: #{get_filename}#{value}>/im
  680.       se = RPG::SE.new($1.to_s, $2 ? $2.to_i : 100, $3 ? $3.to_i : 100)
  681.       sound = {sound: se, wait: $4 ? $4.to_i : 20}
  682.     end
  683.     sound
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # * refresh
  687.   #--------------------------------------------------------------------------
  688.   def refresh
  689.     super
  690.     @priority_type = 0 if @character_above && !@driving
  691.     @priority_type = 2 if @max_altitude > 0 && @driving
  692.     @step_anime = @step_animation
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # * get_on
  696.   #--------------------------------------------------------------------------
  697.   def get_on
  698.     @driving = true
  699.     @walk_anime = true
  700.     @step_anime = @step_animation
  701.     @walking_bgm = RPG::BGM.last
  702.     if note =~ /<MUSIC: #{get_filename}(?:, *(\d+) *, *(\d+))?>/i
  703.       bgm = RPG::BGM.new($1.to_s, $2 ? $2.to_i : 100, $3 ? $3.to_i : 100)
  704.       bgm.play
  705.     end
  706.   end
  707.   #--------------------------------------------------------------------------
  708.   # * pass_type
  709.   #--------------------------------------------------------------------------
  710.   def pass_type
  711.     @pass_type
  712.   end
  713.   #--------------------------------------------------------------------------
  714.   # * max_altitude
  715.   #--------------------------------------------------------------------------
  716.   def max_altitude
  717.     @max_altitude
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # * aerial?
  721.   #--------------------------------------------------------------------------
  722.   def aerial?
  723.     max_altitude > 0
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # * above?
  727.   #--------------------------------------------------------------------------
  728.   def above?
  729.     @character_above
  730.   end
  731.   #--------------------------------------------------------------------------
  732.   # * encounter_rate
  733.   #--------------------------------------------------------------------------
  734.   def encounter_rate
  735.     @encounter / 100.0
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # * movable?
  739.   #--------------------------------------------------------------------------
  740.   def movable?
  741.     !moving? && !(@altitude < max_altitude)
  742.   end
  743.   #--------------------------------------------------------------------------
  744.   # * land_ok?
  745.   #--------------------------------------------------------------------------
  746.   def land_ok?(x, y, d)
  747.     if @character_above
  748.       return false unless $game_map.events_xy(x, y).empty?
  749.       return false unless land_terrain?(x, y)
  750.       return false if block_terrain?(x, y)
  751.     else
  752.       x2 = $game_map.round_x_with_direction(x, d)
  753.       y2 = $game_map.round_y_with_direction(y, d)
  754.       return false if block_terrain?(x2, y2)
  755.       return false unless land_terrain?(x, y)
  756.       return false unless land_terrain?(x2, y2)
  757.       return false unless $game_map.valid?(x2, y2)
  758.       return false unless $game_map.passable?(x2, y2, reverse_dir(d))
  759.       return false if collide_with_characters?(x2, y2)
  760.     end
  761.     return false if above_vehicles?(x, y, self)
  762.     return true
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # * vehicle_collision?
  766.   #--------------------------------------------------------------------------
  767.   def vehicle_collision?(x, y)
  768.     return false if aerial?  
  769.     return true  if collide_with_characters?(x, y)
  770.     return false
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # * land_terrain?
  774.   #--------------------------------------------------------------------------
  775.   def land_terrain?(x, y)
  776.     @land_terrain.include?($game_map.terrain_tag(x, y)) ||
  777.     @land_regions.include?($game_map.region_id(x, y))
  778.   end
  779.   #--------------------------------------------------------------------------
  780.   # * pass_terrain?
  781.   #--------------------------------------------------------------------------
  782.   def pass_terrain?(x, y)
  783.     @pass_terrain.include?($game_map.terrain_tag(x, y)) ||
  784.     @pass_regions.include?($game_map.region_id(x, y))
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # * block_terrain
  788.   #--------------------------------------------------------------------------
  789.   def block_terrain?(x, y)
  790.     @block_terrain.include?($game_map.terrain_tag(x, y)) ||
  791.     @block_regions.include?($game_map.region_id(x, y))
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # * vehicle_battleback1_name
  795.   #--------------------------------------------------------------------------
  796.   def vehicle_battleback1_name
  797.     @battleback1
  798.   end
  799.   #--------------------------------------------------------------------------
  800.   # * vehicle_battleback2_name
  801.   #--------------------------------------------------------------------------
  802.   def vehicle_battleback2_name
  803.     @battleback2
  804.   end
  805. end
复制代码

点评

航海系列的船只?请允许我这样理解,而且我觉得,这V受之有愧。  发表于 2012-10-26 15:19
就是添加交通工具的属性.包括HP.技能.防御.武器等......  发表于 2012-10-26 15:00
其实我还有点疑惑,交通工具的能力值是什么?  发表于 2012-10-25 22:30
我能想到的只有这个了...帮不上,实在抱歉。  发表于 2012-10-25 22:29
请问还有没有专门设置交通工具属性的脚本??没有就算了...有的话麻烦给个  发表于 2012-10-25 15:22
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-12-26 09:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表