| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2016-7-27 |
| 在线时间 | 158 小时 |
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 158 小时
- 注册时间
- 2016-1-7
- 回帖
- 102
|
楼主 |
发表于 2016-3-24 01:41:38
|
显示全部楼层
RyanBern 发表于 2016-3-23 08:24 
在这里应该为在当前队伍中角色索引,0表示第一个人,1表示第二个人,以此类推。 ...
我必須要將整個腳本引入專案中嗎?
我原來的意思是直接使用 $game_party.leader = 序號
不過看來leader是腳本新加入的一定要有
因為這是針對vx然而我是使用xp,有一行錯挑一個我也只能勉強錯誤訊息說哪裡有誤去看哪行
勉強改了幾個最後變我原來使用的腳本有問題...
不過也因此看見了新的出路,然而使用後沒有效果(但也沒有跑錯誤訊息)
覺得可以成為新出路的方法依舊是直接事件指令用腳本換:- # 讀取帶頭角色
- actor = $game_party.actors[序號]
- if actor == nil
- return
- end
复制代码 但這並沒有效果

上面的想法出自我原來使用的腳本 86-90行- #==============================================================================
- # ■ Game_Character
- #==============================================================================
- class Game_Character
- attr_accessor :damage_pop # 損傷標誌
- attr_accessor :damage # 損傷值
- attr_accessor :sp_damage # SP損傷值
- attr_accessor :critical # 會心一擊標誌
- attr_accessor :delay_count # delay_count
- attr_accessor :actor_count # actor_count
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- alias arpgdamage initialize
- def initialize
- @damage_pop = false
- @damage = nil
- @sp_damage = nil
- @critical = false
- @delay_count = 0
- @actor_count = 0
- arpgdamage
- end
- #--------------------------------------------------------------------------
- # ● 更新畫面
- #--------------------------------------------------------------------------
- def update
- # 跳躍中、移動中、停止中的分歧
- if jumping?
- update_jump
- elsif moving?
- update_move
- else
- update_stop
- end
- # 動畫計算數值超過最大值的情況下
- # ※最大值等於基本值減去移動速度 * 1 的值
- if @anime_count > 18 - @move_speed * 2
- # 停止動畫為 OFF 並且在停止中的情況下
- if not @step_anime and @stop_count > 0
- # 還原為原來的圖形
- @pattern = @original_pattern
- # 停止動畫為 ON 並且在移動中的情況下
- else
- # 更新圖形
- @pattern = (@pattern + 1) % 4
- end
- # 清除動畫計算數值
- @anime_count = 0
- end
- if @delay_count > 0
- @delay_count -= 1
- end
- if @actor_count > 0
- @actor_count -= 1
- end
- # 等待中的情況下
- if @wait_count > 0
- # 減少等待計算數值
- @wait_count -= 1
- return
- end
- # 強制移動路線的場合
- if @move_route_forcing
- # 自定義移動
- move_type_custom
- return
- end
- # 事件執行待機中並且為鎖定狀態的情況下
- if @starting or lock?
- # 不做規則移動
- return
- end
- # 如果停止計算數值超過了一定的值(由移動頻率算出)
- if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
- # 移動類型分歧
- case @move_type
- when 1 # 隨機
- move_type_random
- when 2 # 接近
- move_type_toward_player
- when 3 # 自定義
- move_type_custom
- end
- end
- # 讀取帶頭角色
- actor = $game_party.actors[0]
- if actor == nil
- return
- end
- # 角色沒死時
- unless actor.dead?
- # 執行ARPG我方事件
- arpg_actor_start
- # ARPG敵事件死亡或不存在參數清除
- if self.is_a?(Game_Event)
- unless self.arpg_enemy?
- @delay_count = 0 if @delay_count != 0
- @actor_count = 0 if @actor_count != 0
- @attack_mode = [false,0] if @attack_mode != [false,0]
- end
- # 執行ARPG敵人事件
- arpg_event_start
- end
- # 角色死亡時gameover
- else
- $game_temp.gameover = true
- end
- end
- #-------------------------------------------------------------------
- # ● 執行ARPG我方事件
- #---------------------------------------------------------------------
- def arpg_actor_start
- # 寫入角色
- actor = $game_party.actors[0]
- # 進行角色的狀態自然解除
- if self.is_a?(Game_Player)
- if Graphics.frame_count % 20 == 0
- actor.remove_states_auto
- end
- end
- # 事件執行中與角色不存在就強制返回
- if $game_system.map_interpreter.running? or actor == nil
- return
- end
- # 角色延遲計數>0強制返回
- if @actor_count > 0
- return
- end
- # 角色無法行動時
- if actor.restriction == 4
- return
- end
- # 角色混亂時
- if actor.restriction == 2 or actor.restriction == 3
- # 目標是我方時
- if self.is_a?(Game_Player)
- # 我方普攻我方
- actor.arpg_attack_effect(actor,self)
- end
- return
- end
- # 參數初始
- sx = $game_player.x
- sy = $game_player.y
- skill_id = 0
- item_id = 0
- type = actor.attack_type
- range = actor.attack_range
- push_check = false
- start_check = false
- # 按C鍵時(普攻)
- if Input.press?(Input::C)
- push_check = true
- end
- # 開關2開啟時
- if $game_switches[2]
- # 按1鍵時(技能1=變數1的值)與還沒按鈕時
- if Kboard.press?($R_Key_1) && ! push_check
- if actor.arpg_skill_can_use?($game_variables[1])
- skill_id = $game_variables[1]
- push_check = true
- end
- end
- # 按2鍵時(技能2=變數2的值)與還沒按鈕時
- if Kboard.press?($R_Key_2) && ! push_check
- if actor.arpg_skill_can_use?($game_variables[2])
- skill_id = $game_variables[2]
- push_check = true
- end
- end
- # 按3鍵時(技能3=變數3的值)與還沒按鈕時
- if Kboard.press?($R_Key_3) && ! push_check
- if actor.arpg_skill_can_use?($game_variables[3])
- skill_id = $game_variables[3]
- push_check = true
- end
- end
- # 按4鍵時(技能4=變數4的值)與還沒按鈕時
- if Kboard.press?($R_Key_4) && ! push_check
- if actor.arpg_skill_can_use?($game_variables[4])
- skill_id = $game_variables[4]
- push_check = true
- end
- end
- end
- # 使用技能的情況
- if skill_id != 0
- # 寫入技能對象
- scope = $data_skills[skill_id].scope
- # 技能是對我方
- if scope >= 3
- # 目標是我方時
- if self.is_a?(Game_Player)
- # 對我方使用技能
- actor.arpg_skill_effect(actor,$data_skills[skill_id],self)
- end
- return
- end
- type = $data_skills[skill_id].type
- range = $data_skills[skill_id].range
- end
- # 開關3開啟與目標是我方時
- if $game_switches[3] && self.is_a?(Game_Player)
- # 按Q鍵時(道具1=變數5的值)與還沒按鈕時
- if Kboard.press?($R_Key_Q) && ! push_check
- if $game_party.arpg_item_can_use?($game_variables[5])
- item_id = $game_variables[5]
- push_check = true
- end
- end
- # 按W鍵時(道具2=變數6的值)與還沒按鈕時
- if Kboard.press?($R_Key_W) && ! push_check
- if $game_party.arpg_item_can_use?($game_variables[6])
- item_id = $game_variables[6]
- push_check = true
- end
- end
- # 按E鍵時(道具3=變數7的值)與還沒按鈕時
- if Kboard.press?($R_Key_E) && ! push_check
- if $game_party.arpg_item_can_use?($game_variables[7])
- item_id = $game_variables[7]
- push_check = true
- end
- end
- # 按R鍵時(道具4=變數8的值)與還沒按鈕時
- if Kboard.press?($R_Key_R) && ! push_check
- if $game_party.arpg_item_can_use?($game_variables[8])
- item_id = $game_variables[8]
- push_check = true
- end
- end
- # 能使用道具的情況
- if $game_party.arpg_item_can_use?(item_id)
- # 我方使用道具
- actor.arpg_item_effect($data_items[item_id])
- return
- end
- end
- # 目標是我方與不是敵人就強制返回
- if self.is_a?(Game_Player) or ! self.arpg_enemy?
- return
- end
- # 定義敵人
- enemy = self.enemy
- # 按下按鈕時
- if push_check
- # 直線判斷
- if type == 0
- for i in 0..range
- case $game_player.direction
- when 2 # 向下
- if @x == sx && @y == sy + i
- if self.list != nil
- start_check = true
- break
- end
- end
- when 4 # 向左
- if @x == sx - i && @y == sy
- if self.list != nil
- start_check = true
- break
- end
- end
- when 6 # 向右
- if @x == sx + i && @y == sy
- if self.list != nil
- start_check = true
- break
- end
- end
- when 8 # 向上
- if @x == sx && @y == sy - i
- if self.list != nil
- start_check = true
- break
- end
- end
- end
- end
- end
- # 矩形判斷
- if type == 1
- # 製作矩陣資料
- data = []
- w = range
- h = range*2
- for i in 0..h
- for j in 0..h
- data.push([(sx-w)+i,(sy-w)+j])
- end
- end
- # 敵人座標在矩陣資料內時
- if data.include?([@x,@y])
- if self.list != nil
- start_check = true
- end
- end
- end
- # 功擊成立時
- if start_check
- # 普攻時
- if skill_id == 0
- # 執行普攻敵方
- enemy.arpg_attack_effect(actor,self)
- # 技能時
- else
- # 執行技能攻擊敵方
- enemy.arpg_skill_effect(actor,$data_skills[skill_id],self)
- end
- end
- end
- end
- #-------------------------------------------------------------------
- # ● 執行ARPG敵人事件
- #---------------------------------------------------------------------
- def arpg_event_start
- # 事件執行中的情況下
- if $game_system.map_interpreter.running?
- return
- end
- # 不是敵人就強制返回
- unless self.arpg_enemy?
- return
- end
- # 定義敵人
- enemy = self.enemy
- # 進行敵人的狀態自然解除
- if Graphics.frame_count % 20 == 0
- enemy.remove_states_auto
- end
- # 延遲計數>0強制返回
- if @delay_count > 0
- return
- end
- # 寫入角色
- actor = $game_party.actors[0]
- # 敵人或角色不存在強制返回
- if enemy == nil or actor == nil
- return
- end
- # 敵人無法行動時強制返回
- if enemy.restriction == 4
- return
- end
- # 敵人移動模式選擇
- p_range = $game_variables[ENEMYRANGE]
- p1_range = (@x-$game_player.x).abs+(@y-$game_player.y).abs
- @move_type = @page.move_type
- # 如果停止計算數值超過了一定的值(由移動頻率算出)
- if @stop_count > (40 - 6 * 2) * (6 - 6)
- # 判斷主角在偵查範圍內
- if p1_range <= p_range
- # 向主角移動
- move_toward_player
- @move_type = 0
- end
- end
- # 生成敵人行動
- enemy.make_action(enemy.turn)
- enemy.turn += 1
- # 初始化參數
- range = 1
- sx = $game_player.x
- sy = $game_player.y
- skill_id = 0
- type = enemy.attack_type
- range = enemy.attack_range
- scope = 1
- start_check = false
- # 檢查敵人行動條件
- case enemy.current_action.kind
- when 1 # 技能
- skill_id = enemy.current_action.skill_id
- # 不能使用技能的情況就將skill_id設為0
- unless enemy.arpg_skill_can_use?(skill_id)
- skill_id = 0
- end
- end
- # 使用技能的情況
- if skill_id != 0
- # 寫入技能對象
- scope = $data_skills[skill_id].scope
- # 技能是攻擊型
- if scope < 3
- # 敵方沒有混亂時
- if enemy.restriction != 2 && enemy.restriction != 3
- type = $data_skills[skill_id].type
- range = $data_skills[skill_id].range
- # 敵方混亂時
- else
- # 敵人對自己使用技能
- enemy.arpg_skill_effect(enemy,$data_skills[skill_id],self)
- return
- end
- # 技能是回復輔助型
- else
- ko = false
- # 讀取技能附加狀態
- p_atates = $data_skills[skill_id].plus_state_set
- # 檢查敵人是否已擁有附加狀態?
- for i in p_atates
- unless enemy.states.include?(i)
- ko = true
- break
- end
- end
- # 敵人沒有技能要附加的狀態
- if ko
- # 敵人對自己使用技能
- enemy.arpg_skill_effect(enemy,$data_skills[skill_id],self)
- return
- # 敵人狀態已附加
- else
- # 敵人有少血
- if enemy.hp < enemy.maxhp
- # 敵人對自己使用技能
- enemy.arpg_skill_effect(enemy,$data_skills[skill_id],self)
- end
- return
- end
- end
- end
- # 直線判斷
- if type == 0
- for i in 0..range
- case @direction
- when 2 # 向下
- if sx == @x && sy == @y + i
- if self.list != nil
- start_check = true
- break
- end
- end
- when 4 # 向左
- if sx == @x - i && sy == @y
- if self.list != nil
- start_check = true
- break
- end
- end
- when 6 # 向右
- if sx == @x + i && sy == @y
- if self.list != nil
- start_check = true
- break
- end
- end
- when 8 # 向上
- if sx == @x && sy == @y - i
- if self.list != nil
- start_check = true
- break
- end
- end
- end
- end
- end
- # 矩形判斷
- if type == 1
- # 製作矩陣資料
- data = []
- w = range
- h = range*2
- for i in 0..h
- for j in 0..h
- data.push([(@x-w)+i,(@y-w)+j])
- end
- end
- # 我方座標在矩陣資料內時
- if data.include?([sx,sy])
- if self.list != nil
- start_check = true
- end
- end
- end
- # 確認行動時
- if start_check
- # 普攻時
- if skill_id == 0
- # 執行普攻我方
- actor.arpg_attack_effect(enemy,self)
- # 技能時
- else
- # 執行技能攻擊我方
- actor.arpg_skill_effect(enemy,$data_skills[skill_id],self)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ARPG敵人的判斷
- #--------------------------------------------------------------------------
- def arpg_enemy?
- if self.is_a?(Game_Event)
- if self.enemy != nil
- if self.enemy.hp > 0
- return true
- end
- end
- end
- return false
- end
- end
复制代码 |
|