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

Project1

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

[已经过期] 仓库脚本不会用 啊

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2007-8-10
帖子
284
跳转到指定楼层
1
发表于 2011-3-23 15:13:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
#party转换
#这是简易的party转换的脚本。

#召唤界面:$scene = Scene_Party_in.new
#可以用开关的on off来决定转换的操作可能与否。
#此外,也可以设定不想要离开的角色。
#不过由于毕竟只有角色的加入和退出的功能,使用起来可能不是很方便。
#可以适应简单的身份表示。
#用键盘a来做身份表示与否的变更。
#设定方法
#可加入party的最高人数
#变更下面的@party_max = 4部分,通常用4。
#可参加party的最少人数(必须选择的最低人数)
#变更下面的@party_min = 1部分,初期姑且设定为1。
#强制加入的角色(必须要加入到party中的角色)
#变更下面的@must_actors = [$game_actors[1]]部分
#在初级阶段,姑且将其设定为ID1号的角色(アルシェス)
#设定的例子
#@must_actors = [1, 2]
#这样,1号和2号ID的角色就被设定为强制加入的角色了。
#顺便一提,用事件指示的剧本,也就是
#$game_party.must_actors = [1]
#等,可以在游戏进行中设定。(最高最低人数等也同样是可能的。)
#判断可否加入party
#用 class Window_Party_Select 的 party_in_menber 来设定。
#设定例子
# menber.push($game_actors[1])  
# menber.push($game_actors[2])  if $game_switches[1]
#这样,就使1号ID的角色(アルシェス)的经常加入变为可能。
#2号ID的角色(是谁来着?)在游戏开关的1号是on状态下将可能加入。
#在初期设定阶段,1号ID是经常加入可能状态、
#2-8号ID则被设定为各自在游戏开关的1-7号是on状态下方可加入。
#
#  2005.9.24 バグ修正
#  強制加入アクターがセーブに反映されないバグを修正。
#  強制加入アクターの指定方法が変更されたので注意。
#
# 2006.2.5 柳柳修正
#  直接放入了add_actor
#  如果需要把战斗图改为行走图,本脚本找到draw_actor_battler(actor,x,y)替换为:draw_actor_graphic(actor, x+40, y + 80)
#  增加exp描绘

class Game_Party
attr_accessor :party_max
attr_accessor :party_min
attr_accessor :must_actors
alias party_select_initialize initialize
def initialize
   party_select_initialize
   @party_max = 10
   @party_min = 1
   @must_actors = [2]
end
def must_actor_include?(actor)
   return @must_actors.include?(actor.id)
end
def add_actor(actor_id)
   # 获取角色
   actor = $game_actors[actor_id]
   # 同伴人数未满 4 人、本角色不在队伍中的情况下
   if @actors.size < @party_max and not @actors.include?(actor)
     # 添加角色
     @actors.push(actor)
     # 还原主角
     $game_player.refresh
   end
end
end

class Window_Party_Select < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
   super(0, 96, 640, 384)
   @party_in_ok_menber = party_in_menber
   @item_max = party_in_menber.size
   @column_max = 4
   self.contents = Bitmap.new(width - 32, row_max * 176)
   self.index = 0
   refresh
end
#--------------------------------------------------------------------------
# ● アクターの取得
#--------------------------------------------------------------------------
def menber
   return @party_in_ok_menber[self.index]
end
#--------------------------------------------------------------------------
# ● パーティーin可能なメンバー取得
#--------------------------------------------------------------------------
def party_in_menber
   menber = []
   menber.push($game_actors[1])  
   menber.push($game_actors[2])
   menber.push($game_actors[3])
   menber.push($game_actors[4])
   menber.push($game_actors[5])  
   menber.push($game_actors[6]) # if $game_switches[39]
   menber.push($game_actors[9]) # if $game_switches[42]
   menber.push($game_actors[10]) # if $game_switches[43]
   menber.push($game_actors[11])  if $game_switches[44]
   menber.push($game_actors[12])  if $game_switches[45]
   return menber
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   for i in 0...@party_in_ok_menber.size
     draw_menber(i)
   end
end
#--------------------------------------------------------------------------
# ● アクター描画
#--------------------------------------------------------------------------
def draw_menber(index)
   actor = @party_in_ok_menber[index]
   x = 4 + index % @column_max * (640 / @column_max)
   y = index / @column_max * 88
   if $game_party.must_actor_include?(actor)
     color = text_color(3)
     opacity = 255
   elsif $game_party.actors.include?(actor)
     color = normal_color
     opacity = 255
   else
     color = disabled_color
     opacity = 128
   end
   self.contents.font.color = color
   draw_actor_graphic(actor, x+40, y + 80)
   #draw_actor_graphic(actor, x+40, y + 80)
   self.contents.draw_text(x, y, 120, 32, actor.name)
end
def draw_actor_battler(act,x,y)
   bitmap = RPG::Cache.battler(act.battler_name, act.battler_hue)
   cw = bitmap.width
   ch = bitmap.height
   src_rect = Rect.new(0, 0, cw, ch)
   self.contents.blt(x, y, bitmap, src_rect, opacity)
end
#--------------------------------------------------------------------------
# ● 行数の取得
#--------------------------------------------------------------------------
def row_max
   # 項目数と列数から行数を算出
   return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# ● 先頭の行の取得
#--------------------------------------------------------------------------
def top_row
   # ウィンドウ内容の転送元 Y 座標を、1 行の高さ 32 で割る
   return self.oy / 88
