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

Project1

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

[RM脚本] 随意传送系统,类似于飞行棋

 关闭 [复制链接]

Lv2.观梦者

梦石
0
星屑
910
在线时间
94 小时
注册时间
2005-10-22
帖子
397
跳转到指定楼层
1
发表于 2006-10-8 21:31:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
脚本来源:日本KGC网站
脚本说明:
導入後、カスタマイズ項目を好みに応じて変更してください。

変更後、属性[テレポート]を作成し、スキル・アイテムにセットします。
これでテレポート効果を持つスキル・アイテムの完成です。

イベントコマンド「スクリプト」で
  $game_system.teleport_permit = false
というスクリプトを入力すると、テレポートを禁止できます。
(許可する場合は true を指定)

テレポート先を追加する命令は
  Teleport.add(name, id, x, y[, dir])
  Teleport.add_now_place
の2種類があります。

前者は転送場所をマップID・X座標・Y座標で直接指定します。
nameは転送先の名前、dirは転送後のプレイヤーの向き(省略可)です。

後者は現在地をそのままテレポート先に追加します。
マップ名は、マップツリーから自動取得されます。

テレポート先を削除する命令は
  Teleport.delete(name)
です。
nameに指定した名前のテレポート先が削除されます。
{/hx}不好意思,不会翻译了,害怕翻译后反而看不懂,所以,把原说明直接放上了{/hx}
效果图:


  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/  ◆テレポート - KGC_Teleport◆
  3. #_/----------------------------------------------------------------------------
  4. #_/ 200xに存在した「テレポート」もどきを作成します。
  5. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  6. #==============================================================================
  7. # ★ カスタマイズ項目 ★
  8. #==============================================================================

  9. module KGC
  10.   # ◆テレポート SE
  11.   #  ≪"SE ファイル名"[, Volume, Pitch]≫
  12.   #  TELEPORT_SE = "018-Teleport01"  ←のようにファイル名だけ指定してもOK
  13.   TELEPORT_SE = RPG::AudioFile.new("018-Teleport01", 100)
  14. end

  15. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  16. $imported = {} if $imported == nil
  17. $imported["Teleport"] = true

  18. if $game_special_elements == nil
  19.   $game_special_elements = {}
  20.   $data_system = load_data("Data/System.rxdata")
  21. end
  22. # テレポート属性
  23. $game_special_elements["teleport"] = $data_system.elements.index("随意传送")

  24. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  25. module Teleport
  26.   #--------------------------------------------------------------------------
  27.   # ● テレポート先の追加
  28.   #     name : 転送先の名前
  29.   #     id   : 転送先のマップID
  30.   #     x    : 転送先のX座標
  31.   #     y    : 転送先のY座標
  32.   #     dir  : 転送後の向き(省略時:下向き)
  33.   #--------------------------------------------------------------------------
  34.   def self.add(name, id, x, y, dir = 2)
  35.     # 既に同じ名前が存在する場合は戻る
  36.     return if ($game_system.teleport_dest.find { |d| d[0] == name }) != nil
  37.     # テレポート先に追加
  38.     $game_system.teleport_dest << [name, id, x, y, dir]
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 現在地をテレポート先に追加
  42.   #--------------------------------------------------------------------------
  43.   def self.add_now_place
  44.     # 現在地を取得
  45.     place = [$game_map.map_name,
  46.       $game_map.map_id,
  47.       $game_player.x,
  48.       $game_player.y,
  49.       $game_player.direction]
  50.     # 既に同じ名前が存在する場合は戻る
  51.     return if ($game_system.teleport_dest.find { |d| d[0] == name }) != nil
  52.     # テレポート先に追加
  53.     $game_system.teleport_dest << place
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● テレポート先を削除
  57.   #     name : 転送先の名前
  58.   #--------------------------------------------------------------------------
  59.   def self.delete(name)
  60.     # 該当するテレポート先を削除
  61.     $game_system.teleport_dest.each { |dest|
  62.       if dest[0] == name
  63.         $game_system.teleport_dest.delete(dest)
  64.         break
  65.       end
  66.     }
  67.   end
  68. end

  69. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  70. #==============================================================================
  71. # ■ Game_Temp
  72. #==============================================================================

  73. class Game_Temp
  74.   #--------------------------------------------------------------------------
  75.   # ● 公開インスタンス変数
  76.   #--------------------------------------------------------------------------
  77.   attr_accessor :teleport_calling         # テレポート 呼び出しフラグ
  78.   attr_accessor :teleport_item            # テレポートアイテム
  79.   attr_accessor :teleport_user            # テレポート使用者
  80.   attr_accessor :teleport_cost_sp         # テレポート消費SP
  81.   #--------------------------------------------------------------------------
  82.   # ● オブジェクト初期化
  83.   #--------------------------------------------------------------------------
  84.   alias initialize_KGC_Teleport initialize
  85.   def initialize
  86.     # 元の処理を実行
  87.     initialize_KGC_Teleport

  88.     @teleport_item, @teleport_user = nil, nil
  89.     @teleport_cost_sp, @teleport_calling = 0, false
  90.   end
  91. end

  92. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  93. #==============================================================================
  94. # ■ Game_System
  95. #==============================================================================

  96. class Game_System
  97.   #--------------------------------------------------------------------------
  98.   # ● 公開インスタンス変数
  99.   #--------------------------------------------------------------------------
  100.   attr_accessor :teleport_dest            # テレポート先
  101.   attr_accessor :teleport_permit          # テレポート許可フラグ
  102.   #--------------------------------------------------------------------------
  103.   # ● オブジェクト初期化
  104.   #--------------------------------------------------------------------------
  105.   alias initialize_KGC_Teleport initialize
  106.   def initialize
  107.     # 元の処理を実行
  108.     initialize_KGC_Teleport

  109.     @teleport_dest, @teleport_permit = [], true
  110.   end
  111. end

  112. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  113. #==============================================================================
  114. # ■ Game_Map
  115. #==============================================================================

  116. class Game_Map
  117.   #--------------------------------------------------------------------------
  118.   # ● マップ名取得
  119.   #--------------------------------------------------------------------------
  120.   def map_name
  121.     # MapInfo.rxdata をロード
  122.     mapinfo = load_data("Data/MapInfos.rxdata")
  123.     # マップ名を返す
  124.     return mapinfo[@map_id].name
  125.   end
  126. end

  127. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  128. #==============================================================================
  129. # ■ Window_Teleport
  130. #------------------------------------------------------------------------------
  131. #  テレポート先一覧を表示するウィンドウです。
  132. #==============================================================================

  133. class Window_Teleport < Window_Selectable
  134.   #--------------------------------------------------------------------------
  135.   # ● オブジェクト初期化
  136.   #--------------------------------------------------------------------------
  137.   def initialize
  138.     super(80, 80, 480, 320)
  139.     @column_max = 2
  140.     refresh
  141.     self.back_opacity = 160
  142.     self.visible = false
  143.     self.index = 0
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● テレポート先の取得
  147.   #--------------------------------------------------------------------------
  148.   def dest
  149.     return @data[self.index]
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● リフレッシュ
  153.   #--------------------------------------------------------------------------
  154.   def refresh
  155.     if self.contents != nil
  156.       self.contents.dispose
  157.       self.contents = nil
  158.     end
  159.     @data = []
  160.     # テレポート先を追加
  161.     $game_system.teleport_dest.each { |d| @data << d }
  162.     # 項目数が 0 でなければビットマップを作成し、全項目を描画
  163.     @item_max = @data.size
  164.     if @item_max > 0
  165.       self.contents = Bitmap.new(width - 32, row_max * 32)
  166.       for i in 0...@item_max
  167.         draw_item(i)
  168.       end
  169.     end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 項目の描画
  173.   #     index : 項目番号
  174.   #--------------------------------------------------------------------------
  175.   def draw_item(index)
  176.     dest = @data[index]
  177.     x = 4 + index % 2 * 224
  178.     y = index / 2 * 32
  179.     self.contents.draw_text(x, y, 224, 32, dest[0], 0)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● カーソルの矩形更新
  183.   #--------------------------------------------------------------------------
  184.   def update_cursor_rect
  185.     # カーソル位置が 0 未満の場合
  186.     if @index < 0
  187.       self.cursor_rect.empty
  188.       return
  189.     end
  190.     # 現在の行を取得
  191.     row = @index / @column_max
  192.     # 現在の行が、表示されている先頭の行より前の場合
  193.     if row < self.top_row
  194.       # 現在の行が先頭になるようにスクロール
  195.       self.top_row = row
  196.     end
  197.     # 現在の行が、表示されている最後尾の行より後ろの場合
  198.     if row > self.top_row + (self.page_row_max - 1)
  199.       # 現在の行が最後尾になるようにスクロール
  200.       self.top_row = row - (self.page_row_max - 1)
  201.     end
  202.     # カーソルの幅を計算
  203.     cursor_width = (self.width - 32) / @column_max
  204.     # カーソルの座標を計算
  205.     x = @index % @column_max * cursor_width
  206.     y = @index / @column_max * 32 - self.oy
  207.     # カーソルの矩形を更新
  208.     self.cursor_rect.set(x, y, cursor_width, 32)
  209.   end
  210. end

  211. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  212. #==============================================================================
  213. # ■ Scene_Map
  214. #==============================================================================

  215. class Scene_Map
  216.   #--------------------------------------------------------------------------
  217.   # ● メイン処理
  218.   #--------------------------------------------------------------------------
  219.   alias main_KGC_Teleport main
  220.   def main
  221.     # テレポートウィンドウ作成
  222.     @teleport_window = Window_Teleport.new

  223.     # 元の処理を実行
  224.     main_KGC_Teleport

  225.     # ウィンドウを解放
  226.     @teleport_window.dispose
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ● フレーム更新
  230.   #--------------------------------------------------------------------------
  231.   alias update_KGC_Teleport update
  232.   def update
  233.     # 元の処理を実行
  234.     update_KGC_Teleport

  235.     # プレイヤーの移動中ではない場合
  236.     unless $game_player.moving?
  237.       # テレポート処理呼び出し中の場合
  238.       if $game_temp.teleport_calling
  239.         call_teleport
  240.       end
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● テレポート処理の呼び出し
  245.   #--------------------------------------------------------------------------
  246.   def call_teleport
  247.     # テレポート呼び出しフラグ解除
  248.     $game_temp.teleport_calling = false
  249.     # テレポート実行フラグをオフ
  250.     teleport_flag = false
  251.     # テレポートウィンドウを表示
  252.     @teleport_window.refresh
  253.     @teleport_window.opacity = 0
  254.     @teleport_window.visible = true
  255.     @teleport_window.active = true
  256.     loop {
  257.       # ウィンドウを更新
  258.       @teleport_window.opacity += 16 if @teleport_window.opacity < 255
  259.       @teleport_window.update
  260.       # ゲーム画面を更新
  261.       Graphics.update
  262.       # 入力情報を更新
  263.       Input.update

  264.       # B ボタンが押された場合
  265.       if Input.trigger?(Input::B)
  266.         # キャンセル SE を演奏
  267.         $game_system.se_play($data_system.cancel_se)
  268.         # アイテムの場合
  269.         if $game_temp.teleport_item != nil
  270.           # アイテム取得
  271.           item = $game_temp.teleport_item
  272.           # 消耗する場合は 1 個戻す
  273.           $game_party.gain_item(item.id, 1) if item.consumable
  274.           # アイテム使用解除
  275.           $game_temp.teleport_item = nil
  276.         # スキルの場合
  277.         elsif $game_temp.teleport_user != nil
  278.           # 使用者のSPを回復
  279.           $game_temp.teleport_user.sp += $game_temp.teleport_cost_sp
  280.           # 使用者、消費SPを解除
  281.           $game_temp.teleport_user = nil
  282.           $game_temp.teleport_cost_sp = 0
  283.         end
  284.         # トランジション準備
  285.         Graphics.freeze
  286.         # ループ離脱
  287.         break
  288.       end
  289.       # C ボタンが押された場合
  290.       if Input.trigger?(Input::C)
  291.         # テレポート場所を取得
  292.         dest = @teleport_window.dest
  293.         # 空欄を選択した場合
  294.         if dest == nil
  295.           # ブザー SE を演奏
  296.           $game_system.se_play($data_system.buzzer_se)
  297.           # ループ再開
  298.           next
  299.         end
  300.         # 移動先を設定
  301.         $game_temp.player_new_map_id = dest[1]
  302.         # プレイヤーの位置を設定
  303.         $game_temp.player_new_x = dest[2]
  304.         $game_temp.player_new_y = dest[3]
  305.         # プレイヤーの向きを設定
  306.         $game_temp.player_new_direction = dest[4]
  307.         # テレポート実行フラグをオン
  308.         teleport_flag = true
  309.         # ループ離脱
  310.         break
  311.       end
  312.     }
  313.     # テレポートウィンドウを消去
  314.     @teleport_window.visible = false
  315.     @teleport_window.active = false
  316.     # テレポート実行の場合
  317.     if teleport_flag
  318.       # プレイヤー場所移動フラグをセット
  319.       $game_temp.player_transferring = true
  320.       # トランジション実行フラグをセット
  321.       $game_temp.transition_processing = true
  322.       # トランジション準備
  323.       Graphics.freeze
  324.       # テレポート SE を演奏
  325.       if KGC::TELEPORT_SE.is_a?(RPG::AudioFile)
  326.         $game_system.se_play(KGC::TELEPORT_SE)
  327.       elsif KGC::TELEPORT_SE.is_a?(String)
  328.         Audio.se_play("Audio/SE/" + KGC::TELEPORT_SE)
  329.       end
  330.       # 場所移動実行
  331.       transfer_player
  332.     else
  333.       # トランジション実行
  334.       Graphics.transition
  335.     end
  336.   end
  337. end

  338. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  339. #==============================================================================
  340. # ■ Scene_Item
  341. #==============================================================================

  342. class Scene_Item
  343.   #--------------------------------------------------------------------------
  344.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  345.   #--------------------------------------------------------------------------
  346.   alias update_item_KGC_Teleport update_item
  347.   def update_item
  348.     # C ボタンが押された場合
  349.     if Input.trigger?(Input::C)
  350.       # アイテムウィンドウで現在選択されているデータを取得
  351.       @item = @item_window.item
  352.       # テレポート属性を持っている場合
  353.       if @item != nil && @item.is_a?(RPG::Item) &&
  354.           @item.element_set.include?($game_special_elements["teleport"])
  355.         # 使用できる場合
  356.         if $game_system.teleport_permit && @item.is_a?(RPG::Item) &&
  357.             $game_party.item_can_use?(@item.id)
  358.           # アイテムの使用時 SE を演奏
  359.           $game_system.se_play(@item.menu_se)
  360.           # 消耗品の場合は減らす
  361.           $game_party.lose_item(@item.id, 1) if @item.consumable
  362.           # 使用アイテムを保存
  363.           $game_temp.teleport_item = @item
  364.           # テレポート呼び出しフラグをセット
  365.           $game_temp.teleport_calling = true
  366.           # マップ画面に切り替え
  367.           $scene = Scene_Map.new
  368.         else
  369.           # ブザー SE を演奏
  370.           $game_system.se_play($data_system.buzzer_se)
  371.           return
  372.         end
  373.         return
  374.       end
  375.     end

  376.     # 元の処理を実行
  377.     update_item_KGC_Teleport
  378.   end
  379. end

  380. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  381. #==============================================================================
  382. # ■ Scene_Skill
  383. #==============================================================================

  384. class Scene_Skill
  385.   #--------------------------------------------------------------------------
  386.   # ● フレーム更新 (スキルウィンドウがアクティブの場合)
  387.   #--------------------------------------------------------------------------
  388.   alias update_skill_KGC_Teleport update_skill
  389.   def update_skill
  390.     # C ボタンが押された場合
  391.     if Input.trigger?(Input::C)
  392.       # スキルウィンドウで現在選択されているデータを取得
  393.       @skill = @skill_window.skill
  394.       # テレポート属性を持っている場合
  395.       if @skill != nil && @skill.element_set.include?($game_special_elements["teleport"])
  396.         # 使用できる場合
  397.         if @skill != nil && @actor.skill_can_use?(@skill.id) &&
  398.             $game_system.teleport_permit
  399.           # スキルの使用時 SE を演奏
  400.           $game_system.se_play(@skill.menu_se)
  401.           # SP消費
  402.           @actor.sp -= @skill.sp_cost
  403.           # 使用者・消費SPを保存
  404.           $game_temp.teleport_user = @actor
  405.           $game_temp.teleport_cost_sp = @skill.sp_cost
  406.           # テレポート呼び出しフラグをセット
  407.           $game_temp.teleport_calling = true
  408.           # マップ画面に切り替え
  409.           $scene = Scene_Map.new
  410.         else
  411.           # ブザー SE を演奏
  412.           $game_system.se_play($data_system.buzzer_se)
  413.           return
  414.         end
  415.         # 戻る
  416.         return
  417.       end
  418.     end

  419.     # 元の処理を実行
  420.     update_skill_KGC_Teleport
  421.   end
  422. end
