Project1

标题: 请问一下如何禁止玩家切换队长 [打印本页]

作者: H000000216    时间: 2019-6-23 23:56
标题: 请问一下如何禁止玩家切换队长
因为有的剧情我是按照原始的队长去设置的,然后如果一切换队长的话,有的剧情就会变成两个相同的人在对话,就会显得很尴尬。如果不能禁止切换队长的话,请问一下该如何设置才能使这种尴尬的情况消失呢?

作者: Aephiex    时间: 2019-6-24 08:14
  1. class Game_Party
  2.   alias swap_order@Aephiex swap_order
  3.   def swap_order(index1, index2)
  4.     if index1 == 0 || index2 == 0
  5.       Sound.play_buzzer
  6.     else
  7.       swap_order@Aephiex(index1, index2)
  8.     end
  9.   end
  10. end
复制代码

作者: KB.Driver    时间: 2019-6-24 09:42
RUBY 代码复制
  1. class Game_Party
  2.   #--------------------------------------------------------------------------
  3.   # ● 角色入队到指定位置
  4.   #--------------------------------------------------------------------------
  5.   #  使用方法:
  6.   #    事件脚本 $game_party.cld99_add_actor(id,pos)
  7.   #       id:角色的数据库id
  8.   #      pos:角色入队的位置 队首为0 其他依次递增 缺省值为队尾
  9.   #       例: $game_party.cld99_add_actor(1,0) #让数据库id为1的艾里克加入队首
  10.   #--------------------------------------------------------------------------
  11.   def cld99_add_actor(actor_id, position = @actors.length)
  12.     @actors.insert(position,actor_id) unless @actors.include?(actor_id)
  13.     $game_player.refresh
  14.     $game_map.need_refresh = true
  15.   end
  16. end


插入这段脚本,然后你可以制作一个这样的公共事件:(假设艾里克是队长)


RUBY 代码复制
  1. $game_party.cld99_add_actor(1, 0)
  2. # 将1号队友 艾里克 加入到队伍 0 号位置(队首)

作者: xiaohuangdi    时间: 2019-6-24 10:06
#===============================================================================
# TheoAllen - 锁定队长
# Version : 1.0
# Contact : www.theolized.com
#-------------------------------------------------------------------------------
# 可让队长无法与其他角色调换队伍中的位置
#-------------------------------------------------------------------------------
# 请随意使用
#===============================================================================
class Scene_Menu
  #-----------------------------------------------------------------------------
  # Overwrite formation ok
  #-----------------------------------------------------------------------------
  def on_formation_ok
    if @status_window.index == 0
      RPG::SE.stop
      Sound.play_buzzer
    elsif @status_window.pending_index >= 0
      $game_party.swap_order(@status_window.index,
                             @status_window.pending_index)
      @status_window.pending_index = -1
      @status_window.redraw_item(@status_window.index)
    else
      @status_window.pending_index = @status_window.index
    end
    @status_window.activate
  end
  
end
作者: H000000216    时间: 2019-6-24 14:03
xiaohuangdi 发表于 2019-6-24 10:06
#===============================================================================
# TheoAllen - 锁定 ...

感谢您!可以使用!
作者: H000000216    时间: 2019-6-24 14:04
KB.Driver 发表于 2019-6-24 09:42
class Game_Party
  #--------------------------------------------------------------------------
  #  ...

好,谢谢您!
作者: H000000216    时间: 2019-6-24 14:04
Aephiex 发表于 2019-6-24 08:14

谢谢您!
作者: a0172322    时间: 2019-6-24 18:45
以前我都是让玩家隐藏,然后再用几个事件做出角色....




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1