赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 1107 |
最后登录 | 2013-9-18 |
在线时间 | 49 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 49 小时
- 注册时间
- 2012-1-11
- 帖子
- 114
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 精灵使者 于 2012-3-28 15:09 编辑
第一个:- #===============================================================================
- #◆のびハザメニュー画面カスタマイズスクリプト
- #
- #再定義しているのでなるべく素材の上の方に導入することをお勧めします。
- #同じ個所を再定義しているスクリプトを新たに導入すると競合する恐れがあります。
- #===============================================================================
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # ゲーム中のすべてのウィンドウのスーパークラスです。
- #==============================================================================
- class Window_Base < Window
- module NOBIHAZARD
- module MENU
- #-------------------------------------------------------------------------------
- #●カスタマイズ項目
- #-------------------------------------------------------------------------------
- #Lvの描画
- DRAW_LV = false
- #HPの描画を有効にするか
- DRAW_HP_VALUE = false
-
- #HPゲージの描画を有効にするか
- DRAW_HP_G = true
-
- #HPゲージの色
- FINE = 11
- FINE2 = 29
-
- CAUTION = 17
- CAUTION2 = 6
-
- CAUTION3 = 20
- CAUTION4 = 21
-
- DANGER = 10
- DANGER2 = 2
-
- #MPゲージの描画を有効にするか
- DRAW_MP_G = true
-
- #MPゲージの色
- MP_G1 = 22
- MP_G2 = 23
-
-
- #
- BULLET = "Bul." # 弾薬表示名(長すぎると表示が潰れます)
-
- #通常は変更しないでください
- BULLET_ID = 1000 # 素手の変数のID
-
- #通常は変更しないでください
- BULLET_MAX_ID = 1500 # 素手の変数のID_最大値
-
- #BULLETゲージの色
- BULLET_G1 = 17#20
- BULLET_G2 = 18#21
-
- end
- end
- end
复制代码 第二个:- #==============================================================================
- # ■ Window_MenuStatus
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # ゲーム中のすべてのウィンドウのスーパークラスです。
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● FINEの文字色の取得
- #--------------------------------------------------------------------------
- def fine_color
- return text_color(NOBIHAZARD::MENU::FINE)
- end
- #--------------------------------------------------------------------------
- # ● FINEの文字色の取得2
- #--------------------------------------------------------------------------
- def fine_color2
- return text_color(NOBIHAZARD::MENU::FINE2)
- end
- #--------------------------------------------------------------------------
- # ● CAUTIONの文字色の取得
- #--------------------------------------------------------------------------
- def caution_color
- return text_color(NOBIHAZARD::MENU::CAUTION)
- end
- #--------------------------------------------------------------------------
- # ● CAUTIONの文字色の取得2
- #--------------------------------------------------------------------------
- def caution_color2
- return text_color(NOBIHAZARD::MENU::CAUTION2)
- end
- #--------------------------------------------------------------------------
- # ● CAUTIONの文字色の取得3
- #--------------------------------------------------------------------------
- def caution_color3
- return text_color(NOBIHAZARD::MENU::CAUTION3)
- end
- #--------------------------------------------------------------------------
- # ● CAUTIONの文字色の取得4
- #--------------------------------------------------------------------------
- def caution_color4
- return text_color(NOBIHAZARD::MENU::CAUTION4)
- end
- #--------------------------------------------------------------------------
- # ● DANGERの文字色の取得
- #--------------------------------------------------------------------------
- def danger_color
- return text_color(NOBIHAZARD::MENU::DANGER)
- end
- #--------------------------------------------------------------------------
- # ● DANGERの文字色の取得
- #--------------------------------------------------------------------------
- def danger_color2
- return text_color(NOBIHAZARD::MENU::DANGER2)
- end
- #--------------------------------------------------------------------------
- # ● HP の文字色を取得
- # actor : アクター
- #--------------------------------------------------------------------------
- def hp_gauge_color(actor)
- return knockout_color if actor.hp == 0
- return danger_color if actor.hp < actor.maxhp / 4
- return caution_color3 if actor.hp < actor.maxhp / 2
- return caution_color if actor.hp < actor.maxhp * 3 / 4
- return fine_color
- end
- #--------------------------------------------------------------------------
- # ● HP の文字色を取得2
- # actor : アクター
- #--------------------------------------------------------------------------
- def hp_gauge_color2(actor)
- return knockout_color if actor.hp == 0
- return danger_color2 if actor.hp < actor.maxhp / 4
- return caution_color4 if actor.hp < actor.maxhp / 2
- return caution_color2 if actor.hp < actor.maxhp * 3 / 4
- return fine_color2
- end
- #--------------------------------------------------------------------------
- # ● Bullet ゲージの色 1 の取得★カスタム
- #--------------------------------------------------------------------------
- def bullet_gauge_color1
- return text_color(NOBIHAZARD::MENU::BULLET_G1)
- end
- #--------------------------------------------------------------------------
- # ● Bullet ゲージの色 2 の取得★カスタム
- #--------------------------------------------------------------------------
- def bullet_gauge_color2
- return text_color(NOBIHAZARD::MENU::BULLET_G2)
- end
- #--------------------------------------------------------------------------
- # ● MP ゲージの色 1 の取得
- #--------------------------------------------------------------------------
- def mp_gauge_color1
- return text_color(NOBIHAZARD::MENU::MP_G1)
- end
- #--------------------------------------------------------------------------
- # ● MP ゲージの色 2 の取得
- #--------------------------------------------------------------------------
- def mp_gauge_color2
- return text_color(NOBIHAZARD::MENU::MP_G2)
- end
- #--------------------------------------------------------------------------
- # ● HP の文字色を取得
- # actor : アクター
- #--------------------------------------------------------------------------
- def hp_color(actor)
- return knockout_color if actor.hp == 0
- return normal_color
- end
- #--------------------------------------------------------------------------
- # ● Bullet の文字色を取得
- # カスタムイベント
- #--------------------------------------------------------------------------
- def bullet_color
- return normal_color #弾丸の表示色は常に同じ色。
- end
- #--------------------------------------------------------------------------
- # ● アクターの歩行グラフィック描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_actor_graphic(actor, x, y)
- draw_character(actor.character_name, actor.character_index, x, y)
- end
- #--------------------------------------------------------------------------
- # ● アクターの顔グラフィック描画(オリジナル)
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # size : 表示サイズ
- #--------------------------------------------------------------------------
- def draw_actor_face(actor, x, y, size = 96)
- draw_face(actor.face_name, actor.face_index, x, y, size)
- end
- #--------------------------------------------------------------------------
- # ● 名前の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, x, y)
- self.contents.font.color = hp_color(actor)
- self.contents.draw_text(x, y, 108, WLH, actor.name)
- end
- #--------------------------------------------------------------------------
- # ● クラスの描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_actor_class(actor, x, y)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 108, WLH, actor.class.name)
- end
- #--------------------------------------------------------------------------
- # ● ステートの描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 描画先の幅
- #--------------------------------------------------------------------------
- def draw_actor_state(actor, x, y, width = 96)
- count = 0
- for state in actor.states
- draw_icon(state.icon_index, x + 24 * count, y)
- count += 1
- break if (24 * count > width - 24)
- end
- end
- #--------------------------------------------------------------------------
- # ● HP ゲージの描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_actor_hp_gauge(actor, x, y, width = 120)
- gw = width * actor.hp / actor.maxhp
- gc1 = hp_gauge_color(actor)
- gc2 = hp_gauge_color2(actor)
- #gc1 = hp_gauge_color1
- #gc2 = hp_gauge_color2
- self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
- self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
- end
- #--------------------------------------------------------------------------
- # ● HP の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, x, y, width = 120)
- draw_actor_hp_gauge(actor, x, y, width)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)
- if NOBIHAZARD::MENU::DRAW_HP_VALUE
- self.contents.font.color = hp_color(actor)
- xr = x + width
- if width < 120
- self.contents.draw_text(xr - 40, y, 40, WLH, actor.hp, 2)
- else
- self.contents.draw_text(xr - 90, y, 40, WLH, actor.hp, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
- self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxhp, 2)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● bullet の描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- #★カスタムスクリプト
- def draw_bullet(actor, x, y, width = 120)
- top_actor = $game_party.members[0]#先頭のアクターを取得
- w_id = top_actor.weapon_id #先頭アクターの武器のIDをローカル変数に格納
- #武器のIDから武器の残弾数が格納されているツクール変数のIDを取得
- w_v_id = w_id + NOBIHAZARD::MENU::BULLET_ID
- #武器のIDから武器のMAX弾数が格納されているツクール変数のIDを取得
- w_max_id = w_id + NOBIHAZARD::MENU::BULLET_MAX_ID
- #参照変数に---が代入されているときは、ゲージの長さは0。
- draw_bullet_gauge(actor, x, y, width)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 30, WLH, NOBIHAZARD::MENU::BULLET)
- self.contents.font.color = bullet_color
- xr = x + width
- if width < 120
- #self.contents.draw_text(xr - 40, y, 40, WLH, actor.hp, 2)
- #現在装填数の描画
- self.contens.draw_text(xr - 40, y, 40 , WLH, $game_variables[w_v_id], 2)
- else
- #self.contents.draw_text(xr - 90, y, 40, WLH, actor.hp, 2)
- #現在装填数の描画
- self.contents.draw_text(xr - 90, y, 40, WLH, $game_variables[w_v_id], 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
- #self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxhp, 2)
- #最大装填数の描画
- self.contents.draw_text(xr - 40, y, 40, WLH, $game_variables[w_max_id], 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● bullet ゲージの描画(カスタム)
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_bullet_gauge(actor, x, y, width = 120)
- top_actor = $game_party.members[0]#先頭のアクターを取得
- w_id = top_actor.weapon_id #先頭アクターの武器のIDをローカル変数に格納
- #武器のIDから武器の残弾数が格納されているツクール変数のIDを取得
- w_v_id = w_id + NOBIHAZARD::MENU::BULLET_ID
- #武器のIDから武器のMAX弾数が格納されているツクール変数のIDを取得
- w_max_id = w_id + NOBIHAZARD::MENU::BULLET_MAX_ID
- #参照変数に---が代入されているときは、ゲージの長さは0。
- if $game_variables[w_max_id] == 0
- bull = 1 # 0÷0の計算を回避。0÷0を計算させたらエラーで落ちる。
- else
- bull = 0
- end
- if $game_variables[w_v_id] == "---"
- gw = 0
- else
- gw = width * $game_variables[w_v_id] / ($game_variables[w_max_id] + bull)
- end
- gc1 = bullet_gauge_color1
- gc2 = bullet_gauge_color2
- self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
- self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
- end
- #--------------------------------------------------------------------------
- # ● MP ゲージの描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # width : 幅
- #--------------------------------------------------------------------------
- def draw_actor_mp_gauge(actor, x, y, width = 120)
- gw = width * actor.mp / [actor.maxmp, 1].max
- gc1 = mp_gauge_color1
- gc2 = mp_gauge_color2
- self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
- self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
- end
- end
- #------------------------------------------------------------------------------
- # メニュー画面でパーティメンバーのステータスを表示するウィンドウです。
- #==============================================================================
- class Window_MenuStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- #カスタム
- def refresh
- self.contents.clear
- @item_max = $game_party.members.size
- draw_bullet(0, 104 + 120 , WLH / 2 + WLH * 2+96)#残弾数表示
- #for actor in $game_party.members
- actor = $game_party.members[0]#のびハザではパーティに二人以上メンバーが居ることはないので。
- draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
- x = 104
- y = actor.index * 96 + WLH / 2
- draw_actor_name(actor, x, y)
- draw_top_equip_weapon
- draw_actor_class(actor, x + 120, y)
-
- if NOBIHAZARD::MENU::DRAW_LV
- draw_actor_level(actor, x, y + WLH * 1)
- end
-
- draw_actor_state(actor, x, y + WLH * 2)
- # draw_bullet(0, x + 120 , y + WLH * 1)
- #draw_bullet(0, 104 + 120 , WLH / 2 + WLH * 1)#残弾数表示
- if NOBIHAZARD::MENU::DRAW_HP_G
- draw_actor_hp(actor, x + 120, y + WLH * 1)
- end
- if NOBIHAZARD::MENU::DRAW_MP_G
- draw_actor_mp(actor, x + 120, y + WLH * 2)
- end
-
- draw_item_name(actor.equips[0], x, y+96)#武器名とアイコンの描画
- #end
- end
- end
- #==============================================================================
- # ■ Window_BattleStatus
- #------------------------------------------------------------------------------
- # バトル画面でパーティメンバーのステータスを表示するウィンドウです。
- #==============================================================================
- class Window_BattleStatus < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- actor = $game_party.members[index]
- draw_actor_name(actor, 4, rect.y)
- draw_actor_state(actor, 114, rect.y, 48)
- if NOBIHAZARD::MENU::DRAW_HP_G
- draw_actor_hp(actor, 174, rect.y, 120)
- end
- if NOBIHAZARD::MENU::DRAW_MP_G
- draw_actor_mp(actor, 310, rect.y, 70)
- end
- end
- end
- #==============================================================================
- # ■ Window_SkillStatus
- #------------------------------------------------------------------------------
- # スキル画面で、スキル使用者のステータスを表示するウィンドウです。
- #==============================================================================
- class Window_SkillStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_name(@actor, 4, 0)
- if NOBIHAZARD::MENU::DRAW_LV
- draw_actor_level(@actor, 140, 0)
- end
- if NOBIHAZARD::MENU::DRAW_HP_G
- draw_actor_hp(@actor, 240, 0)
- end
- if NOBIHAZARD::MENU::DRAW_MP_G
- draw_actor_mp(@actor, 392, 0)
- end
- end
- end
复制代码 第三个:- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # ゲーム中のすべてのウィンドウのスーパークラスです。
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 自動変更顔グラフィックの描画(先頭以外のアクターのインデックスまでかわってしまう)
- # face_name : 顔グラフィック ファイル名
- # face_index : 顔グラフィック インデックス
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # size : 表示サイズ
- #--------------------------------------------------------------------------
- def draw_actor_face(actor, x, y, size = 96)
- #カスタム
- actor = $game_party.members[0]
- hp_ratio = 100 * actor.hp / actor.maxhp#HPの割合を計算
- if actor.state?(5)
- face_index = 6#ウィルス
- elsif actor.state?(2)
- face_index = 4#毒
- elsif actor.state?(3)
- face_index = 4#毒
- elsif actor.state?(4)
- face_index = 5#出血
- elsif hp_ratio >=75
- face_index = 0
- elsif hp_ratio >=50
- face_index = 1
- elsif hp_ratio >=25
- face_index = 2
- else
- face_index = 3
- end
- #
- actor.set_graphic(actor.character_name,actor.character_index,actor.face_name,face_index)
- draw_face(actor.face_name, actor.face_index, x, y, size)
- end
- end
复制代码 第四个:- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # ゲーム中のすべてのウィンドウのスーパークラスです。
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 装備している武器の顔グラフィックをメニュー画面に表示するためのスクリプトです。
- # weapon_name : 顔グラフィック ファイル名
- # weapon_index : 顔グラフィック インデックス
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # size : 表示サイズ
- #--------------------------------------------------------------------------
- def draw_equip_weapon(weapon_name="", weapon_index=0, x=2, y=98, size = 96)
- #カスタム
- actor = $game_party.members[0]
- top_weapon_id = actor.weapon_id
- w_name =""#表示する武器の名前
- case top_weapon_id #武器のID
- #---------------------------------------------------------------------------
- #●カスタマイズ項目
- #---------------------------------------------------------------------------
- #when右にある数字が武器のIDです。
- #その後のweapon_nameとweapon_indexで表示させたい武器の顔グラフィックを指定します。
- #ファイル名は""の間に正しく記入してください。間違えるとエラーが出ます。
- #インデックスは範囲は0~7です。
- when 0 #武器のIDが0(装備していない時)
- weapon_name ="空白";weapon_index=0#すで
- when 1 #武器のIDが1の時
- weapon_name ="空白";weapon_index=0 #0~7
- when 2
- weapon_name ="武器02";weapon_index=1 #ナイフ
- when 3
- weapon_name ="武器04";weapon_index=3 #包丁
- when 4
- weapon_name ="空白";weapon_index=0 #0~7
- when 5
- weapon_name ="武器01";weapon_index=0 #ハンドガン
- when 6
- weapon_name ="武器01";weapon_index=1 #カスタムハンドガン
- when 7
- weapon_name ="空白";weapon_index=0 #0~7
- when 8
- weapon_name ="武器01";weapon_index=2 #ショットガン
- when 9
- weapon_name ="武器02";weapon_index=2 #レミントン
- when 10
- weapon_name ="武器02";weapon_index=3 #カスタムショットガン
- when 11
- weapon_name ="武器01";weapon_index=3 #0~7
- when 12
- weapon_name ="空白";weapon_index=0 #0~7
- when 13
- weapon_name ="武器01";weapon_index=4 #マグナムリボルバー
- when 14
- weapon_name ="武器01";weapon_index=7 #デザートイーグル
- when 15
- weapon_name ="武器02";weapon_index=5 #.44マグナム
- when 16
- weapon_name ="武器01";weapon_index=6 #護身用拳銃
- when 17
- weapon_name ="空白";weapon_index=0 #0~7
- when 18
- weapon_name ="武器04";weapon_index=4 #グレネードランチャー
- when 19
- weapon_name ="武器04";weapon_index=6 #グレネードランチャー
- when 20
- weapon_name ="武器04";weapon_index=5 #グレネードランチャー
- when 21
- weapon_name ="空白";weapon_index=0 #0~7
- when 22
- weapon_name ="武器02";weapon_index=7 #アサルトライフル
- when 23
- weapon_name ="空白";weapon_index=0 #0~7
- when 24
- weapon_name ="武器01";weapon_index=0 #∞ハンドガン
- when 25
- weapon_name ="武器02";weapon_index=7 #∞アサルトライフル
- when 26
- weapon_name ="武器02";weapon_index=6 #∞ロケットランチャー
- when 27
- weapon_name ="空白";weapon_index=0 #0~7
- when 28
- weapon_name ="武器02";weapon_index=6 #ロケットランチャー
- when 29
- weapon_name ="武器03";weapon_index=0 #バズーカ
- when 30
- weapon_name ="武器03";weapon_index=3 #ライフル型ロケットランチャー
- when 31
- weapon_name ="武器03";weapon_index=0 #バズーカ
- when 32
- weapon_name ="武器03";weapon_index=3 #0~7
- when 33
- weapon_name ="武器01";weapon_index=4 #マグナムリボルバー
- when 34
- weapon_name ="武器04";weapon_index=0 #ハンドキャノン
- when 35
- weapon_name ="空白";weapon_index=0 #0~7
- when 36
- weapon_name ="秘密道具01";weapon_index=0 #0~7
- when 37
- weapon_name ="空白";weapon_index=0 #0~7
- when 38
- weapon_name ="武器04";weapon_index=1 #ショットガンSA
- when 39
- weapon_name ="空白";weapon_index=0 #0~7
- when 40
- weapon_name ="空白";weapon_index=0 #0~7
- when 41
- weapon_name ="空白";weapon_index=0 #0~7
- when 42
- weapon_name ="武器02";weapon_index=1 #ナイフ
- when 43
- weapon_name ="空白";weapon_index=0 #0~7
- when 44
- weapon_name ="武器01";weapon_index=0 #ハンドガン
- when 45
- weapon_name ="武器01";weapon_index=1 #カスタムハンドガン
- when 46
- weapon_name ="空白";weapon_index=0 #0~7
- when 47
- weapon_name ="武器02";weapon_index=2 #レミントン
- when 48
- weapon_name ="武器02";weapon_index=3 #カスタムショットガン
- when 49
- weapon_name ="空白";weapon_index=0 #0~7
- when 50
- weapon_name ="武器01";weapon_index=7 #デザートイーグル
- when 51
- weapon_name ="空白";weapon_index=0 #デリンジャー
- when 52
- weapon_name ="武器05";weapon_index=2 #ボウイナイフ
- end
- #---------------------------------------------------------------------------
- #---------------------------------------------------------------------------
- #---------------------------------------------------------------------------
- bitmap = Cache.face(weapon_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = weapon_index % 4 * 96 + (96 - size) / 2
- rect.y = weapon_index / 4 * 96 + (96 - size) / 2
- rect.width = size
- rect.height = size
- self.contents.blt(x, y, bitmap, rect)
- bitmap.dispose
- end
- #--------------------------------------------------------------------------
- # ● 武器の顔グラフィック描画
- # actor : アクター
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- # size : 表示サイズ
- #--------------------------------------------------------------------------
- def draw_top_equip_weapon
- draw_equip_weapon
- end
- end
复制代码 第五个:- #==============================================================================
- # ■ Game_Interpreter
- #------------------------------------------------------------------------------
- # イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
- # Game_Troop クラス、Game_Event クラスの内部で使用されます。
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- #☆カスタム
- #--------------------------------------------------------------------------
- #○追加定義
- #●マップイベントの呼び出し!
- #---------------------------------------------------------------------------
- # マップイベント呼び出し(ページ指定対応)
- def cme(id,j)
- event = $game_map.events[id]
- @child_interpreter = Game_Interpreter.new(@depth+1)
- @child_interpreter.setup(event.instance_variable_get(:@event).pages[j-1].list,id)
- end
- end
- #イベントスクリプトから「cme(イベントID, ページ番号)」
- #イベントの出現条件を満たしていなくても(一時消去されていようが関係なく)
- #強制的にマップイベントを呼び出します。
复制代码 第六个:- #==============================================================================
- # ■ Game_System_re
- #------------------------------------------------------------------------------
- # タイマーを一時的に停止できるよう、再定義しました。(再定義)
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @timer = 0
- @timer_working = false
- @save_disabled = false
- @menu_disabled = false
- @encounter_disabled = false
- @save_count = 0
- @version_id = 0
- @timer_off = false # 追加
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- if @timer_working and @timer > 0
- if @timer_off == false # 追加
- @timer -= 1
- end # 追加
- if @timer == 0 and $game_temp.in_battle # 戦闘中にタイマーが 0 に
- $game_temp.next_scene = "map" # なったら戦闘を中断する
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● タイマーを一時停止する # 追加
- #--------------------------------------------------------------------------
- def timer_stop
- @timer_off = true
- end
- #--------------------------------------------------------------------------
- # ● タイマーを再開する # 追加
- #--------------------------------------------------------------------------
- def timer_start
- @timer_off = false
- end
- end
复制代码 第七个:- #
- # 特殊効果判定用ベーススクリプトVer1.10(RGSS2)
- # (C)2007-2008 TYPE74RX-T
- #
- #==============================================================================
- # ■ module Kernel(機能拡張)
- # (Ver1.09より実装)
- # ★ rx_delete(array)
- # 配列で指定した要素を全て取り除く
- # ★ rx_eqaror(array)
- # 配列で指定した要素のうちのいずれかに一致しているか
- # ★ rx_eqarand(array)
- # 配列で指定した要素のうちのどれにも一致しているか
- # ★ rx_atob(a, b)
- # 整数値がaからbまでの範囲内であるか
- #==============================================================================
- module Kernel
- #--------------------------------------------------------------------------
- # ★ 配列で指定した要素を全て取り除く
- #--------------------------------------------------------------------------
- def rx_delete(array)
- for i in 0...array.size
- self.delete(array[i])
- end
- end
- #--------------------------------------------------------------------------
- # ★ 配列で指定した要素のうちのいずれかに一致しているか
- #--------------------------------------------------------------------------
- def rx_eqaror(array)
- result = false
- for i in 0...array.size
- if self == array[i]
- result = true
- break
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ★ 配列で指定した要素のうちのどれにも一致しているか
- #--------------------------------------------------------------------------
- def rx_eqarand(array)
- result = true
- for i in 0...array.size
- if self != array[i]
- result = false
- break
- end
- end
- return result
- end
- #--------------------------------------------------------------------------
- # ★ 整数値がaからbまでの範囲内であるか
- #--------------------------------------------------------------------------
- def rx_atob(a, b)
- return (self >= a and self <= b)
- end
- end
- #==============================================================================
- # ★ RX_T
- #------------------------------------------------------------------------------
- # 素材用汎用モジュールです。
- #==============================================================================
- module RX_T
- #--------------------------------------------------------------------------
- # ● 装備用システムワードに指定文字列が含まれているか
- #--------------------------------------------------------------------------
- def self.check_system_word_in_equip(sys_str, string)
- return sys_str.include?(string)
- end
- #--------------------------------------------------------------------------
- # ● 装備用システムワードに指定文字列が含まれていれば
- # それに付随する数値を抽出
- # obj : スキル、アイテム、武器、防具 string : 指定文字列
- #--------------------------------------------------------------------------
- def self.get_numeric_of_system_word_in_equip(sys_str, string)
- if sys_str.include?(string)
- # 最後に指定のシステムワードが書かれた場所以降の文字列を取得
- words_loc = sys_str.rindex(string) # 文字位置取得
- # 文字列取得(文字位置が 1 番目以上なら)
- new_words = sys_str[words_loc, sys_str.length - 1] if words_loc > 0
- # 数字文字列を取得(文字位置によって処理が異なる)
- param = new_words.scan(/[-10-9]+/) if words_loc > 0
- param = sys_str.scan(/[-10-9]+/) if words_loc < 1
- numeric = param[0].to_i
- else
- numeric = 0
- end
- return numeric
- end
- #--------------------------------------------------------------------------
- # ● 装備用システムワードに指定文字列が含まれていれば
- # それに付随する数値群を配列化して返す
- # obj : スキル、アイテム、武器、防具 string : 指定文字列
- #--------------------------------------------------------------------------
- def self.get_array_of_system_word_in_equip(sys_str, string)
- elements = []
- if sys_str.include?(string)
- # 最後に指定のシステムワードが書かれた場所以降の文字列を取得
- words_loc = sys_str.rindex(string) + string.size # 文字位置取得
- # 文字列取得
- new_words = sys_str[words_loc, sys_str.length - 1]
- # 数字文字列を配列化して取得
- param = new_words.split(/s*,s*/)
- numeric = param[0].to_i
- # 数値を配列に入れる
- for i in 0...param.size
- numeric = param[i].to_i
- if numeric > 0
- elements.push(numeric)
- else
- break
- end
- end
- end
- return elements
- end
- #--------------------------------------------------------------------------
- # ● システムワードに指定文字列が含まれているか
- #--------------------------------------------------------------------------
- def self.check_system_word_in_sys_str(obj, string)
- return obj.rx_sys_str.include?(string)
- end
- #--------------------------------------------------------------------------
- # ● システムワード格納変数に指定文字列が含まれていれば
- # それに付随する数値を抽出
- # obj : スキル、アイテム、武器、防具 string : 指定文字列
- #--------------------------------------------------------------------------
- def self.get_numeric_of_system_word_in_sys_str(obj, string)
- # 素手に対応
- if obj == nil
- return 0
- end
- if obj.rx_sys_str.include?(string)
- # 最後に指定のシステムワードが書かれた場所以降の文字列を取得
- words_loc = obj.rx_sys_str.rindex(string) # 文字位置取得
- # 文字列取得(文字位置が 1 番目以上なら)
- new_words = obj.rx_sys_str[words_loc, obj.rx_sys_str.length - 1] if words_loc > 0
- # 数字文字列を取得(文字位置によって処理が異なる)
- param = new_words.scan(/[-10-9]+/) if words_loc > 0
- param = obj.rx_sys_str.scan(/[-10-9]+/) if words_loc < 1
- numeric = param[0].to_i
- else
- numeric = 0
- end
- return numeric
- end
- #--------------------------------------------------------------------------
- # ● システムワード格納変数に指定文字列が含まれていれば
- # それに付随する数値群を配列化して返す
- # obj : スキル、アイテム、武器、防具 string : 指定文字列
- #--------------------------------------------------------------------------
- def self.get_array_of_system_word_in_sys_str(obj, string)
- elements = []
- # 素手に対応
- if obj == nil
- return elements
- end
- if obj.rx_sys_str.include?(string)
- # 最後に指定のシステムワードが書かれた場所以降の文字列を取得
- words_loc = obj.rx_sys_str.rindex(string) + string.size # 文字位置取得
- # 文字列取得
- new_words = obj.rx_sys_str[words_loc, obj.rx_sys_str.length - 1]
- # 数字文字列を配列化して取得
- param = new_words.split(/s*,s*/)
- numeric = param[0].to_i
- # 数値を配列に入れる
- for i in 0...param.size
- numeric = param[i].to_i
- if numeric > 0
- elements.push(numeric)
- else
- break
- end
- end
- end
- return elements
- end
- #--------------------------------------------------------------------------
- # ● メモにシステムワードが含まれているか
- #--------------------------------------------------------------------------
- def self.check_system_word_in_note(obj, string)
- return obj.note.include?(string)
- end
- #--------------------------------------------------------------------------
- # ● メモにシステムワードが含まれていれば、それとそれに付随する数値を返す
- # note : メモ string : 指定文字列 option : 数値も返すか否か
- #--------------------------------------------------------------------------
- def self.get_system_word_in_note(note, string, option = false)
- if note.include?(string)
- # 最後に指定のシステムワードが書かれた場所以降の文字列を取得
- words_loc = note.rindex(string) # 文字位置取得
- # 文字列取得(文字位置が 1 番目以上なら)
- new_words = note[words_loc, note.length - 1] if words_loc > 0
- # 数字文字列を取得(文字位置によって処理が異なる)
- param = new_words.scan(/[-10-9]+/) if words_loc > 0
- param = note.scan(/[-10-9]+/) if words_loc < 1
- # 検出された指定の文字列(と数値)を返す
- return string + param[0] if param != [] and option
- return string if param == [] or not option
- end
- return ""
- end
- #--------------------------------------------------------------------------
- # ● メモにシステムワードが含まれていれば
- # それとそれに付随する配列用の数値を返す
- # note : メモ string : 指定文字列 option : 数値も返すか否か
- #--------------------------------------------------------------------------
- def self.get_system_word_in_note2(note, string)
- str = ""
- if note.include?(string)
- # 最後に指定のシステムワードが書かれた場所以降の文字列を取得
- words_loc = note.rindex(string) + string.size # 文字位置取得
- # 文字列取得
- new_words = note[words_loc, note.length - 1]
- # 数字文字列を取得(文字位置によって処理が異なる)
- param = new_words.split(/s*,s*/)
- for i in 0...param.size
- numeric = param[i].to_i
- if numeric > 0
- str += param[i] + ","
- else
- break
- end
- end
- str = string + str
- end
- return str
- end
- end
- #==============================================================================
- # ● RPG::BaseItem
- #------------------------------------------------------------------------------
- # スキル、アイテム、武器、防具のスーパークラスです。
- #==============================================================================
- module RPG
- class BaseItem
- @@rx_copy_str = "" #コピー用変数
- alias rx_rgss_rxsys_initialize initialize
- def initialize
- rx_rgss_rxsys_initialize
- # ★ システムワード用文字列変数(メモから抽出)
- @rx_sys_str = ""
- end
- #--------------------------------------------------------------------------
- # ★ メモ(システムワードが空ならメモから抽出)
- #--------------------------------------------------------------------------
- def note
- rx_extract_sys_str_from_note if @rx_sys_str == "" or @rx_sys_str == nil
- return @note
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数(システムワードが空ならメモから抽出)
- #--------------------------------------------------------------------------
- def rx_sys_str
- rx_extract_sys_str_from_note if @rx_sys_str == "" or @rx_sys_str == nil
- return @rx_sys_str
- end
- #--------------------------------------------------------------------------
- # ★ メモからシステム用文字列を排除したものをメモとして返す
- #--------------------------------------------------------------------------
- def rx_extract_sys_str_from_note
- rx_copy_str = @@rx_copy_str
- @@rx_copy_str = ""
- return rx_copy_str
- end
- end
- end
- #==============================================================================
- # ● RPG::Actor
- #------------------------------------------------------------------------------
- # アクターのデータクラスです。
- #==============================================================================
- module RPG
- class Actor
- alias rx_rgss_rxsys_initialize initialize
- def initialize
- rx_rgss_rxsys_initialize
- @rx_sys_str = ""
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数
- #--------------------------------------------------------------------------
- def rx_sys_str
- return @rx_sys_str
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数
- #--------------------------------------------------------------------------
- def rx_sys_str=(str)
- @rx_sys_str = str
- end
- end
- end
- #==============================================================================
- # ● RPG::Class
- #------------------------------------------------------------------------------
- # 職業のデータクラスです。
- #==============================================================================
- module RPG
- class Class
- alias rx_rgss_rxsys_initialize initialize
- def initialize
- rx_rgss_rxsys_initialize
- @rx_sys_str = ""
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数
- #--------------------------------------------------------------------------
- def rx_sys_str
- return @rx_sys_str
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数
- #--------------------------------------------------------------------------
- def rx_sys_str=(str)
- @rx_sys_str = str
- end
- end
- end
- #==============================================================================
- # ● RPG::Troop
- #------------------------------------------------------------------------------
- # 敵グループのデータクラスです。
- #==============================================================================
- module RPG
- class Troop
- alias rx_rgss_rxsys_initialize initialize
- def initialize
- rx_rgss_rxsys_initialize
- @rx_sys_str = ""
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数
- #--------------------------------------------------------------------------
- def rx_sys_str
- return @rx_sys_str
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数
- #--------------------------------------------------------------------------
- def rx_sys_str=(str)
- @rx_sys_str = str
- end
- end
- end
- #==============================================================================
- # ● RPG::Enemy
- #------------------------------------------------------------------------------
- # 敵キャラのデータクラスです。
- #==============================================================================
- module RPG
- class Enemy
- @@rx_copy_str = "" #コピー用変数
- alias rx_rgss_rxsys_initialize initialize
- def initialize
- rx_rgss_rxsys_initialize
- # ★ システムワード用文字列変数(メモから抽出)
- @rx_sys_str = ""
- end
- #--------------------------------------------------------------------------
- # ★ メモ(システムワードが空ならメモから抽出)
- #--------------------------------------------------------------------------
- def note
- rx_extract_sys_str_from_note if @rx_sys_str == "" or @rx_sys_str == nil
- return @note
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数(システムワードが空ならメモから抽出)
- #--------------------------------------------------------------------------
- def rx_sys_str
- rx_extract_sys_str_from_note if @rx_sys_str == "" or @rx_sys_str == nil
- return @rx_sys_str
- end
- #--------------------------------------------------------------------------
- # ★ メモからシステム用文字列を排除したものをメモとして返す
- #--------------------------------------------------------------------------
- def rx_extract_sys_str_from_note
- rx_copy_str = @@rx_copy_str
- @@rx_copy_str = ""
- return rx_copy_str
- end
- end
- end
- #==============================================================================
- # ● RPG::State
- #------------------------------------------------------------------------------
- # 敵キャラのデータクラスです。
- #==============================================================================
- module RPG
- class State
- @@rx_copy_str = "" #コピー用変数
- alias rx_rgss_rxsys_initialize initialize
- def initialize
- rx_rgss_rxsys_initialize
- # ★ システムワード用文字列変数(メモから抽出)
- @rx_sys_str = ""
- end
- #--------------------------------------------------------------------------
- # ★ メモ(システムワードが空ならメモから抽出)
- #--------------------------------------------------------------------------
- def note
- rx_extract_sys_str_from_note if @rx_sys_str == "" or @rx_sys_str == nil
- return @note
- end
- #--------------------------------------------------------------------------
- # ★ システム用文字列変数(システムワードが空ならメモから抽出)
- #--------------------------------------------------------------------------
- def rx_sys_str
- rx_extract_sys_str_from_note if @rx_sys_str == "" or @rx_sys_str == nil
- return @rx_sys_str
- end
- #--------------------------------------------------------------------------
- # ★ メモからシステム用文字列を排除したものをメモとして返す
- #--------------------------------------------------------------------------
- def rx_extract_sys_str_from_note
- rx_copy_str = @@rx_copy_str
- @@rx_copy_str = ""
- return rx_copy_str
- end
- end
- end
- #==============================================================================
- # ■ Game_Battler
- #------------------------------------------------------------------------------
- # バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
- # スのスーパークラスとして使用されます。
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias rx_rgss2bs1_initialize initialize
- def initialize
- # メソッドを呼び戻す
- rx_rgss2bs1_initialize
- @rx_magic_use = false # ★ 魔法使用フラグ
- end
- #--------------------------------------------------------------------------
- # ★ 魔法使用フラグ
- #--------------------------------------------------------------------------
- def rx_magic_use
- return @rx_magic_use
- end
- #--------------------------------------------------------------------------
- # ★ 魔法使用フラグの操作
- #--------------------------------------------------------------------------
- def rx_magic_use=(use)
- @rx_magic_use = use
- end
- #--------------------------------------------------------------------------
- # ★ 武器を持っているかの判定
- #--------------------------------------------------------------------------
- def rx_weapon_equip?
- return false unless self.actor?
- return (self.weapon_id > 0 or (self.two_swords_style and self.armor1_id > 0))
- end
- #--------------------------------------------------------------------------
- # ★ 武器で攻撃しているかの判定
- #--------------------------------------------------------------------------
- def rx_weapon_attack?
- return false unless rx_weapon_equip?
- return self.action.attack?
- end
- #--------------------------------------------------------------------------
- # ★ 装備しているものに含まれているシステムワードを取得
- #--------------------------------------------------------------------------
- def rx_sys_str
- return ""
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
- # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● セットアップ
- # actor_id : アクター ID
- #--------------------------------------------------------------------------
- alias rx_rgss2bs1_setup setup
- def setup(actor_id)
- # メソッドを呼び戻す
- rx_rgss2bs1_setup(actor_id)
- # ★ 職業のシステムワードを初期化
- format_class_rx_sys_str
- end
- #--------------------------------------------------------------------------
- # ★ 職業のシステムワードを初期化
- #--------------------------------------------------------------------------
- def format_class_rx_sys_str
- self.class.rx_sys_str = "" if self.class.rx_sys_str == nil
- end
- #--------------------------------------------------------------------------
- # ★ 装備しているものに含まれているシステムワードを取得
- #--------------------------------------------------------------------------
- def rx_sys_str
- sys_str = ""
- sys_str += $data_weapons[@weapon_id].rx_sys_str if @weapon_id > 0
- if self.two_swords_style
- sys_str += $data_weapons[@armor1_id].rx_sys_str if @armor1_id > 0
- else
- sys_str += $data_armors[@armor1_id].rx_sys_str if @armor1_id > 0
- end
- sys_str += $data_armors[@armor2_id].rx_sys_str if @armor2_id > 0
- sys_str += $data_armors[@armor3_id].rx_sys_str if @armor3_id > 0
- sys_str += $data_armors[@armor4_id].rx_sys_str if @armor4_id > 0
- return sys_str
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #------------------------------------------------------------------------------
- # 敵キャラを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の
- # 内部で使用されます。
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ★ 装備しているものに含まれているシステムワードを取得
- #--------------------------------------------------------------------------
- def rx_sys_str
- return ""
- end
- end
- #==============================================================================
- # ■ Game_BattleAction
- #------------------------------------------------------------------------------
- # 戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され
- # ます。
- #==============================================================================
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # ★ 魔法(精神関係度 1 以上)を使っているかの判定
- #--------------------------------------------------------------------------
- def rx_magic_use?
- return (skill? and $data_skills[@skill_id].spi_f >= 1)
- end
- end
复制代码 第八个:- #
- # プラグイン式ダメージ特殊効果用ベーススクリプトVer1.05(RGSS2)
- # (C)2007-2008 TYPE74RX-T
- #
- # ※:特殊効果判定用ベーススクリプトを先に導入してください。
- #==============================================================================
- # ■ Game_Battler
- #------------------------------------------------------------------------------
- # バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ
- # スのスーパークラスとして使用されます。
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # ★ スキルまたはアイテムに付加されている拡張システムフラグの取得
- # obj : スキルまたはアイテム
- #--------------------------------------------------------------------------
- def rx_set_system_flag(obj)
- @damage2 = 0
- end
- #--------------------------------------------------------------------------
- # ★ 装備物に付加されている拡張システムフラグの取得
- # sys_str : システムワード
- #--------------------------------------------------------------------------
- def rx_set_equip_sys_flag(sys_str)
- @damage2 = 0
- end
- #--------------------------------------------------------------------------
- # ★ 装備物に付加されている拡張システムフラグの取得(スキル使用時)
- # (Ver1.05より追加)
- # user : 使用者
- #--------------------------------------------------------------------------
- def rx_set_equip_sys_flag_user(user)
-
- end
- #--------------------------------------------------------------------------
- # ★ 特殊ダメージフラグ群をセット
- #--------------------------------------------------------------------------
- def rx_set_special_damage_flag
- @rx_special_damage_flags = []
- end
- #--------------------------------------------------------------------------
- # ★ 特殊ダメージ計算(武器攻撃)
- # attacker : 武器の使用者
- #--------------------------------------------------------------------------
- def rx_weapon_damage_calculation(attacker)
- damage = attacker.atk * 4 - self.def * 2 # 基本計算(物理攻撃)
- return damage
- end
- #--------------------------------------------------------------------------
- # ★ 特殊ダメージ計算
- # user : スキル、アイテムの使用者
- # obj : スキル、アイテム
- #--------------------------------------------------------------------------
- def rx_damage_calculation(user, obj)
- # 通常ダメージ計算フラグをON
- @rx_normal_damage = true
- # デフォルトのダメージ計算式
- damage = obj.base_damage # 基本ダメージを取得
- if damage > 0 # ダメージが正の数
- damage += user.atk * 4 * obj.atk_f / 100 # 打撃関係度: 使用者
- damage += user.spi * 2 * obj.spi_f / 100 # 精神関係度: 使用者
- unless obj.ignore_defense # 防御力無視以外
- damage -= self.def * 2 * obj.atk_f / 100 # 打撃関係度: 対象者
- damage -= self.spi * 1 * obj.spi_f / 100 # 精神関係度: 対象者
- end
- damage = 0 if damage < 0 # マイナスなら 0 に
- elsif damage < 0 # ダメージが負の数
- damage -= user.atk * 4 * obj.atk_f / 100 # 打撃関係度: 使用者
- damage -= user.spi * 2 * obj.spi_f / 100 # 精神関係度: 使用者
- end
- return damage
- end
- #--------------------------------------------------------------------------
- # ★ スキルまたはアイテムによる特殊ダメージ計算
- # user : スキルまたはアイテムの使用者
- # obj : スキルまたはアイテム
- # 結果は @hp_damage または @mp_damage(場合によっては両方)に代入する。
- #--------------------------------------------------------------------------
- def rx_special_damage(user, obj)
- @rx_attack_element_flag = false # 武器属性依存フラグの初期化
- @rx_attack_element_mix = false # 武器属性含有フラグの初期化
- @rx_mix_element_set = [] # 武器属性+スキル属性
- @rx_normal_damage = false # 通常ダメージ計算フラグの初期化
- # 武器属性とスキル属性を合成
- @rx_mix_element_set.concat(user.element_set) if user.actor?
- @rx_mix_element_set.concat(obj.element_set)
- # 被ってる要素があれば、それを1つにする
- @rx_mix_element_set = @rx_mix_element_set.uniq
- damage_flag_count = 0
- # 各種システムワードフラグのチェック(装備武器用)
- rx_set_equip_sys_flag_user(user) if user.actor?
- # 各種システムワードフラグのチェック(スキル用)
- rx_set_system_flag(obj)
- rx_set_special_damage_flag # 特殊ダメージフラグ群をセット
- damage = rx_damage_calculation(user, obj) # 特殊ダメージ計算
- if damage > 0 and not @rx_normal_damage
- unless obj.ignore_defense # 防御力無視以外
- damage -= self.def * 2 * obj.atk_f / 100 # 打撃関係度: 対象者
- damage -= self.spi * 1 * obj.spi_f / 100 # 精神関係度: 対象者
- end
- damage = 0 if damage < 0 # マイナスなら 0 に
- end
- # 武器属性依存なら(アクター限定)
- if @rx_attack_element_flag and user.actor?
- damage *= elements_max_rate(user.element_set) # 属性修正(武器側)
- # 武器属性とスキル属性を合成したスキルなら(アクター限定)
- elsif @rx_attack_element_mix and user.actor?
- damage *= elements_max_rate(@rx_mix_element_set) # 属性修正(武器+スキル)
- else
- damage *= elements_max_rate(obj.element_set) # 属性修正(スキル側)
- end
- damage /= 100
- damage = apply_variance(damage, obj.variance) # 分散
- damage = apply_guard(damage) # 防御修正
- if obj.damage_to_mp
- @mp_damage = damage # MP にダメージ
- else
- @hp_damage = damage # HP にダメージ
- end
- # HPMPダメージの効果があれば HP と MP の両方にダメージ
- if @rx_hpmp_damage != nil
- if @rx_hpmp_damage
- @hp_damage = damage # HP にダメージ
- if @damage2 != 0
- @mp_damage = @damage2 # MP にダメージ
- else
- @mp_damage = damage # MP にダメージ
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ★ 通常攻撃による特殊ダメージ計算
- # attacker : 攻撃者
- # 結果は @hp_damage に代入する。
- #--------------------------------------------------------------------------
- def rx_special_damage_weapon(attacker)
- rx_set_equip_sys_flag(attacker.rx_sys_str) # 各種システムワードフラグのチェック
- damage = rx_weapon_damage_calculation(attacker) # 特殊ダメージ計算
- damage = 0 if damage < 0 # マイナスなら 0 に
- damage *= elements_max_rate(attacker.element_set) # 属性修正
- damage /= 100
- if damage == 0 # ダメージが 0
- damage = rand(2) # 1/2 の確率で 1 ダメージ
- elsif damage > 0 # ダメージが正の数
- @critical = (rand(100) < attacker.cri) # クリティカル判定
- @critical = false if prevent_critical # クリティカル防止?
- damage *= 3 if @critical # クリティカル修正
- end
- damage = apply_variance(damage, 20) # 分散
- damage = apply_guard(damage) # 防御修正
- @hp_damage = damage # HP にダメージ
- #------------------------------------------------------------------------
- # ★ 「MPダメージ」スクリプト、「ダメージ吸収」スクリプトに対応
- #------------------------------------------------------------------------
- # 攻撃者がアクターで武器を持っていれば
- if attacker.actor? and attacker.weapon_id > 0
- # システムワードに「MPダメージ」が含まれていれば
- if RX_T.check_system_word_in_equip(attacker.rx_sys_str, "MPダメージ")
- @mp_damage = @hp_damage # MP にダメージ
- end
- # システムワードに「ダメージ吸収」が含まれていれば
- if RX_T.check_system_word_in_sys_str($data_weapons[attacker.weapon_id], "ダメージ吸収")
- # 吸収効果の計算処理へ
- rx_make_attack_absorb_effect(attacker)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 通常攻撃によるダメージ計算
- # attacker : 攻撃者
- # 結果は @hp_damage に代入する。
- #--------------------------------------------------------------------------
- alias rx_rgss2spc_make_attack_damage_value make_attack_damage_value
- def make_attack_damage_value(attacker)
- # ★ システムワードに「RX-SYS」が入っていれば
- if attacker.actor? and
- RX_T.check_system_word_in_equip(attacker.rx_sys_str, "RX-SYS")
- # 特殊ダメージ処理へ
- rx_special_damage_weapon(attacker)
- # メソッド終了
- return
- end
- # メソッドを呼び戻す
- rx_rgss2spc_make_attack_damage_value(attacker)
- end
- #--------------------------------------------------------------------------
- # ● スキルまたはアイテムによるダメージ計算
- # user : スキルまたはアイテムの使用者
- # obj : スキルまたはアイテム
- # 結果は @hp_damage または @mp_damage に代入する。
- #--------------------------------------------------------------------------
- alias rx_rgss2spc_make_obj_damage_value make_obj_damage_value
- def make_obj_damage_value(user, obj)
- # ★ 装備物のシステムワードに「RX-SYS」が入っているかのフラグ(Ver1.05より追加)
- rx_sys_equip = RX_T.check_system_word_in_equip(user.rx_sys_str, "RX-SYS") and user.actor?
- # ★ スキルまたは装備物のシステムワードに「RX-SYS」が入っていれば(Ver1.05より更新)
- if RX_T.check_system_word_in_sys_str(obj, "RX-SYS") or rx_sys_equip
- # 特殊ダメージ処理へ
- rx_special_damage(user, obj)
- # メソッド終了
- return
- end
- # メソッドを呼び戻す
- rx_rgss2spc_make_obj_damage_value(user, obj)
- end
- end
复制代码 第九个:- #==============================================================================
- # ■ Game_Party
- #------------------------------------------------------------------------------
- # パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
- # ラスのインスタンスは $game_party で参照されます。
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● ボックス内のアイテムの所持判定
- # item : ボックス内のアイテム
- #
- #--------------------------------------------------------------------------
- def keeping_has_item?(item)
- if keeping_item_number(item) > 0
- return true
- end
- return false
- end
- end
复制代码 第十个:- #
- # 特定アイテムの所持数を制限(RGSS2)
- # (C)2008 TYPE74RX-T
- #
- #--------------------------------------------------------------------------
- # ★ システムワードの登録:所持可能数
- #--------------------------------------------------------------------------
- module RPG
- class BaseItem
- alias rx_rgss2s5_rx_extract_sys_str_from_note rx_extract_sys_str_from_note
- def rx_extract_sys_str_from_note
- rx_get_sys = RX_T.get_system_word_in_note(@note, "所持可能数", true)
- @@rx_copy_str += rx_get_sys
- @note = @note.sub(rx_get_sys, "")
- @note = @note.sub("\r\n", "")
- @rx_sys_str = @@rx_copy_str
- # メソッドを呼び戻す
- rx_rgss2s5_rx_extract_sys_str_from_note
- end
- end
- end
- #==============================================================================
- # ■ Game_Party
- #------------------------------------------------------------------------------
- # パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
- # ラスのインスタンスは $game_party で参照されます。
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● アイテムの増加 (減少)
- # item : アイテム
- # n : 個数
- # include_equip : 装備品も含める
- #--------------------------------------------------------------------------
- alias rx_rgss2s5_gain_item gain_item
- def gain_item(item, n, include_equip = true)
- # ★ 所持可能数が決まっていれば専用の処理をする
- rx_limit = RX_T.get_numeric_of_system_word_in_sys_str(item, "所持可能数")
- return rx_limit_gain_item(item, n, rx_limit, include_equip) if rx_limit > 0
- # メソッドを呼び戻す
- rx_rgss2s5_gain_item(item, n, include_equip)
- end
- #--------------------------------------------------------------------------
- # ★ 所持数制限式アイテムの増加 (減少)
- # item : アイテム
- # n : 個数
- # include_equip : 装備品も含める
- #--------------------------------------------------------------------------
- def rx_limit_gain_item(item, n, limit, include_equip = true)
- number = item_number(item)
- case item
- when RPG::Item
- @items[item.id] = [[number + n, 0].max, limit].min
- when RPG::Weapon
- @weapons[item.id] = [[number + n, 0].max, limit].min
- when RPG::Armor
- @armors[item.id] = [[number + n, 0].max, limit].min
- end
- n += number
- if include_equip and n < 0
- for actor in members
- while n < 0 and actor.equips.include?(item)
- actor.discard_equip(item)
- n += 1
- end
- end
- end
- end
- end
- #==============================================================================
- # ■ Window_ShopBuy
- #------------------------------------------------------------------------------
- # ショップ画面で、購入できる商品の一覧を表示するウィンドウです。
- #==============================================================================
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- alias rx_rgss2s5_draw_item draw_item
- def draw_item(index)
- # ★ 所持可能数が決まっていれば専用の処理をする
- rx_limit = RX_T.get_numeric_of_system_word_in_sys_str(@data[index], "所持可能数")
- return rx_limit_draw_item(index, rx_limit) if rx_limit > 0
- # メソッドを呼び戻す
- rx_rgss2s5_draw_item(index)
- end
- #--------------------------------------------------------------------------
- # ★ 項目の描画(所持数制限式)
- # index : 項目番号
- #--------------------------------------------------------------------------
- def rx_limit_draw_item(index, limit)
- item = @data[index]
- number = $game_party.item_number(item)
- enabled = (item.price <= $game_party.gold and number < limit)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- draw_item_name(item, rect.x, rect.y, enabled)
- rect.width -= 4
- self.contents.draw_text(rect, item.price, 2)
- end
- end
- #==============================================================================
- # ■ Scene_Shop
- #------------------------------------------------------------------------------
- # ショップ画面の処理を行うクラスです。
- #==============================================================================
- class Scene_Shop < Scene_Base
- #--------------------------------------------------------------------------
- # ● 購入アイテム選択の更新
- #--------------------------------------------------------------------------
- alias rx_rgss2s5_update_buy_selection update_buy_selection
- def update_buy_selection
- # ★ 所持可能数が決まっていれば専用の処理をする
- rx_limit = RX_T.get_numeric_of_system_word_in_sys_str(@buy_window.item, "所持可能数")
- return rx_limit_update_buy_selection(rx_limit) if rx_limit > 0
- # メソッドを呼び戻す
- rx_rgss2s5_update_buy_selection
- end
- #--------------------------------------------------------------------------
- # ★ 購入アイテム選択の更新(所持数制限式)
- #--------------------------------------------------------------------------
- def rx_limit_update_buy_selection(limit)
- @status_window.item = @buy_window.item
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @command_window.active = true
- @dummy_window.visible = true
- @buy_window.active = false
- @buy_window.visible = false
- @status_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- return
- end
- if Input.trigger?(Input::C)
- @item = @buy_window.item
- number = $game_party.item_number(@item)
- if @item == nil or @item.price > $game_party.gold or number == limit
- Sound.play_buzzer
- else
- Sound.play_decision
- max = @item.price == 0 ? limit : $game_party.gold / @item.price
- max = [max, limit - number].min
- @buy_window.active = false
- @buy_window.visible = false
- @number_window.set(@item, max, @item.price)
- @number_window.active = true
- @number_window.visible = true
- end
- end
- end
- end
复制代码 第十一个:- #--------------------------------------------------------------------------
- #☆カスタムスクリプト
- #--------------------------------------------------------------------------
- #
- # ダッシュ禁止の変更(RGSS2)
- # (C)2008 TYPE74RX-T
- # イベントのスクリプトから設定できるように改造
- #==============================================================================
- # ■ Game_Map
- #------------------------------------------------------------------------------
- # マップを扱うクラスです。スクロールや通行可能判定などの機能を持っています。
- # このクラスのインスタンスは $game_map で参照されます。
- #==============================================================================
- class Game_Map
- #--------------------------------------------------------------------------
- # ★ ダッシュ許可
- #--------------------------------------------------------------------------
- def rx_enable_dash
- @map.disable_dashing = false
- # ダッシュを許可する
- end
- #--------------------------------------------------------------------------
- # ★ ダッシュ禁止
- #--------------------------------------------------------------------------
- def rx_disable_dash
- @map.disable_dashing = true
- # ダッシュ禁止にする
- end
- end
- =begin
- #==============================================================================
- # ■ 使い方
- #------------------------------------------------------------------------------
- # イベントコマンドのスクリプトでダッシュ禁止、ダッシュ許可の変更ができます。
- #
- #==============================================================================
- ★ダッシュを許可したいとき。
- ダッシュを許可したいところでイベントコマンドのスクリプトに・・・・
- $game_map.rx_enable_dash #ダッシュの許可
- と、一行書き込むだけでダッシュが許可されます。
- ★ダッシュを禁止したいとき。
- $game_map.rx_disable_dash #ダッシュの禁止
- と、スクリプトに書き込むだけでダッシュが禁止されます。
- =end
复制代码 第十二个:- #===============================================================================
- #◆のびハザ自律移動カスタマイズスクリプト-by57-
- #
- #再定義しているのでなるべく素材の上の方に導入することをお勧めします。
- #同じ個所を再定義しているスクリプトを新たに導入すると競合する恐れがあります。
- #===============================================================================#==============================================================================
- # ■ Game_Party
- #------------------------------------------------------------------------------
- # パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
- # ラスのインスタンスは $game_party で参照されます。
- #==============================================================================
- class Game_Player
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :dash_speed # ダッシュスピード(追加)
- attr_accessor :move_times # 全キャラクター移動速度倍率(追加)
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias nobihazard_57_script initialize
- def initialize
- super
- nobihazard_57_script
- @dash_speed = 1.6 # ダッシュが歩行速度の何倍?(追加)
- @move_times = 1 # 全キャラクター移動速度倍率
- end
- end
- #==============================================================================
- # ■ Game_Character(再定義)
- #------------------------------------------------------------------------------
- # キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
- # クラスのスーパークラスとして使用されます。
- #==============================================================================
- class Game_Character
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :id # ID
- attr_reader :x # マップ X 座標 (論理座標)
- attr_reader :y # マップ Y 座標 (論理座標)
- attr_reader :real_x # マップ X 座標 (実座標 * 256)
- attr_reader :real_y # マップ Y 座標 (実座標 * 256)
- attr_reader :tile_id # タイル ID (0 なら無効)
- attr_reader :character_name # 歩行グラフィック ファイル名
- attr_reader :character_index # 歩行グラフィック インデックス
- attr_reader :opacity # 不透明度
- attr_reader :blend_type # 合成方法
- attr_reader :direction # 向き
- attr_reader :pattern # パターン
- attr_reader :move_route_forcing # 移動ルート強制フラグ
- attr_reader :priority_type # プライオリティタイプ
- attr_reader :through # すり抜け
- attr_reader :bush_depth # 茂み深さ
- attr_accessor :animation_id # アニメーション ID
- attr_accessor :balloon_id # フキダシアイコン ID
- attr_accessor :transparent # 透明状態
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @id = 0
- @x = 0
- @y = 0
- @real_x = 0
- @real_y = 0
- @tile_id = 0
- @character_name = ""
- @character_index = 0
- @opacity = 255
- @blend_type = 0
- @direction = 2
- @pattern = 1
- @move_route_forcing = false
- @priority_type = 1
- @through = false
- @bush_depth = 0
- @animation_id = 0
- @balloon_id = 0
- @transparent = false
- @original_direction = 2 # 元の向き
- @original_pattern = 1 # 元のパターン
- @move_type = 0 # 移動タイプ
- @move_speed = 4 # 移動速度
- @move_frequency = 6 # 移動頻度
- @move_route = nil # 移動ルート
- @move_route_index = 0 # 移動ルートの実行位置
- @original_move_route = nil # 元の移動ルート
- @original_move_route_index = 0 # 元の移動ルートの実行位置
- @walk_anime = true # 歩行アニメ
- @step_anime = false # 足踏みアニメ
- @direction_fix = false # 向き固定
- @anime_count = 0 # アニメカウント
- @stop_count = 0 # 停止カウント
- @jump_count = 0 # ジャンプカウント
- @jump_peak = 0 # ジャンプの頂点のカウント
- @wait_count = 0 # ウェイトカウント
- @locked = false # ロックフラグ
- @prelock_direction = 0 # ロック前の向き
- @move_failed = false # 移動失敗フラグ
- end
- #--------------------------------------------------------------------------
- # ● 移動中判定
- #--------------------------------------------------------------------------
- def moving?
- return (@real_x != @x * 256 or @real_y != @y * 256) # 論理座標と比較
- end
- #--------------------------------------------------------------------------
- # ● ジャンプ中判定
- #--------------------------------------------------------------------------
- def jumping?
- return @jump_count > 0
- end
- #--------------------------------------------------------------------------
- # ● 停止中判定
- #--------------------------------------------------------------------------
- def stopping?
- return (not (moving? or jumping?))
- end
- #--------------------------------------------------------------------------
- # ● ダッシュ状態判定
- #--------------------------------------------------------------------------
- def dash?
- return false
- end
- #--------------------------------------------------------------------------
- # ● デバッグすり抜け状態判定
- #--------------------------------------------------------------------------
- def debug_through?
- return false
- end
- #--------------------------------------------------------------------------
- # ● 姿勢の矯正
- #--------------------------------------------------------------------------
- def straighten
- @pattern = 1 if @walk_anime or @step_anime
- @anime_count = 0
- end
- #--------------------------------------------------------------------------
- # ● 移動ルートの強制
- # move_route : 新しい移動ルート
- #--------------------------------------------------------------------------
- def force_move_route(move_route)
- if @original_move_route == nil
- @original_move_route = @move_route
- @original_move_route_index = @move_route_index
- end
- @move_route = move_route
- @move_route_index = 0
- @move_route_forcing = true
- @prelock_direction = 0
- @wait_count = 0
- move_type_custom
- end
- #--------------------------------------------------------------------------
- # ● 座標一致判定
- # x : X 座標
- # y : Y 座標
- #--------------------------------------------------------------------------
- def pos?(x, y)
- return (@x == x and @y == y)
- end
- #--------------------------------------------------------------------------
- # ● 座標一致と「すり抜け OFF」判定 (nt = No Through)
- # x : X 座標
- # y : Y 座標
- #--------------------------------------------------------------------------
- def pos_nt?(x, y)
- return (pos?(x, y) and not @through)
- end
- #--------------------------------------------------------------------------
- # ● 通行可能判定
- # x : X 座標
- # y : Y 座標
- #--------------------------------------------------------------------------
- def passable?(x, y)
- x = $game_map.round_x(x) # 横方向ループ補正
- y = $game_map.round_y(y) # 縦方向ループ補正
- return false unless $game_map.valid?(x, y) # マップ外?
- return true if @through or debug_through? # すり抜け ON?
- return false unless map_passable?(x, y) # マップが通行不能?
- return false if collide_with_characters?(x, y) # キャラクターに衝突?
- return true # 通行可
- end
- #--------------------------------------------------------------------------
- # ● マップ通行可能判定
- # x : X 座標
- # y : Y 座標
- # 指定された座標のタイルが通行可能かを取得する。
- #--------------------------------------------------------------------------
- def map_passable?(x, y)
- return $game_map.passable?(x, y)
- end
- #--------------------------------------------------------------------------
- # ● キャラクター衝突判定
- # x : X 座標
- # y : Y 座標
- # プレイヤーと乗り物を含め、通常キャラの衝突を検出する。
- #--------------------------------------------------------------------------
- def collide_with_characters?(x, y)
- for event in $game_map.events_xy(x, y) # イベントの座標と一致
- unless event.through # すり抜け OFF?
- return true if self.is_a?(Game_Event) # 自分がイベント
- return true if event.priority_type == 1 # 相手が通常キャラ
- end
- end
- if @priority_type == 1 # 自分が通常キャラ
- return true if $game_player.pos_nt?(x, y) # プレイヤーの座標と一致
- return true if $game_map.boat.pos_nt?(x, y) # 小型船の座標と一致
- return true if $game_map.ship.pos_nt?(x, y) # 大型船の座標と一致
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● ロック (実行中のイベントが立ち止まる処理)
- #--------------------------------------------------------------------------
- def lock
- unless @locked
- @prelock_direction = @direction
- turn_toward_player
- @locked = true
- end
- end
- #--------------------------------------------------------------------------
- # ● ロック解除
- #--------------------------------------------------------------------------
- def unlock
- if @locked
- @locked = false
- set_direction(@prelock_direction)
- end
- end
- #--------------------------------------------------------------------------
- # ● 指定位置に移動
- # x : X 座標
- # y : Y 座標
- #--------------------------------------------------------------------------
- def moveto(x, y)
- @x = x % $game_map.width
- @y = y % $game_map.height
- @real_x = @x * 256
- @real_y = @y * 256
- @prelock_direction = 0
- straighten
- update_bush_depth
- end
- #--------------------------------------------------------------------------
- # ● 指定方向に向き変更
- # direction : 向き
- #--------------------------------------------------------------------------
- def set_direction(direction)
- if not @direction_fix and direction != 0
- @direction = direction
- @stop_count = 0
- end
- end
- #--------------------------------------------------------------------------
- # ● オブジェクトタイプ判定
- #--------------------------------------------------------------------------
- def object?
- return (@tile_id > 0 or @character_name[0, 1] == '!')
- end
- #--------------------------------------------------------------------------
- # ● 画面 X 座標の取得
- #--------------------------------------------------------------------------
- def screen_x
- return ($game_map.adjust_x(@real_x) + 8007) / 8 - 1000 + 16
- end
- #--------------------------------------------------------------------------
- # ● 画面 Y 座標の取得
- #--------------------------------------------------------------------------
- def screen_y
- y = ($game_map.adjust_y(@real_y) + 8007) / 8 - 1000 + 32
- y -= 4 unless object?
- if @jump_count >= @jump_peak
- n = @jump_count - @jump_peak
- else
- n = @jump_peak - @jump_count
- end
- return y - (@jump_peak * @jump_peak - n * n) / 2
- end
- #--------------------------------------------------------------------------
- # ● 画面 Z 座標の取得
- #--------------------------------------------------------------------------
- def screen_z
- #ここから
- if @jump_count >= @jump_peak
- n = @jump_count - @jump_peak
- else
- n = @jump_peak - @jump_count
- end
- z = (@jump_peak * @jump_peak - n * n) / 32#ツクールXP参考に追加
- #ここまで追加
- if @priority_type == 2
- return z + 200 #z+を追加
- elsif @priority_type == 0
- return z + 60 #z+を追加
- elsif @tile_id > 0
- pass = $game_map.passages[@tile_id]
- if pass & 0x10 == 0x10 # [☆]
- return z + 160 #z+を追加
- else
- return z + 40 #z+を追加
- end
- else
- return z + 100 #z+を追加
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- if jumping? # ジャンプ中
- update_jump
- elsif moving? # 移動中
- update_move
- else # 停止中
- update_stop
- end
- if @wait_count > 0 # ウェイト中
- @wait_count -= 1
- elsif @move_route_forcing # 移動ルート強制中
- move_type_custom
- elsif not @locked # ロック中以外
- update_self_movement
- end
- update_animation
- end
- #--------------------------------------------------------------------------
- # ● ジャンプ時の更新
- #--------------------------------------------------------------------------
- def update_jump
- @jump_count -= 1
- @real_x = (@real_x * @jump_count + @x * 256) / (@jump_count + 1)
- @real_y = (@real_y * @jump_count + @y * 256) / (@jump_count + 1)
- update_bush_depth
- end
- #--------------------------------------------------------------------------
- # ● 移動時の更新
- #--------------------------------------------------------------------------
- def update_move
- distance = 2 ** @move_speed * $game_player.move_times # 移動速度から移動距離に変換
- distance *= $game_player.dash_speed if dash? #ダッシュ状態#2 if dash? # ダッシュ状態ならさらに倍
- @real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
- @real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
- @real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
- @real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
- update_bush_depth unless moving?
- if @walk_anime
- @anime_count += 1.5
- elsif @step_anime
- @anime_count += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 停止時の更新
- #--------------------------------------------------------------------------
- def update_stop
- if @step_anime
- @anime_count += 1
- elsif @pattern != @original_pattern
- @anime_count += 1.5
- end
- @stop_count += 1 unless @locked
- end
- #--------------------------------------------------------------------------
- # ● 自律移動の更新
- #--------------------------------------------------------------------------
- def update_self_movement
- if @stop_count > 30 * (5 - @move_frequency)
- case @move_type
- when 1; move_type_random
- when 2; move_type_toward_player
- when 3; move_type_custom
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● アニメカウントの更新
- #--------------------------------------------------------------------------
- def update_animation
- speed = @move_speed + (dash? ? $game_player.dash_speed / 2 : 0)#(dash? ? 1 : 0)
- #speed = @move_speed * $game_player.move_times + (dash? ? $game_player.dash_speed / 2 : 0)#(dash? ? 1 : 0)
- if @anime_count > 18 - speed * 2
- if not @step_anime and @stop_count > 0
- @pattern = @original_pattern
- else
- @pattern = (@pattern + 1) % 4
- end
- @anime_count = 0
- end
- end
- #--------------------------------------------------------------------------
- # ● 茂み深さの更新
- #--------------------------------------------------------------------------
- def update_bush_depth
- if object? or @priority_type != 1 or @jump_count > 0
- @bush_depth = 0
- else
- bush = $game_map.bush?(@x, @y)
- if bush and not moving?
- @bush_depth = 8
- elsif not bush
- @bush_depth = 0
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 移動タイプ : ランダム
- #--------------------------------------------------------------------------
- def move_type_random
- case rand(6)
- when 0..1; move_random
- when 2..4; move_forward
- when 5; @stop_count = 0
- end
- end
- #--------------------------------------------------------------------------
- # ● 移動タイプ : 近づく
- #--------------------------------------------------------------------------
- def move_type_toward_player
- sx = @x - $game_player.x
- sy = @y - $game_player.y
- if sx.abs + sy.abs >= 20
- move_random
- else
- case rand(6)
- when 0..3; move_toward_player
- when 4; move_random
- when 5; move_forward
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 移動タイプ : カスタム
- #--------------------------------------------------------------------------
- def move_type_custom
- if stopping?
- command = @move_route.list[@move_route_index] # 移動コマンドを取得
- @move_failed = false
- if command.code == 0 # リストの最後
- if @move_route.repeat # [動作を繰り返す]
- @move_route_index = 0
- elsif @move_route_forcing # 移動ルート強制中
- @move_route_forcing = false # 強制を解除
- @move_route = @original_move_route # オリジナルを復帰
- @move_route_index = @original_move_route_index
- @original_move_route = nil
- end
- else
- case command.code
- when 1 # 下に移動
- move_down
- when 2 # 左に移動
- move_left
- when 3 # 右に移動
- move_right
- when 4 # 上に移動
- move_up
- when 5 # 左下に移動
- move_lower_left
- when 6 # 右下に移動
- move_lower_right
- when 7 # 左上に移動
- move_upper_left
- when 8 # 右上に移動
- move_upper_right
- when 9 # ランダムに移動
- move_random
- when 10 # プレイヤーに近づく
- move_toward_player
- when 11 # プレイヤーから遠ざかる
- move_away_from_player
- when 12 # 一歩前進
- move_forward
- when 13 # 一歩後退
- move_backward
- when 14 # ジャンプ
- jump(command.parameters[0], command.parameters[1])
- when 15 # ウェイト
- @wait_count = command.parameters[0] - 1
- when 16 # 下を向く
- turn_down
- when 17 # 左を向く
- turn_left
- when 18 # 右を向く
- turn_right
- when 19 # 上を向く
- turn_up
- when 20 # 右に 90 度回転
- turn_right_90
- when 21 # 左に 90 度回転
- turn_left_90
- when 22 # 180 度回転
- turn_180
- when 23 # 右か左に 90 度回転
- turn_right_or_left_90
- when 24 # ランダムに方向転換
- turn_random
- when 25 # プレイヤーの方を向く
- turn_toward_player
- when 26 # プレイヤーの逆を向く
- turn_away_from_player
- when 27 # スイッチ ON
- $game_switches[command.parameters[0]] = true
- $game_map.need_refresh = true
- when 28 # スイッチ OFF
- $game_switches[command.parameters[0]] = false
- $game_map.need_refresh = true
- when 29 # 移動速度の変更
- @move_speed = command.parameters[0]
- when 30 # 移動頻度の変更
- @move_frequency = command.parameters[0]
- when 31 # 歩行アニメ ON
- @walk_anime = true
- when 32 # 歩行アニメ OFF
- @walk_anime = false
- when 33 # 足踏みアニメ ON
- @step_anime = true
- when 34 # 足踏みアニメ OFF
- @step_anime = false
- when 35 # 向き固定 ON
- @direction_fix = true
- when 36 # 向き固定 OFF
- @direction_fix = false
- when 37 # すり抜け ON
- @through = true
- when 38 # すり抜け OFF
- @through = false
- when 39 # 透明化 ON
- @transparent = true
- when 40 # 透明化 OFF
- @transparent = false
- when 41 # グラフィック変更
- set_graphic(command.parameters[0], command.parameters[1])
- when 42 # 不透明度の変更
- @opacity = command.parameters[0]
- when 43 # 合成方法の変更
- @blend_type = command.parameters[0]
- when 44 # SE の演奏
- command.parameters[0].play
- when 45 # スクリプト
- eval(command.parameters[0])
- end
- if not @move_route.skippable and @move_failed
- return # [移動できない場合は無視] OFF & 移動失敗
- end
- @move_route_index += 1
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 歩数増加
- #--------------------------------------------------------------------------
- def increase_steps
- @stop_count = 0
- update_bush_depth
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーからの X 距離計算
- #--------------------------------------------------------------------------
- def distance_x_from_player
- sx = @x - $game_player.x
- if $game_map.loop_horizontal? # 横にループしているとき
- if sx.abs > $game_map.width / 2 # 絶対値がマップの半分より大きい?
- sx -= $game_map.width # マップの幅を引く
- end
- end
- return sx
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーからの Y 距離計算
- #--------------------------------------------------------------------------
- def distance_y_from_player
- sy = @y - $game_player.y
- if $game_map.loop_vertical? # 縦にループしているとき
- if sy.abs > $game_map.height / 2 # 絶対値がマップの半分より大きい?
- sy -= $game_map.height # マップの高さを引く
- end
- end
- return sy
- end
- #--------------------------------------------------------------------------
- # ● 下に移動
- # turn_ok : その場での向き変更を許可
- #--------------------------------------------------------------------------
- def move_down(turn_ok = true)
- if passable?(@x, @y+1) # 通行可能
- turn_down
- @y = $game_map.round_y(@y+1)
- @real_y = (@y-1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_down if turn_ok
- check_event_trigger_touch(@x, @y+1) # 接触イベントの起動判定
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 左に移動
- # turn_ok : その場での向き変更を許可
- #--------------------------------------------------------------------------
- def move_left(turn_ok = true)
- if passable?(@x-1, @y) # 通行可能
- turn_left
- @x = $game_map.round_x(@x-1)
- @real_x = (@x+1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_left if turn_ok
- check_event_trigger_touch(@x-1, @y) # 接触イベントの起動判定
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 右に移動
- # turn_ok : その場での向き変更を許可
- #--------------------------------------------------------------------------
- def move_right(turn_ok = true)
- if passable?(@x+1, @y) # 通行可能
- turn_right
- @x = $game_map.round_x(@x+1)
- @real_x = (@x-1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_right if turn_ok
- check_event_trigger_touch(@x+1, @y) # 接触イベントの起動判定
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 上に移動
- # turn_ok : その場での向き変更を許可
- #--------------------------------------------------------------------------
- def move_up(turn_ok = true)
- if passable?(@x, @y-1) # 通行可能
- turn_up
- @y = $game_map.round_y(@y-1)
- @real_y = (@y+1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_up if turn_ok
- check_event_trigger_touch(@x, @y-1) # 接触イベントの起動判定
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 左下に移動
- #--------------------------------------------------------------------------
- def move_lower_left
- unless @direction_fix
- @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
- end
- if (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or
- (passable?(@x-1, @y) and passable?(@x-1, @y+1))
- @x -= 1
- @y += 1
- increase_steps
- @move_failed = false
- else
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 右下に移動
- #--------------------------------------------------------------------------
- def move_lower_right
- unless @direction_fix
- @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
- end
- if (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or
- (passable?(@x+1, @y) and passable?(@x+1, @y+1))
- @x += 1
- @y += 1
- increase_steps
- @move_failed = false
- else
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 左上に移動
- #--------------------------------------------------------------------------
- def move_upper_left
- unless @direction_fix
- @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
- end
- if (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or
- (passable?(@x-1, @y) and passable?(@x-1, @y-1))
- @x -= 1
- @y -= 1
- increase_steps
- @move_failed = false
- else
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 右上に移動
- #--------------------------------------------------------------------------
- def move_upper_right
- unless @direction_fix
- @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
- end
- if (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or
- (passable?(@x+1, @y) and passable?(@x+1, @y-1))
- @x += 1
- @y -= 1
- increase_steps
- @move_failed = false
- else
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● ランダムに移動
- #--------------------------------------------------------------------------
- def move_random
- case rand(4)
- when 0; move_down(false)
- when 1; move_left(false)
- when 2; move_right(false)
- when 3; move_up(false)
- end
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーに近づく
- #--------------------------------------------------------------------------
- def move_toward_player
- sx = distance_x_from_player
- sy = distance_y_from_player
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? move_left : move_right # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? move_up : move_down
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? move_up : move_down # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? move_left : move_right
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーから遠ざかる
- #--------------------------------------------------------------------------
- def move_away_from_player
- sx = distance_x_from_player
- sy = distance_y_from_player
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? move_right : move_left # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? move_down : move_up
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? move_down : move_up # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? move_right : move_left
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 一歩前進
- #--------------------------------------------------------------------------
- def move_forward
- case @direction
- when 2; move_down(false)
- when 4; move_left(false)
- when 6; move_right(false)
- when 8; move_up(false)
- end
- end
- #--------------------------------------------------------------------------
- # ● 一歩後退
- #--------------------------------------------------------------------------
- def move_backward
- last_direction_fix = @direction_fix
- @direction_fix = true
- case @direction
- when 2; move_up(false)
- when 4; move_right(false)
- when 6; move_left(false)
- when 8; move_down(false)
- end
- @direction_fix = last_direction_fix
- end
- #--------------------------------------------------------------------------
- # ● ジャンプ(VXデフォルトジャンプ)壁に埋まります。
- # x_plus : X 座標加算値
- # y_plus : Y 座標加算値
- #--------------------------------------------------------------------------
- def jumpvx(x_plus, y_plus)
- if x_plus.abs > y_plus.abs # 横の距離のほうが長い
- x_plus < 0 ? turn_left : turn_right
- elsif x_plus.abs < y_plus.abs # 縦の距離のほうが長い
- y_plus < 0 ? turn_up : turn_down
- end
- @x += x_plus
- @y += y_plus
- distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
- @jump_peak = 10 + distance - @move_speed
- @jump_count = @jump_peak * 2
- @stop_count = 0
- straighten
- end
- #--------------------------------------------------------------------------
- #カスタム
- # ● ジャンプ(2000仕様ジャンプ)
- # x_plus : X 座標加算値
- # y_plus : Y 座標加算値
- #--------------------------------------------------------------------------
- def jump(x_plus, y_plus)
- if x_plus == 0 and y_plus == 0
- jumpvx(0,0) #直上ジャンプ用
- elsif (passable?(@x + x_plus, @y + y_plus)) #ジャンプ先が通行可能かどうか?
- if x_plus.abs > y_plus.abs # 横の距離のほうが長い
- x_plus < 0 ? turn_left : turn_right
- elsif x_plus.abs < y_plus.abs # 縦の距離のほうが長い
- y_plus < 0 ? turn_up : turn_down
- end
- @x += x_plus
- @y += y_plus
- distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
- @jump_peak = 10 + distance - @move_speed
- @jump_count = @jump_peak * 2
- @stop_count = 0
- straighten
- else #ジャンプ先が通行できないときはジャンプしない。
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 下を向く
- #--------------------------------------------------------------------------
- def turn_down
- set_direction(2)
- end
- #--------------------------------------------------------------------------
- # ● 左を向く
- #--------------------------------------------------------------------------
- def turn_left
- set_direction(4)
- end
- #--------------------------------------------------------------------------
- # ● 右を向く
- #--------------------------------------------------------------------------
- def turn_right
- set_direction(6)
- end
- #--------------------------------------------------------------------------
- # ● 上を向く
- #--------------------------------------------------------------------------
- def turn_up
- set_direction(8)
- end
- #--------------------------------------------------------------------------
- # ● 右に 90 度回転
- #--------------------------------------------------------------------------
- def turn_right_90
- case @direction
- when 2; turn_left
- when 4; turn_up
- when 6; turn_down
- when 8; turn_right
- end
- end
- #--------------------------------------------------------------------------
- # ● 左に 90 度回転
- #--------------------------------------------------------------------------
- def turn_left_90
- case @direction
- when 2; turn_right
- when 4; turn_down
- when 6; turn_up
- when 8; turn_left
- end
- end
- #--------------------------------------------------------------------------
- # ● 180 度回転
- #--------------------------------------------------------------------------
- def turn_180
- case @direction
- when 2; turn_up
- when 4; turn_right
- when 6; turn_left
- when 8; turn_down
- end
- end
- #--------------------------------------------------------------------------
- # ● 右か左に 90 度回転
- #--------------------------------------------------------------------------
- def turn_right_or_left_90
- case rand(2)
- when 0; turn_right_90
- when 1; turn_left_90
- end
- end
- #--------------------------------------------------------------------------
- # ● ランダムに方向転換
- #--------------------------------------------------------------------------
- def turn_random
- case rand(4)
- when 0; turn_up
- when 1; turn_right
- when 2; turn_left
- when 3; turn_down
- end
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーの方を向く
- #--------------------------------------------------------------------------
- def turn_toward_player
- sx = distance_x_from_player
- sy = distance_y_from_player
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? turn_left : turn_right
- else#elsif sx.abs < sy.abs # 縦の距離のほうが長い
- sy > 0 ? turn_up : turn_down
- end
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーの逆を向く
- #--------------------------------------------------------------------------
- def turn_away_from_player
- sx = distance_x_from_player
- sy = distance_y_from_player
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? turn_right : turn_left
- else#elsif sx.abs < sy.abs # 縦の距離のほうが長い
- sy > 0 ? turn_down : turn_up
- end
- end
- #--------------------------------------------------------------------------
- # ● グラフィックの変更
- # character_name : 新しい歩行グラフィック ファイル名
- # character_index : 新しい歩行グラフィック インデックス
- #--------------------------------------------------------------------------
- def set_graphic(character_name, character_index)
- @tile_id = 0
- @character_name = character_name
- @character_index = character_index
- end
- #--------------------------------------------------------------------------
- # ○カスタムスクリプト
- #--------------------------------------------------------------------------
- # ○以下追加定義
- #--------------------------------------------------------------------------
- # ● 移動タイプ : 指定イベントに近づく(ランダム有り)
- # ◆使い方
- # イベントの移動ルート指定からスクリプトで
- #「move_type_toward($game_map.interpreter.get_character(id))」
- #idにはマップイベントのID(数字)を入力する。
- #例:マップイベント3を追いかける
- #move_type_toward($game_map.interpreter.get_character(3))
- #--------------------------------------------------------------------------
- def move_type_toward(character)
- sx = @x - character.x
- sy = @y - character.y
- if sx.abs + sy.abs >= 20
- move_random
- else
- case rand(6)
- when 0..3; move_toward(character)
- when 4; move_random
- when 5; move_forward
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 指定イベントに近づく(ランダム無し)
- # ◆使い方
- # イベントの移動ルート指定からスクリプトで
- #「move_toward($game_map.interpreter.get_character(id))」
- #--------------------------------------------------------------------------
- def move_toward(character)
- sx = distance_x_from(character)
- sy = distance_y_from(character)
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? move_left : move_right # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? move_up : move_down
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? move_up : move_down # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? move_left : move_right
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 指定イベントから遠ざかる
- # ◆使い方
- # イベントの移動ルート指定からスクリプトで
- #「move_away_from($game_map.interpreter.get_character(id))」
- #--------------------------------------------------------------------------
- def move_away_from(character)
- sx = distance_x_from(character)
- sy = distance_y_from(character)
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? move_right : move_left # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? move_down : move_up
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? move_down : move_up # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? move_right : move_left
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 指定イベントからの X 距離計算
- #--------------------------------------------------------------------------
- def distance_x_from(character)
- sx = @x - character.x
- if $game_map.loop_horizontal? # 横にループしているとき
- if sx.abs > $game_map.width / 2 # 絶対値がマップの半分より大きい?
- sx -= $game_map.width # マップの幅を引く
- end
- end
- return sx
- end
- #--------------------------------------------------------------------------
- # ● 指定イベントからの Y 距離計算
- #--------------------------------------------------------------------------
- def distance_y_from(character)
- sy = @y - character.y
- if $game_map.loop_vertical? # 縦にループしているとき
- if sy.abs > $game_map.height / 2 # 絶対値がマップの半分より大きい?
- sy -= $game_map.height # マップの高さを引く
- end
- end
- return sy
- end
- #--------------------------------------------------------------------------
- # ● 指定イベントの方を向く
- # ◆使い方
- # イベントの移動ルート指定からスクリプトで
- #「turn_toward($game_map.interpreter.get_character(id))」
- #--------------------------------------------------------------------------
- def turn_toward(character)
- sx = distance_x_from(character)
- sy = distance_y_from(character)
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? turn_left : turn_right
- else#elsif sx.abs < sy.abs # 縦の距離のほうが長い
- sy > 0 ? turn_up : turn_down
- end
- end
- #--------------------------------------------------------------------------
- # ● 指定イベントの逆を向く
- # ◆使い方
- # イベントの移動ルート指定からスクリプトで
- #「turn_away_from($game_map.interpreter.get_character(id))」
- #--------------------------------------------------------------------------
- def turn_away_from(character)
- sx = distance_x_from(character)
- sy = distance_y_from(character)
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? turn_right : turn_left
- else#elsif sx.abs < sy.abs # 縦の距離のほうが長い
- sy > 0 ? turn_down : turn_up
- end
- end
- #=====================================
- #--------------------------------------------------------------------------
- # ● 下に移動(失敗したらスイッチON)
- # turn_ok : その場での向き変更を許可
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #move_down_sw;@switch_no=n #nはONにしたいスイッチの番号
- #--------------------------------------------------------------------------
- def move_down_sw(turn_ok = true)
- if passable?(@x, @y+1) # 通行可能
- turn_down
- @y = $game_map.round_y(@y+1)
- @real_y = (@y-1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_down if turn_ok
- check_event_trigger_touch(@x, @y+1) # 接触イベントの起動判定
- $game_switches[@switch_no] = true #移動できない場合は指定のスイッチをON!
- $game_map.need_refresh = true
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 左に移動(失敗したらスイッチON)
- # turn_ok : その場での向き変更を許可
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #move_left_sw;@switch_no=n #nはONにしたいスイッチの番号
- #--------------------------------------------------------------------------
- def move_left_sw(turn_ok = true)
- if passable?(@x-1, @y) # 通行可能
- turn_left
- @x = $game_map.round_x(@x-1)
- @real_x = (@x+1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_left if turn_ok
- check_event_trigger_touch(@x-1, @y) # 接触イベントの起動判定
- $game_switches[@switch_no] = true #移動できない場合は指定のスイッチをON!
- $game_map.need_refresh = true
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 右に移動(失敗したらスイッチON)
- # turn_ok : その場での向き変更を許可
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #move_right_sw;@switch_no=n #nはONにしたいスイッチの番号
- #--------------------------------------------------------------------------
- def move_right_sw(turn_ok = true)
- if passable?(@x+1, @y) # 通行可能
- turn_right
- @x = $game_map.round_x(@x+1)
- @real_x = (@x-1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_right if turn_ok
- check_event_trigger_touch(@x+1, @y) # 接触イベントの起動判定
- $game_switches[@switch_no] = true #移動できない場合は指定のスイッチをON!
- $game_map.need_refresh = true
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 上に移動(失敗したらスイッチON)
- # turn_ok : その場での向き変更を許可
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #move_up_sw;@switch_no=n #nはONにしたいスイッチの番号
- #--------------------------------------------------------------------------
- def move_up_sw(turn_ok = true)
- if passable?(@x, @y-1) # 通行可能
- turn_up
- @y = $game_map.round_y(@y-1)
- @real_y = (@y+1)*256
- increase_steps
- @move_failed = false
- else # 通行不可能
- turn_up if turn_ok
- check_event_trigger_touch(@x, @y-1) # 接触イベントの起動判定
- $game_map.need_refresh = true
- $game_switches[@switch_no] = true #移動できない場合は指定のスイッチをON!
- @move_failed = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 一歩前進(失敗したらスイッチON)
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #「move_forward_sw(switch_no) #switch_noはONにしたいスイッチの番号」
- #例:move_forward_sw(1)
- #--------------------------------------------------------------------------
- def move_forward_sw(switch_no)
- @switch_no = switch_no
- case @direction
- when 2; move_down_sw(false)
- when 4; move_left_sw(false)
- when 6; move_right_sw(false)
- when 8; move_up_sw(false)
- end
- end
- #--------------------------------------------------------------------------
- # ● 指定のマスだけ前にジャンプ
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #「jump_forward(dis_plus) #dis_plusは進みたいマスの数を入れます。
- #マイナスにすると後ろへジャンプします」
- #例:jump_forward(1) 何も書かないとエラーになります。
- #--------------------------------------------------------------------------
- def jump_forward(dis_plus)
- case @direction
- when 2; jump(0,dis_plus)
- when 4; jump(-dis_plus,0)
- when 6; jump(dis_plus,0)
- when 8; jump(0,-dis_plus)
- end
- end
- #--------------------------------------------------------------------------
- # ● 指定のマスだけ前にジャンプ、左右補正機能付き
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #「jump_forward_ex(dis_plus,dir_plus) #dis_puls前に移動#dir_plus左右の補正
- #dis_plusは進みたいマスの数を入れます。
- #dir_pulsは左右の補正です。正の数にすると、キャラクターから見て右側に
- #負の数にすると、キャラクターから見て左側へ補正が加わります。
- #--------------------------------------------------------------------------
- #マイナスにすると後ろへジャンプします」
- #例:jump_forward_ex(1,1) 何も書かないとエラーになります。
- #キャラクターから見て、前方向へ1マス。右方向へ1マス。
- #つまり、キャラクターから見て右斜め前にジャンプします。
- #--------------------------------------------------------------------------
- def jump_forward_ex(dis_plus,dir_plus)
- case @direction
- when 2; jump(-dir_plus,dis_plus) #下
- when 4; jump(-dis_plus,-dir_plus) #左
- when 6; jump(dis_plus,dir_plus) #右
- when 8; jump(dir_plus,-dis_plus) #上
- end
- end
- #--------------------------------------------------------------------------
- # ● ランダムに指定のマスだけジャンプ
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #「jump_random(dis_plus) #ジャンプするマスの数を入れます。」
- # ティンダロスやハンターβの回避行動にどうぞ!
- #例:jump_random(1) #何も書かないと一マスのジャンプになります。
- #--------------------------------------------------------------------------
- def jump_random(dis_plus=1)
- case rand(4)
- when 0; jump(0,dis_plus)
- when 1; jump(-dis_plus,0)
- when 2; jump(dis_plus,0)
- when 3; jump(0,-dis_plus)
- end
- end
- #--------------------------------------------------------------------------
- # ● ジャンプ先に障害物がある場合、そこを避けてジャンプする。
- #◆使い方
- #イベントの移動ルート指定からスクリプトで
- #「jump_avoid(x_plus,y_plus,avo) #avoは避けるマスの数。」
- #例:jump_avoid(3,0,1)
- #--------------------------------------------------------------------------
- def jump_avoid(x_plus,y_plus,avo)
- if passable?(@x + x_plus, @y + y_plus)
- avo = 0 #障害物がない場合は補正は0
- end
- case rand(4)
- when 0; jump(x_plus,y_plus + avo)
- when 1; jump(x_plus - avo,y_plus)
- when 2; jump(x_plus + avo,y_plus)
- when 3; jump(x_plus,y_plus - avo)
- end
- end
- #--------------------------------------------------------------------------
- # ● ジャンプしながらプレイヤーに近づく
- #--------------------------------------------------------------------------
- def jump_toward_player(dis_plus=1)
- sx = distance_x_from_player
- sy = distance_y_from_player
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? jump(-dis_plus,0) : jump(dis_plus,0) # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? jump(0,-dis_plus) : jump(0,dis_plus)
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? jump(0,-dis_plus) : jump(0,dis_plus) # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? jump(-dis_plus,0) : jump(dis_plus,0)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ジャンプしながらプレイヤーから遠ざかる
- #--------------------------------------------------------------------------
- def jump_away_from_player(dis_plus=1)
- sx = distance_x_from_player
- sy = distance_y_from_player
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? jump(dis_plus,0) : jump(-dis_plus,0) # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? jump(0,dis_plus) : jump(0,-dis_plus)
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? jump(0,dis_plus) : jump(0,-dis_plus) # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? jump(dis_plus,0) : jump(-dis_plus,0)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ジャンプしながら指定イベントに近づく
- # イベントの移動ルート指定からスクリプトで
- #「jump_toward($game_map.interpreter.get_character(id))(dis_plus=1)」
- #--------------------------------------------------------------------------
- def jump_toward(character)(dis_plus=1)
- sx = distance_x_from(character)
- sy = distance_y_from(character)
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? jump(-dis_plus,0) : jump(dis_plus,0) # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? jump(0,-dis_plus) : jump(0,dis_plus)
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? jump(0,-dis_plus) : jump(0,dis_plus) # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? jump(-dis_plus,0) : jump(dis_plus,0)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ジャンプしながら指定イベントから遠ざかる
- # イベントの移動ルート指定からスクリプトで
- #「jump_away_from($game_map.interpreter.get_character(id))(dis_plus=1)」
- #--------------------------------------------------------------------------
- def jump_away_from(character)(dis_plus=1)
- sx = distance_x_from(character)
- sy = distance_y_from(character)
- if sx != 0 or sy != 0
- if sx.abs > sy.abs # 横の距離のほうが長い
- sx > 0 ? jump(dis_plus,0) : jump(-dis_plus,0) # 左右方向を優先
- if @move_failed and sy != 0
- sy > 0 ? jump(0,dis_plus) : jump(0,-dis_plus)
- end
- else # 縦の距離のほうが長いか等しい
- sy > 0 ? jump(0,dis_plus) : jump(0,-dis_plus) # 上下方向を優先
- if @move_failed and sx != 0
- sx > 0 ? jump(dis_plus,0) : jump(-dis_plus,0)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 変数の操作
- # 変数に値を代入
- # sub_value(id,value)#sub_(変数のID,代入される値)
- #--------------------------------------------------------------------------
- def sub_value(id,value)
- if id == nil
- print("sub_valueが正しく指定されていません")
- exit
- end
- if value == nil
- print("sub_valueが正しく指定されていません")
- exit
- end
- $game_variables[id] = value
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● ツクール2000仕様のウェイトです。
- #wait_200x(数値) ウェイトする時間は数値×0.1秒で計算されます。
- #()を省略したり、0を入力したりするとウェイト0.0になります。
- #必ず数字を入力してください。文字を代入するとエラーになります。
- #--------------------------------------------------------------------------
- def wait_200x(count=0)
- n = count * 6
- if n < 0
- n = 0
- end
- if n == 0
- @wait_count = 1
- end
- return @wait_count = n
- end
- #--------------------------------------------------------------------------
- # ● ウェイトデラックス
- #wait_dx(数値)
- #ウェイトする時間を999以上指定出来ます。変数で指定することも可能です。
- #wait_dx(value,use_variables=true/false)
- #--------------------------------------------------------------------------
- def wait_dx(n,use_variables = false)
- if n < 0
- print("スクリプトwait_dxの参照している値が正しくありません!")
- exit
- else
- if use_variables == true and n > 5000
- print("参照するツクール変数のIDが最大値の5000を超えています!")
- exit
- end
- end
- if use_variables == true
- #trueのとき、n番目のツクールの変数の値だけウェイト
- @wait_count = $game_variables[n]
- else
- #falseのとき、nの値だけウェイト
- @wait_count = n
- end
- return true
- end
- end
复制代码 第十三个:- #==============================================================================
- # ■ Game_Interpreter(分割定義)
- #------------------------------------------------------------------------------
- # イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
- # Game_Troop クラス、Game_Event クラスの内部で使用されます。
- #==============================================================================
- class Game_Interpreter
- #■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
- # ゲーム進行 =
- #□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□
- #============================================================================
- # ◆ スクリプト:スクリプトで使用 ◆
- #============================================================================
- #--------------------------------------------------------------------------
- # ● 変数の操作(カスタム)
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- # ● プレイヤーのX座標を取得
- #--------------------------------------------------------------------------
- def get_player_x(variable_id = 0)
- character = get_character(-1) #-1はプレイヤーを意味する。
- if variable_id > 0
- $game_variables[variable_id] = character.x
- end
- return character.x
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーのY座標を取得
- #--------------------------------------------------------------------------
- def get_player_y(variable_id = 0)
- character = get_character(-1) #-1はプレイヤーを意味する。
- if variable_id > 0
- $game_variables[variable_id] = character.y
- end
- return character.y
- end
- #--------------------------------------------------------------------------
- # ● このイベントのX座標を取得
- #--------------------------------------------------------------------------
- def get_this_event_x(variable_id = 0)
- character = get_character(0) #0はこのイベントを意味する。
- if variable_id > 0
- $game_variables[variable_id] = character.x
- end
- return character.x
- end
- #--------------------------------------------------------------------------
- # ● このイベントのY座標を取得
- #--------------------------------------------------------------------------
- def get_this_event_y(variable_id = 0)
- character = get_character(0) #0はこのイベントを意味する。
- if variable_id > 0
- $game_variables[variable_id] = character.y
- end
- return character.y
- end
- #--------------------------------------------------------------------------
- # ● 特定の名前を含むイベントのX座標を取得
- #--------------------------------------------------------------------------
- def get_name_event_x(name = "",variable_id = 0)
- event_id = 0
- # 該当するイベントを検索
- events = $game_map.events.values.find_all { |e| e.x == x && e.y == y }
- event_id = (events.max { |a, b| a.id <=> b.id }).id unless events.empty?
- character = get_character(event_id)
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = character.x
- $game_map.need_refresh = true
- end
- return character.x
- end
- #--------------------------------------------------------------------------
- # ● 特定の名前を含むイベントのY座標を取得
- #--------------------------------------------------------------------------
- def get_name_event_y(name = "",variable_id = 0)
- event_id = 0
- # 該当するイベントを検索
- events = $game_map.events.values.find_all { |e| e.x == x && e.y == y }
- event_id = (events.max { |a, b| a.id <=> b.id }).id unless events.empty?
- character = get_character(event_id)
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = character.y
- end
- return character.y
- end
- #--------------------------------------------------------------------------
- # ● スイッチの操作(カスタム)
- #--------------------------------------------------------------------------
- def operate_switches(operate,value,value2=0)
- if value >= value2
- #スイッチ単体操作
- case operate
- when 0
- #operate = 0 #スイッチをOFF
- $game_switches[value] = false
- when 1
- #operate = 1 #スイッチをON
- $game_switches[value] = true
- when 2
- #operate = 2 #ON/OFFを逆転
- $game_switches[value] ^= true #逆転
- end
- else
- #スイッチ一括操作
- case operate
- when 0
- #operate = 0 #スイッチをOFF
- for i in value .. value2 # 一括操作ループ
- $game_switches[i] = false
- end
- when 1
- #operate = 1 #スイッチをON
- for i in value .. value2 # 一括操作ループ
- $game_switches[i] = true
- end
- when 2
- #operate = 2 #ON/OFFを逆転
- for i in value .. value2 # 一括操作ループ
- $game_switches[i] ^= true #逆転
- end
- end
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● スイッチの操作
- #指定IDのスイッチをON
- #--------------------------------------------------------------------------
- def on_switche(switche_id)
- if switche_id != nil
- $game_switches[switche_id] = true
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● スイッチの操作
- #指定IDのスイッチをOFF
- #--------------------------------------------------------------------------
- def off_switche(switche_id)
- if switche_id != nil
- $game_switches[switche_id] = false
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● スイッチの操作
- #指定IDのスイッチのON/OFF逆転
- #--------------------------------------------------------------------------
- def change_switche(switche_id)
- if switche_id != nil
- $game_switches[switche_id] ^= true #スイッチの逆転
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● スイッチの一括操作
- #指定IDのスイッチをON
- #--------------------------------------------------------------------------
- def on_multi_switches(value,value2)
- if value > value2
- sw_id = value2
- sw_id2 = value
- else
- sw_id = value
- sw_id2 = value2
- end
- for i in sw_id .. sw_id2
- $game_switches[i] = true
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● スイッチの一括操作
- #指定IDのスイッチをOFF
- #--------------------------------------------------------------------------
- def off_multi_switches(value,value2)
- if value > value2
- sw_id = value2
- sw_id2 = value
- else
- sw_id = value
- sw_id2 = value2
- end
- for i in sw_id .. sw_id2
- $game_switches[i] = false
- end
- $game_map.need_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● スイッチの一括操作
- #指定IDのスイッチのON/OFF逆転
- #--------------------------------------------------------------------------
- def change_multi_switches(value,value2)
- if value > value2
- sw_id = value2
- sw_id2 = value
- else
- sw_id = value
- sw_id2 = value2
- end
- for i in sw_id .. sw_id2
- $game_switches[i] ^= true
- end
- $game_map.need_refresh = true
- return true
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターのIDを取得
- #--------------------------------------------------------------------------
- def get_top_actor_id(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.id
- end
- return actor.id
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターの武器IDを取得
- #--------------------------------------------------------------------------
- def get_top_actor_weapon_id(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.weapon_id
- end
- return actor.weapon_id
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターの名前を取得
- #アクターの名前は普通は文字列です。変数の操作で代入を除く数の増減などの
- #操作を行うとエラーになるので気をつけましょう。
- #--------------------------------------------------------------------------
- def get_top_actor_name(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.name
- end
- return actor.name
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターのHPを取得
- #--------------------------------------------------------------------------
- def get_top_actor_hp(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.hp
- end
- return actor.hp
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターの最大HPを取得
- #--------------------------------------------------------------------------
- def get_top_actor_maxhp(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.maxhp
- end
- return actor.maxhp
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターのHPの割合(百分率)を取得
- #--------------------------------------------------------------------------
- def get_top_actor_hp_ratio(variable_id = 0)
- actor = $game_party.members[0]
- if actor.maxhp != 0
- hp_ratio = 100 * actor.hp / actor.maxhp
- else
- hp_ratio = 0
- end
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = hp_ratio
- end
- return hp_ratio
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターのMPを取得
- #--------------------------------------------------------------------------
- def get_top_actor_mp(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.mp
- end
- return actor.mp
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターの最大MPを取得
- #--------------------------------------------------------------------------
- def get_top_actor_maxmp(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.maxmp
- end
- return actor.maxmp
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターの攻撃力を取得
- #--------------------------------------------------------------------------
- def get_top_actor_atk(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.atk
- end
- return actor.atk
- end
- #--------------------------------------------------------------------------
- # ● 先頭のアクターの防御力を取得
- #--------------------------------------------------------------------------
- def get_top_actor_def(variable_id = 0)
- actor = $game_party.members[0]
- # 変数に代入
- if variable_id > 0
- $game_variables[variable_id] = actor.def
- end
- return actor.def
- end
- #--------------------------------------------------------------------------
- # ● アイテムの所持数取得
- #--------------------------------------------------------------------------
- def get_item_number(item_id,variable_id = 0)
- if item_id == nil
- print("アイテムIDを指定してください!IDは直接または変数で指定出来ます!")
- exit
- end
- if item_id > $data_items.size
- print("アイテムIDがデータベースで指定した範囲を超えました!")
- exit
- end
- if variable_id > 0
- #変数に代入
- $game_variables[variable_id] = $game_party.item_number($data_items[item_id])
- end
- return $game_party.item_number($data_items[item_id])
- end
- #--------------------------------------------------------------------------
- # ● 武器の所持数取得
- #--------------------------------------------------------------------------
- def get_weapon_number(weapon_id,variable_id = 0)
- if weapon_id == nil
- print("武器IDを指定してください!IDは直接または変数で指定出来ます!")
- exit
- end
- if weapon_id > $data_weapons.size
- print("武器IDがデータベースで指定した範囲を超えました!")
- exit
- end
- if variable_id > 0
- #変数に代入
- $game_variables[variable_id] = $game_party.item_number($data_weapons[weapon_id])
- end
- return $game_party.item_number($data_weapons[weapon_id])
- end
- #--------------------------------------------------------------------------
- # ● 防具の所持数取得
- #--------------------------------------------------------------------------
- def get_armor_number(armor_id,variable_id = 0)
- if armor_id == nil
- print("防具IDを指定してください!IDは直接または変数で指定出来ます!")
- exit
- end
- if armor_id > $data_armors.size
- print("防具IDがデータベースで指定した範囲を超えました!")
- exit
- end
- if variable_id > 0
- #変数に代入
- $game_variables[variable_id] = $game_party.item_number($data_armors[armor_id])
- end
- return $game_party.item_number($data_armors[armor_id])
- end
- #--------------------------------------------------------------------------
- # ● アイテムボックス内のアイテムの所持数取得
- #--------------------------------------------------------------------------
- def get_item_number_in_box(item_id,variable_id = 0)
- if item_id == nil
- print("アイテムIDを指定してください!IDは直接または変数で指定出来ます!")
- exit
- end
- if item_id > $data_items.size
- print("アイテムIDがデータベースで指定した範囲を超えました!")
- exit
- end
- if variable_id > 0
- #変数に代入
- $game_variables[variable_id] = $game_party.keeping_item_number($data_items[item_id])
- end
- return $game_party.keeping_item_number($data_items[item_id])
- end
- #--------------------------------------------------------------------------
- # ● アイテムボックス内の武器の所持数取得
- #--------------------------------------------------------------------------
- def get_weapon_number_in_box(weapon_id,variable_id = 0)
- if weapon_id == nil
- print("武器IDを指定してください!IDは直接または変数で指定出来ます!")
- exit
- end
- if weapon_id > $data_weapons.size
- print("武器IDがデータベースで指定した範囲を超えました!")
- exit
- end
- if variable_id > 0
- #変数に代入
- $game_variables[variable_id] = $game_party.keeping_item_number($data_weapons[weapon_id])
- end
- return $game_party.keeping_item_number($data_weapons[weapon_id])
- end
- #--------------------------------------------------------------------------
- # ● アイテムボックス内の防具の所持数取得
- #--------------------------------------------------------------------------
- def get_armor_number_in_box(armor_id,variable_id = 0)
- if armor_id == nil
- print("防具IDを指定してください!IDは直接または変数で指定出来ます!")
- exit
- end
- if armor_id > $data_armors.size
- print("防具IDがデータベースで指定した範囲を超えました!")
- exit
- end
- if variable_id > 0
- #変数に代入
- $game_variables[variable_id] = $game_party.keeping_item_number($data_armors[armor_id])
- end
- return $game_party.keeping_item_number($data_armors[armor_id])
- end
- #--------------------------------------------------------------------------
- # ● プレイ時間の取得
- #--------------------------------------------------------------------------
- def get_playtime(variable_id1=0,variable_id2=0 ,variable_id3=0)
- total_sec = Graphics.frame_count / Graphics.frame_rate
- # 変数に代入
- if variable_id1 > 0
- #時間
- $game_variables[variable_id1] = total_sec / 60 / 60
- end
- if variable_id2 > 0
- #分
- $game_variables[variable_id2] = total_sec / 60 % 60
- end
- if variable_id3 > 0
- #秒
- $game_variables[variable_id3] = total_sec % 60
- end
- return total_sec
- end
- #--------------------------------------------------------------------------
- # ● タイマーの操作
- #変数指定可能
- #--------------------------------------------------------------------------
- def set_timer(sec = 0)
- if min > 0 # 始動
- $game_system.timer = sec * Graphics.frame_rate
- $game_system.timer_working = true
- end
- if min == 0 # 停止
- $game_system.timer_working = false
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● タイマー表示
- #--------------------------------------------------------------------------
- def timer_appear#タイマーの表示
- $game_system.timer_hide = false #表示
- end
- #--------------------------------------------------------------------------
- # ● タイマー非表示
- #--------------------------------------------------------------------------
- def timer_hide#タイマーの非表示
- $game_system.timer_hide = true #非表示
- end
- #--------------------------------------------------------------------------
- # ● タイマーの一時停止
- #--------------------------------------------------------------------------
- def stop_timer#タイマー一時停止
- $game_system.timer_stop
- end
- #--------------------------------------------------------------------------
- # ● タイマーの再スタート
- #--------------------------------------------------------------------------
- def restart_timer#タイマー再始動
- $game_system.timer_start
- end
- #--------------------------------------------------------------------------
- #■マップ画面でプレイヤーの操作強制無効 RGSS2 DAIpage■と連動
- #--------------------------------------------------------------------------
- # ● プレイヤーロックのON/OFF
- #--------------------------------------------------------------------------
- def player_lock_on_off
- $game_player.player_lock
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーロックのON
- #--------------------------------------------------------------------------
- def player_lock_on#プレイヤーロック開始
- $game_player.player_lock_on#プレイヤーロック開始
- end
- #--------------------------------------------------------------------------
- # ● プレイヤーロックのOFF
- #--------------------------------------------------------------------------
- def player_lock_off#プレイヤーロック終了
- $game_player.player_lock_off#プレイヤーロック終了
- end
- end
复制代码 第十四个: |
|