复制代码
做脚本先从修改脚本做起,我只修改自己觉得能用到的东西。
以后的任何作品都将不会进行分享。
Bilibili:https://space.bilibili.com/288814521

Lv2.观梦者

梦石
0
星屑
910
在线时间
94 小时
注册时间
2005-10-22
帖子
397
2
 楼主| 发表于 2006-10-8 21:31:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
脚本来源:日本KGC网站
脚本说明:
導入後、カスタマイズ項目を好みに応じて変更してください。

変更後、属性[テレポート]を作成し、スキル・アイテムにセットします。
これでテレポート効果を持つスキル・アイテムの完成です。

イベントコマンド「スクリプト」で
  $game_system.teleport_permit = false
というスクリプトを入力すると、テレポートを禁止できます。
(許可する場合は true を指定)

テレポート先を追加する命令は
  Teleport.add(name, id, x, y[, dir])
  Teleport.add_now_place
の2種類があります。

前者は転送場所をマップID・X座標・Y座標で直接指定します。
nameは転送先の名前、dirは転送後のプレイヤーの向き(省略可)です。

後者は現在地をそのままテレポート先に追加します。
マップ名は、マップツリーから自動取得されます。

テレポート先を削除する命令は
  Teleport.delete(name)
です。
nameに指定した名前のテレポート先が削除されます。
{/hx}不好意思,不会翻译了,害怕翻译后反而看不懂,所以,把原说明直接放上了{/hx}
效果图:


  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/  ◆テレポート - KGC_Teleport◆
  3. #_/----------------------------------------------------------------------------
  4. #_/ 200xに存在した「テレポート」もどきを作成します。
  5. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  6. #==============================================================================
  7. # ★ カスタマイズ項目 ★
  8. #==============================================================================

  9. module KGC
  10.   # ◆テレポート SE
  11.   #  ≪"SE ファイル名"[, Volume, Pitch]≫
  12.   #  TELEPORT_SE = "018-Teleport01"  ←のようにファイル名だけ指定してもOK
  13.   TELEPORT_SE = RPG::AudioFile.new("018-Teleport01", 100)
  14. end

  15. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  16. $imported = {} if $imported == nil
  17. $imported["Teleport"] = true

  18. if $game_special_elements == nil
  19.   $game_special_elements = {}
  20.   $data_system = load_data("Data/System.rxdata")
  21. end
  22. # テレポート属性
  23. $game_special_elements["teleport"] = $data_system.elements.index("随意传送")

  24. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  25. module Teleport
  26.   #--------------------------------------------------------------------------
  27.   # ● テレポート先の追加
  28.   #     name : 転送先の名前
  29.   #     id   : 転送先のマップID
  30.   #     x    : 転送先のX座標
  31.   #     y    : 転送先のY座標
  32.   #     dir  : 転送後の向き(省略時:下向き)
  33.   #--------------------------------------------------------------------------
  34.   def self.add(name, id, x, y, dir = 2)
  35.     # 既に同じ名前が存在する場合は戻る
  36.     return if ($game_system.teleport_dest.find { |d| d[0] == name }) != nil
  37.     # テレポート先に追加
  38.     $game_system.teleport_dest << [name, id, x, y, dir]
  39.   end
  40.   #--------------------------------------------------------------------------
  41.   # ● 現在地をテレポート先に追加
  42.   #--------------------------------------------------------------------------
  43.   def self.add_now_place
  44.     # 現在地を取得
  45.     place = [$game_map.map_name,
  46.       $game_map.map_id,
  47.       $game_player.x,
  48.       $game_player.y,
  49.       $game_player.direction]
  50.     # 既に同じ名前が存在する場合は戻る
  51.     return if ($game_system.teleport_dest.find { |d| d[0] == name }) != nil
  52.     # テレポート先に追加
  53.     $game_system.teleport_dest << place
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● テレポート先を削除
  57.   #     name : 転送先の名前
  58.   #--------------------------------------------------------------------------
  59.   def self.delete(name)
  60.     # 該当するテレポート先を削除
  61.     $game_system.teleport_dest.each { |dest|
  62.       if dest[0] == name
  63.         $game_system.teleport_dest.delete(dest)
  64.         break
  65.       end
  66.     }
  67.   end
  68. end

  69. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  70. #==============================================================================
  71. # ■ Game_Temp
  72. #==============================================================================

  73. class Game_Temp
  74.   #--------------------------------------------------------------------------
  75.   # ● 公開インスタンス変数
  76.   #--------------------------------------------------------------------------
  77.   attr_accessor :teleport_calling         # テレポート 呼び出しフラグ
  78.   attr_accessor :teleport_item            # テレポートアイテム
  79.   attr_accessor :teleport_user            # テレポート使用者
  80.   attr_accessor :teleport_cost_sp         # テレポート消費SP
  81.   #--------------------------------------------------------------------------
  82.   # ● オブジェクト初期化
  83.   #--------------------------------------------------------------------------
  84.   alias initialize_KGC_Teleport initialize
  85.   def initialize
  86.     # 元の処理を実行
  87.     initialize_KGC_Teleport

  88.     @teleport_item, @teleport_user = nil, nil
  89.     @teleport_cost_sp, @teleport_calling = 0, false
  90.   end
  91. end

  92. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  93. #==============================================================================
  94. # ■ Game_System
  95. #==============================================================================

  96. class Game_System
  97.   #--------------------------------------------------------------------------
  98.   # ● 公開インスタンス変数
  99.   #--------------------------------------------------------------------------
  100.   attr_accessor :teleport_dest            # テレポート先
  101.   attr_accessor :teleport_permit          # テレポート許可フラグ
  102.   #--------------------------------------------------------------------------
  103.   # ● オブジェクト初期化
  104.   #--------------------------------------------------------------------------
  105.   alias initialize_KGC_Teleport initialize
  106.   def initialize
  107.     # 元の処理を実行
  108.     initialize_KGC_Teleport

  109.     @teleport_dest, @teleport_permit = [], true
  110.   end
  111. end

  112. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  113. #==============================================================================
  114. # ■ Game_Map
  115. #==============================================================================

  116. class Game_Map
  117.   #--------------------------------------------------------------------------
  118.   # ● マップ名取得
  119.   #--------------------------------------------------------------------------
  120.   def map_name
  121.     # MapInfo.rxdata をロード
  122.     mapinfo = load_data("Data/MapInfos.rxdata")
  123.     # マップ名を返す
  124.     return mapinfo[@map_id].name
  125.   end
  126. end

  127. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  128. #==============================================================================
  129. # ■ Window_Teleport
  130. #------------------------------------------------------------------------------
  131. #  テレポート先一覧を表示するウィンドウです。
  132. #==============================================================================

  133. class Window_Teleport < Window_Selectable
  134.   #--------------------------------------------------------------------------
  135.   # ● オブジェクト初期化
  136.   #--------------------------------------------------------------------------
  137.   def initialize
  138.     super(80, 80, 480, 320)
  139.     @column_max = 2
  140.     refresh
  141.     self.back_opacity = 160
  142.     self.visible = false
  143.     self.index = 0
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● テレポート先の取得
  147.   #--------------------------------------------------------------------------
  148.   def dest
  149.     return @data[self.index]
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● リフレッシュ
  153.   #--------------------------------------------------------------------------
  154.   def refresh
  155.     if self.contents != nil
  156.       self.contents.dispose
  157.       self.contents = nil
  158.     end
  159.     @data = []
  160.     # テレポート先を追加
  161.     $game_system.teleport_dest.each { |d| @data << d }
  162.     # 項目数が 0 でなければビットマップを作成し、全項目を描画
  163.     @item_max = @data.size
  164.     if @item_max > 0
  165.       self.contents = Bitmap.new(width - 32, row_max * 32)
  166.       for i in 0...@item_max
  167.         draw_item(i)
  168.       end
  169.     end
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 項目の描画
  173.   #     index : 項目番号
  174.   #--------------------------------------------------------------------------
  175.   def draw_item(index)
  176.     dest = @data[index]
  177.     x = 4 + index % 2 * 224
  178.     y = index / 2 * 32
  179.     self.contents.draw_text(x, y, 224, 32, dest[0], 0)
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● カーソルの矩形更新
  183.   #--------------------------------------------------------------------------
  184.   def update_cursor_rect
  185.     # カーソル位置が 0 未満の場合
  186.     if @index < 0
  187.       self.cursor_rect.empty
  188.       return
  189.     end
  190.     # 現在の行を取得
  191.     row = @index / @column_max
  192.     # 現在の行が、表示されている先頭の行より前の場合
  193.     if row < self.top_row
  194.       # 現在の行が先頭になるようにスクロール
  195.       self.top_row = row
  196.     end
  197.     # 現在の行が、表示されている最後尾の行より後ろの場合
  198.     if row > self.top_row + (self.page_row_max - 1)
  199.       # 現在の行が最後尾になるようにスクロール
  200.       self.top_row = row - (self.page_row_max - 1)
  201.     end
  202.     # カーソルの幅を計算
  203.     cursor_width = (self.width - 32) / @column_max
  204.     # カーソルの座標を計算
  205.     x = @index % @column_max * cursor_width
  206.     y = @index / @column_max * 32 - self.oy
  207.     # カーソルの矩形を更新
  208.     self.cursor_rect.set(x, y, cursor_width, 32)
  209.   end
  210. end

  211. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  212. #==============================================================================
  213. # ■ Scene_Map
  214. #==============================================================================

  215. class Scene_Map
  216.   #--------------------------------------------------------------------------
  217.   # ● メイン処理
  218.   #--------------------------------------------------------------------------
  219.   alias main_KGC_Teleport main
  220.   def main
  221.     # テレポートウィンドウ作成
  222.     @teleport_window = Window_Teleport.new

  223.     # 元の処理を実行
  224.     main_KGC_Teleport

  225.     # ウィンドウを解放
  226.     @teleport_window.dispose
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ● フレーム更新
  230.   #--------------------------------------------------------------------------
  231.   alias update_KGC_Teleport update
  232.   def update
  233.     # 元の処理を実行
  234.     update_KGC_Teleport

  235.     # プレイヤーの移動中ではない場合
  236.     unless $game_player.moving?
  237.       # テレポート処理呼び出し中の場合
  238.       if $game_temp.teleport_calling
  239.         call_teleport
  240.       end
  241.     end
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ● テレポート処理の呼び出し
  245.   #--------------------------------------------------------------------------
  246.   def call_teleport
  247.     # テレポート呼び出しフラグ解除
  248.     $game_temp.teleport_calling = false
  249.     # テレポート実行フラグをオフ
  250.     teleport_flag = false
  251.     # テレポートウィンドウを表示
  252.     @teleport_window.refresh
  253.     @teleport_window.opacity = 0
  254.     @teleport_window.visible = true
  255.     @teleport_window.active = true
  256.     loop {
  257.       # ウィンドウを更新
  258.       @teleport_window.opacity += 16 if @teleport_window.opacity < 255
  259.       @teleport_window.update
  260.       # ゲーム画面を更新
  261.       Graphics.update
  262.       # 入力情報を更新
  263.       Input.update

  264.       # B ボタンが押された場合
  265.       if Input.trigger?(Input::B)
  266.         # キャンセル SE を演奏
  267.         $game_system.se_play($data_system.cancel_se)
  268.         # アイテムの場合
  269.         if $game_temp.teleport_item != nil
  270.           # アイテム取得
  271.           item = $game_temp.teleport_item
  272.           # 消耗する場合は 1 個戻す
  273.           $game_party.gain_item(item.id, 1) if item.consumable
  274.           # アイテム使用解除
  275.           $game_temp.teleport_item = nil
  276.         # スキルの場合
  277.         elsif $game_temp.teleport_user != nil
  278.           # 使用者のSPを回復
  279.           $game_temp.teleport_user.sp += $game_temp.teleport_cost_sp
  280.           # 使用者、消費SPを解除
  281.           $game_temp.teleport_user = nil
  282.           $game_temp.teleport_cost_sp = 0
  283.         end
  284.         # トランジション準備
  285.         Graphics.freeze
  286.         # ループ離脱
  287.         break
  288.       end
  289.       # C ボタンが押された場合
  290.       if Input.trigger?(Input::C)
  291.         # テレポート場所を取得
  292.         dest = @teleport_window.dest
  293.         # 空欄を選択した場合
  294.         if dest == nil
  295.           # ブザー SE を演奏
  296.           $game_system.se_play($data_system.buzzer_se)
  297.           # ループ再開
  298.           next
  299.         end
  300.         # 移動先を設定
  301.         $game_temp.player_new_map_id = dest[1]
  302.         # プレイヤーの位置を設定
  303.         $game_temp.player_new_x = dest[2]
  304.         $game_temp.player_new_y = dest[3]
  305.         # プレイヤーの向きを設定
  306.         $game_temp.player_new_direction = dest[4]
  307.         # テレポート実行フラグをオン
  308.         teleport_flag = true
  309.         # ループ離脱
  310.         break
  311.       end
  312.     }
  313.     # テレポートウィンドウを消去
  314.     @teleport_window.visible = false
  315.     @teleport_window.active = false
  316.     # テレポート実行の場合
  317.     if teleport_flag
  318.       # プレイヤー場所移動フラグをセット
  319.       $game_temp.player_transferring = true
  320.       # トランジション実行フラグをセット
  321.       $game_temp.transition_processing = true
  322.       # トランジション準備
  323.       Graphics.freeze
  324.       # テレポート SE を演奏
  325.       if KGC::TELEPORT_SE.is_a?(RPG::AudioFile)
  326.         $game_system.se_play(KGC::TELEPORT_SE)
  327.       elsif KGC::TELEPORT_SE.is_a?(String)
  328.         Audio.se_play("Audio/SE/" + KGC::TELEPORT_SE)
  329.       end
  330.       # 場所移動実行
  331.       transfer_player
  332.     else
  333.       # トランジション実行
  334.       Graphics.transition
  335.     end
  336.   end
  337. end

  338. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  339. #==============================================================================
  340. # ■ Scene_Item
  341. #==============================================================================

  342. class Scene_Item
  343.   #--------------------------------------------------------------------------
  344.   # ● フレーム更新 (アイテムウィンドウがアクティブの場合)
  345.   #--------------------------------------------------------------------------
  346.   alias update_item_KGC_Teleport update_item
  347.   def update_item
  348.     # C ボタンが押された場合
  349.     if Input.trigger?(Input::C)
  350.       # アイテムウィンドウで現在選択されているデータを取得
  351.       @item = @item_window.item
  352.       # テレポート属性を持っている場合
  353.       if @item != nil && @item.is_a?(RPG::Item) &&
  354.           @item.element_set.include?($game_special_elements["teleport"])
  355.         # 使用できる場合
  356.         if $game_system.teleport_permit && @item.is_a?(RPG::Item) &&
  357.             $game_party.item_can_use?(@item.id)
  358.           # アイテムの使用時 SE を演奏
  359.           $game_system.se_play(@item.menu_se)
  360.           # 消耗品の場合は減らす
  361.           $game_party.lose_item(@item.id, 1) if @item.consumable
  362.           # 使用アイテムを保存
  363.           $game_temp.teleport_item = @item
  364.           # テレポート呼び出しフラグをセット
  365.           $game_temp.teleport_calling = true
  366.           # マップ画面に切り替え
  367.           $scene = Scene_Map.new
  368.         else
  369.           # ブザー SE を演奏
  370.           $game_system.se_play($data_system.buzzer_se)
  371.           return
  372.         end
  373.         return
  374.       end
  375.     end

  376.     # 元の処理を実行
  377.     update_item_KGC_Teleport
  378.   end
  379. end

  380. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  381. #==============================================================================
  382. # ■ Scene_Skill
  383. #==============================================================================

  384. class Scene_Skill
  385.   #--------------------------------------------------------------------------
  386.   # ● フレーム更新 (スキルウィンドウがアクティブの場合)
  387.   #--------------------------------------------------------------------------
  388.   alias update_skill_KGC_Teleport update_skill
  389.   def update_skill
  390.     # C ボタンが押された場合
  391.     if Input.trigger?(Input::C)
  392.       # スキルウィンドウで現在選択されているデータを取得
  393.       @skill = @skill_window.skill
  394.       # テレポート属性を持っている場合
  395.       if @skill != nil && @skill.element_set.include?($game_special_elements["teleport"])
  396.         # 使用できる場合
  397.         if @skill != nil && @actor.skill_can_use?(@skill.id) &&
  398.             $game_system.teleport_permit
  399.           # スキルの使用時 SE を演奏
  400.           $game_system.se_play(@skill.menu_se)
  401.           # SP消費
  402.           @actor.sp -= @skill.sp_cost
  403.           # 使用者・消費SPを保存
  404.           $game_temp.teleport_user = @actor
  405.           $game_temp.teleport_cost_sp = @skill.sp_cost
  406.           # テレポート呼び出しフラグをセット
  407.           $game_temp.teleport_calling = true
  408.           # マップ画面に切り替え
  409.           $scene = Scene_Map.new
  410.         else
  411.           # ブザー SE を演奏
  412.           $game_system.se_play($data_system.buzzer_se)
  413.           return
  414.         end
  415.         # 戻る
  416.         return
  417.       end
  418.     end

  419.     # 元の処理を実行
  420.     update_skill_KGC_Teleport
  421.   end
  422. end