end
#--------------------------------------------------------------------------
# ● 先頭の行の設定
#     row : 先頭に表示する行
#--------------------------------------------------------------------------
def top_row=(row)
   # row が 0 未満の場合は 0 に修正
   if row < 0
     row = 0
   end
   # row が row_max - 1 超の場合は row_max - 1 に修正
   if row > row_max - 1
     row = row_max - 1
     if row < 0
       row = 0
     end
   end
   # row に 1 行の高さ 32 を掛け、ウィンドウ内容の転送元 Y 座標とする
   self.oy = row * 88
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる行数の取得
#--------------------------------------------------------------------------
def page_row_max
   # ウィンドウの高さから、フレームの高さ 32 を引き、1 行の高さ 32 で割る
   return (self.height - 32) / 88
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
     return
   end
   # 現在の行を取得
   row = @index / @column_max
   # 現在の行が、表示されている先頭の行より前の場合
   if row < self.top_row
     # 現在の行が先頭になるようにスクロール
     self.top_row = row
   end
   # 現在の行が、表示されている最後尾の行より後ろの場合
   if row > self.top_row + (self.page_row_max - 1)
     # 現在の行が最後尾になるようにスクロール
     self.top_row = row - (self.page_row_max - 1)
   end
   # カーソルの幅を計算
   cursor_width = 512 / @column_max
   # カーソルの座標を計算
   x = @index % @column_max * (cursor_width + 32)#(640 / @column_max)
   y = @index / @column_max * 88 - self.oy
   # カーソルの矩形を更新
   self.cursor_rect.set(x, y, cursor_width, 32)
end
end

class Window_Party_Select_Menber < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
   super(0, 0, 640, 96)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
   self.contents.clear
   for i in 0...$game_party.actors.size
     draw_menber(i)
   end
end
#--------------------------------------------------------------------------
# ● アクター描画
#--------------------------------------------------------------------------
def draw_menber(index)
   actor = $game_party.actors[index]
   x = 4 + index * (640 / $game_party.party_max)
   y = 0
   draw_actor_graphic(actor, x+32, y+48+8)
end
end

class Window_Party_Select_Menber_Status < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
   super(0, 288, 640, 192)
   self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(actor)
   self.contents.clear
   draw_actor_name(actor, 4, 0)
   draw_actor_class(actor, 4 + 144, 0)
   draw_actor_level(actor, 4, 32)
   draw_actor_state(actor, 4 + 72, 32)
   draw_actor_hp(actor, 4, 64, 172)
   draw_actor_sp(actor, 4, 96, 172)
   draw_actor_exp(actor, 4, 128)
   draw_actor_parameter(actor, 218, 32, 0)
   draw_actor_parameter(actor, 218, 64, 1)
   draw_actor_parameter(actor, 218, 96, 2)
   draw_actor_parameter(actor, 430, 32, 3)
   draw_actor_parameter(actor, 430, 64, 4)
   draw_actor_parameter(actor, 430, 96, 5)
   draw_actor_parameter(actor, 430, 128, 6)
   
end
end

class Scene_Party_in
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
   @main_window = Window_Party_Select.new
   @menber_window = Window_Party_Select_Menber.new
   @status_window = Window_Party_Select_Menber_Status.new
   @status_window.opacity = 192
   @status_window.z += 10
   @show_index = 0
   status_window_position
   @status_window.refresh(@main_window.menber)
   @status_window.visible = true
   @show_index = @main_window.index
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーム画面を更新
     Graphics.update
     # 入力情報を更新
     Input.update
     # フレーム更新
     update
     # 画面が切り替わったらループを中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # ウィンドウを解放
   @main_window.dispose
   @menber_window.dispose
   @status_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
   # コマンドウィンドウを更新
   @main_window.update
   if @status_window.visible and @show_index != @main_window.index
     status_window_position
     @status_window.refresh(@main_window.menber)
     @show_index = @main_window.index
   end
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     if $game_party.actors.size < $game_party.party_min
       # ブザー SE を演奏
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     # メニュー画面に切り替え
     $scene = Scene_Map.new
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     # 選択したアクターが強制加入アクターの場合入れ替え不可
     if $game_party.must_actor_include?(@main_window.menber)
       # ブザー SE を演奏
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     if $game_party.actors.include?(@main_window.menber)
       $game_party.remove_actor(@main_window.menber.id)
     else
       if $game_party.actors.size == $game_party.party_max
         # ブザー SE を演奏
         $game_system.se_play($data_system.buzzer_se)
         return
       end
       $game_party.add_actor(@main_window.menber.id)
     end
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     @main_window.refresh
     @menber_window.refresh
     return
   end
   # A ボタンが押された場合
   #if Input.trigger?(Input::A)
     # 決定 SE を演奏
     #$game_system.se_play($data_system.decision_se)
     #if @status_window.visible
        #@status_window.visible = false

     #else
        #status_window_position
        #@status_window.refresh(@main_window.menber)
        #@status_window.visible = true
        #@show_index = @main_window.index
     #end
     #return
   #end
end
def status_window_position
   if @main_window.cursor_rect.y < 176
     @status_window.y = 288
   else
     @status_window.y = 96
   end
end
end

这个如何在游戏中 调出想要的角色
menber.push($game_actors[1])  
   menber.push($game_actors[2])
   menber.push($game_actors[3])
   menber.push($game_actors[4])
   menber.push($game_actors[5])  
这句只能固定出线这5名角色 怎么才能和路人甲说话 出123号角色 路人乙对话出456号角色等等
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2025-7-20 05:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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