复制代码
做脚本先从修改脚本做起,我只修改自己觉得能用到的东西。
以后的任何作品都将不会进行分享。
Bilibili:https://space.bilibili.com/288814521

Lv3.寻梦者

梦石
0
星屑
1733
在线时间
484 小时
注册时间
2006-1-7
帖子
1073
3
发表于 2006-10-8 21:43:35 | 只看该作者
除了汉字其余的完全看不懂了。
图片也是个叉叉。
初从文,三年不中;后习武,校场发一矢,中鼓吏,逐之出;遂学医,有所成。自撰一良方,服之,卒。
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
910
在线时间
94 小时
注册时间
2005-10-22
帖子
397
4
 楼主| 发表于 2006-10-8 21:46:07 | 只看该作者
{/gg}图片点一下就能看到了{/gg}
做脚本先从修改脚本做起,我只修改自己觉得能用到的东西。
以后的任何作品都将不会进行分享。
Bilibili:https://space.bilibili.com/288814521
回复 支持 反对

使用道具 举报

Lv1.梦旅人

有事烧纸

梦石
0
星屑
154
在线时间
509 小时
注册时间
2005-10-22
帖子
6982

贵宾VX城市地图大赛冠军第1届RMTV比赛冠军第1届TG大赛冠军

5
发表于 2006-10-8 21:54:45 | 只看该作者
转地球村...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
1 小时
注册时间
2006-8-9
帖子
510
6
发表于 2006-10-8 21:58:56 | 只看该作者
MS只要公共事件我就可以做到
回复 支持 反对

使用道具 举报

Lv1.梦旅人

匿·蹤

梦石
0
星屑
65
在线时间
99 小时
注册时间
2006-3-19
帖子
456
7
发表于 2006-10-8 22:46:47 | 只看该作者
汗……我还以为什么好玩的东东呢……

明显一个瞬移装置嘛……汗……
卐忍 → 解忍 → 元忍 → 隐忍 → 卍忍 → 匿踪(最终)
完全退步到了卐忍阶段
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

亡命·殤

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-8-13
帖子
777
8
发表于 2007-6-27 14:59:58 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
391
在线时间
148 小时
注册时间
2007-2-12
帖子
3263
9
发表于 2007-6-27 17:12:14 | 只看该作者
  还可以...不过是日本的..
回忆
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3263
在线时间
3616 小时
注册时间
2006-9-6
帖子
37399

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

10
发表于 2007-6-28 20:52:10 | 只看该作者
传送的话要是传的地方不多或不嫌麻烦完全可以用事件的地图传送和变量完成……
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 15:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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