查看: 2263|回复: 3

[已经解决] 战斗显示图片的问题

[复制链接]
梦石
0
星屑
723
在线时间
530 小时
注册时间
2010-6-9
回帖
668
发表于 2015-4-22 15:16:17 | 显示全部楼层 |阅读模式

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

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

×
战斗部分(技能伤害部分)因为父类不一样,导致如下:
[pre lang="ruby"]        def draw_window_backg
                windowbg = Cache.picture("/windowbg")
                src_rect = Rect.new(0,0,windowbg.width ,windowbg.height)
                contents.blt(0, 0, windowbg, src_rect,125)
        end[/pre]

想要显示的图片显示不了,应该如何调用或绘制?或处理?(错误提示找不到contents这个变量或方法)
求解!

无限の剣制

梦石
0
星屑
10450
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2015-4-22 15:25:35 | 显示全部楼层
窗口类 Window_Base 及其子类的才有 contents ,
你改的部分大概是用精灵显示的,你大概是得对这个精灵的 bitmap 进行 blt

点评

……其实公式能解决绝大部分的技能伤害了……插入一个公共事件之后还可以通过变量处理更多的效果……没必要舍近求远了啊……  发表于 2015-4-23 06:06
感谢提供方法,但不想在公共事件上做,因为我技能伤害管理基本都在脚本里处理了。  发表于 2015-4-22 23:39
判定成立-公共事件显示图片并且强制执行某技能-造成伤害……这个套路应该不难吧……  发表于 2015-4-22 19:16
计划是技能判定成立后先一图片,剩余的都好处理。  发表于 2015-4-22 16:07
我改的部分父类是Window_Selectable,但技能部分Game_BattlerBase,应该怎么弄?  发表于 2015-4-22 16:06
回复

使用道具 举报

梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2015-4-22 21:25:55 | 显示全部楼层
从函数名上看,draw_window_backg,绘制窗口背景图片吗?如果是这样,你可以把这段放在window里啊

点评

有现成的脚本,但没有根据使用的技能ID进行判断显示对应的图片。  发表于 2015-4-24 10:28
如果你是为了释放技能前显示这张图片,然后图片消失后再播放技能动画的话,有现成的脚本……  发表于 2015-4-23 17:55
这样请问能完成战斗时释放技能前先显示这张图片吗?  发表于 2015-4-23 15:24
放window类里,在Scene类调用window时,也就是xxx = window.new时,就调用了。技能图片是啥?图标?  发表于 2015-4-23 10:36
放WINDOW类里,请教如何在战斗中调用(这就是问题核心),其实我是想做技能图片。函数名没改  发表于 2015-4-22 23:36
回复

使用道具 举报

卑微的梦

梦石
0
星屑
547
在线时间
820 小时
注册时间
2013-2-23
回帖
1121

短篇九勇士组季军

发表于 2015-4-23 23:28:56 来自手机 | 显示全部楼层
本帖最后由 子弹君 于 2015-4-27 19:11 编辑

技能前置公共事件
【技能效果触发之前预约一个公共事件】
=================================
待编辑 (目前手机状态)
使用方法:在技能备注上填上[コモン呼出 = 20],这样就是技能前置一个20号公共事件
[pre lang="ruby"]#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
#                   ◆ コモンイベント呼出し ver2.03 ◆ VX Ace ◆
#                                                     by Oz
#------------------------------------------------------------------------------
#  スキル発動前にコモンイベントを呼び出します。スキルの詠唱イベントとかに
# 使えると思います。スキルのメモに
# [コモン呼出(call commonでもok) コモンイベントID]
# と記述するとスキル使用前にコモンイベントIDを実行します。
# イベントのスクリプトで使用者のユニット、使用者、スキルを取得したい場合は、
# 以下のメソッドをイベントのスクリプトで呼び出すことで取得できます。
# user_unit_in_battle  →  使用者が味方ならtrue、敵ならfalse
# user_in_battle      → スキル発動したキャラのIDです。
# use_skill_in_battle  →  発動するスキルIDです。
# よくわかんない人用にDBの変数に入れることもできます。使わない場合 nil に
# にしてください。
# 戦闘中以外に呼び出した場合、0を返します。(使用者のユニットはtrueを返します。)
# 戦闘前、勝利時、敗北時、逃走時にコモンイベントを呼び出せるようにしました。
# 0を指定するとコモンイベントは呼び出ししません。
# Call_Common_Event.phase で戦闘開始前、勝利時、敗北時、逃走時を取得できます。
#==============================================================================

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["Call_Common_Event"] = true

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ★ 設定項目 Call Common Event ★
#==============================================================================

module Call_Common_Event
  #スキル発動者のユニット用変数(0:敵、1:味方)
  User_Unit_Variable_ID = nil
  #スキル発動者用変数
  User_Variable_ID = nil
  #スキル用変数
  Use_Skill_Variable_ID = nil
  #戦闘前
  Standby_Event_ID = 0
  #戦闘勝利時
  Won_Event_ID = 0
  #戦闘敗北時
  Defeat_Event_ID = 0
  #戦闘逃走時
  Escaped_Event_ID = 0
end

#==============================================================================
# ★ 設定項目 Call Common Event ★
#==============================================================================

module Call_Common_Event_System_Word
  Call_Common_Event = /\[(?:コモン呼出|call\s*common)\s*[==]\s*(\d+)\]/i
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ RPG::Item
#==============================================================================

class RPG::UsableItem
  #------------------------------------------------------------------------
  # ○ キャッシュを生成
  #------------------------------------------------------------------------
  def create_call_common_event_cache
    @call_common_event = false
    @call_common_event_id = 0
    self.note.each_line{|line|
      case line
      when Call_Common_Event_System_Word::Call_Common_Event
        @call_common_event = true
        @call_common_event_id = $1.to_i
      end
    }
  end
  #------------------------------------------------------------------------
  # ○ コモン呼出?
  #------------------------------------------------------------------------
  def call_common_event?
    create_call_common_event_cache if @call_common_event.nil?
    return @call_common_event
  end
  #------------------------------------------------------------------------
  # ○ コモン呼出ID
  #------------------------------------------------------------------------
  def call_common_event_id
    create_call_common_event_cache unless @call_common_event_id
    return @call_common_event_id
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Call Common Event
#==============================================================================

module Call_Common_Event
  #--------------------------------------------------------------------------
  # ● メンバ変数の初期化
  #--------------------------------------------------------------------------
  def self.initialize(proc = nil)
    @user_unit = true
    @user = 0
    @use_skill = 0
    @call_event_proc = proc
    @phase = :standby
    clear_last_battler
  end
  #--------------------------------------------------------------------------
  # ● ユニット
  #--------------------------------------------------------------------------
  def self.user_unit
    initialize if @user_unit.nil?
    return @user_unit
  end
  #--------------------------------------------------------------------------
  # ● 発動者
  #--------------------------------------------------------------------------
  def self.user
    initialize unless @user   
    return @user
  end
  #--------------------------------------------------------------------------
  # ● スキル
  #--------------------------------------------------------------------------
  def self.use_skill
    initialize unless @use_skill
    return @use_skill
  end
  #--------------------------------------------------------------------------
  # ● フェイズ
  #--------------------------------------------------------------------------
  def self.phase
    initialize unless @phase
    return @phase
  end
  #--------------------------------------------------------------------------
  # ● ユニット
  #--------------------------------------------------------------------------
  def self.user_unit=(user_unit)
    @user_unit = user_unit
    self.user_unit_variable = user_unit
  end
  #--------------------------------------------------------------------------
  # ● 発動者
  #--------------------------------------------------------------------------
  def self.user=(user)
    @user = user
    self.user_variable = user
  end
  #--------------------------------------------------------------------------
  # ● スキル
  #--------------------------------------------------------------------------
  def self.use_skill=(skill)
    @use_skill = skill
    self.use_skill_variable = skill
  end
  #--------------------------------------------------------------------------
  # ● ユニット変数
  #--------------------------------------------------------------------------
  def self.user_unit_variable=(value)
    return unless User_Unit_Variable_ID
    $game_variables[User_Unit_Variable_ID] = value ? 1 : 0
  end
  #--------------------------------------------------------------------------
  # ● 発動者変数
  #--------------------------------------------------------------------------
  def self.user_variable=(value)
    return unless User_Variable_ID
    $game_variables[User_Variable_ID] = value
  end
  #--------------------------------------------------------------------------
  # ● 発動スキル変数
  #--------------------------------------------------------------------------
  def self.use_skill_variable=(value)
    return unless Use_Skill_Variable_ID
    $game_variables[Use_Skill_Variable_ID] = value
  end
  #--------------------------------------------------------------------------
  # ● 戦闘開始前
  #--------------------------------------------------------------------------
  def self.standby?
    @phase == :standby
  end
  #--------------------------------------------------------------------------
  # ● 勝利後
  #--------------------------------------------------------------------------
  def self.won?
    @phase == :won
  end
  #--------------------------------------------------------------------------
  # ● 敗北後
  #--------------------------------------------------------------------------
  def self.defeat?
    @phase == :defeat
  end
  #--------------------------------------------------------------------------
  # ● 逃走中
  #--------------------------------------------------------------------------
  def self.escaped?
    @phase == :escaped
  end
  #--------------------------------------------------------------------------
  # ● 開始前
  #--------------------------------------------------------------------------
  def self.call_standby_event
    return unless Standby_Event_ID > 0
    @phase = :standby
    @call_event_proc.call(Standby_Event_ID) if @call_event_proc
  end
  #--------------------------------------------------------------------------
  # ● 勝利時
  #--------------------------------------------------------------------------
  def self.call_won_event
    return unless Won_Event_ID > 0
    @phase = :won
    @call_event_proc.call(Won_Event_ID) if @call_event_proc
  end
  #--------------------------------------------------------------------------
  # ● 敗北時
  #--------------------------------------------------------------------------
  def self.call_defeat_event
    return unless Defeat_Event_ID > 0
    @phase = :defeat
    @call_event_proc.call(Defeat_Event_ID) if @call_event_proc
  end
  #--------------------------------------------------------------------------
  # ● 逃走時
  #--------------------------------------------------------------------------
  def self.call_escaped_event
    return unless Escaped_Event_ID > 0
    @phase = :escaped
    @call_event_proc.call(Escaped_Event_ID) if @call_event_proc
  end
  #--------------------------------------------------------------------------
  # ● 最後の行動者
  #--------------------------------------------------------------------------
  def self.last_battler=(battler)
    @last_battler = battler
  end
  #--------------------------------------------------------------------------
  # ● アクター:ランダム
  #--------------------------------------------------------------------------
  def self.actor_randam
    members = $game_party.alive_members
    actor = members[rand * members.size]
    return actor ? actor.id : 0
  end
  #--------------------------------------------------------------------------
  # ● アクター:最後の行動者
  #--------------------------------------------------------------------------
  def self.last_actor
    return 0 if @last_battler.nil? || @last_battler.enemy?
    return @last_battler.actor.id
  end
  #--------------------------------------------------------------------------
  # ● エネミー:最後の行動者
  #--------------------------------------------------------------------------
  def self.last_enemy
    return 0 if @last_battler.nil? || @last_battler.actor?
    return @last_battler.enemy.id
  end
  #--------------------------------------------------------------------------
  # ● 最後の行動者:クリアー
  #--------------------------------------------------------------------------
  def self.clear_last_battler
    @last_battler = nil
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
#  戦闘の進行を管理するモジュールです。
#==============================================================================

class << BattleManager
  #--------------------------------------------------------------------------
  # ● 戦闘開始
  #--------------------------------------------------------------------------
  alias call_common_event_battle_start battle_start
  def battle_start
    call_common_event_battle_start
    Call_Common_Event.call_standby_event
  end
  #--------------------------------------------------------------------------
  # ● 勝利の処理
  #--------------------------------------------------------------------------
  alias call_common_event_process_victory process_victory
  def process_victory
    return if Call_Common_Event.won?
    Call_Common_Event.call_won_event
    call_common_event_process_victory   
  end
  #--------------------------------------------------------------------------
  # ● 中断の処理
  #--------------------------------------------------------------------------
  alias call_common_event_process_abort process_abort
  def process_abort
    return if Call_Common_Event.escaped?
    Call_Common_Event.call_escaped_event
    call_common_event_process_abort
  end
  #--------------------------------------------------------------------------
  # ● 敗北の処理
  #--------------------------------------------------------------------------
  alias call_common_event_process_defeat process_defeat
  def process_defeat
    return if Call_Common_Event.defeat?
    Call_Common_Event.call_defeat_event
    call_common_event_process_defeat
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ? Command
#==============================================================================

module Commands
  module_function
  #--------------------------------------------------------------------------
  # ● ユーザのユニット
  #--------------------------------------------------------------------------
  def user_unit_in_battle
    return true unless $game_party.in_battle
    Call_Common_Event.user_unit
  end
  #--------------------------------------------------------------------------
  # ● ユーザ
  #--------------------------------------------------------------------------
  def user_in_battle
    return 0 unless $game_party.in_battle
    Call_Common_Event.user
  end
  #--------------------------------------------------------------------------
  # ● 発動スキル
  #--------------------------------------------------------------------------
  def use_skill_in_battle
    return 0 unless $game_party.in_battle
    Call_Common_Event.use_skill
  end
end

class Game_Interpreter
  include Commands
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
#  バトル画面の処理を行うクラスです。
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  alias call_common_event_start start
  def start
    Call_Common_Event.initialize(method(:call_common_event))
    call_common_event_start
  end
  #--------------------------------------------------------------------------
  # ● 戦闘行動終了時の処理
  #--------------------------------------------------------------------------
  alias call_common_event_process_action_end process_action_end
  def process_action_end
    unless call_common_event_process_action_end
      Call_Common_Event.clear_last_battler
      return false
    else
      return true
    end
  end
  #--------------------------------------------------------------------------
  # ● スキル/アイテムの使用
  #--------------------------------------------------------------------------
  alias call_common_event_use_item use_item
  def use_item
    item = @subject.current_action.item
    Call_Common_Event.last_battler = @subject
    Call_Common_Event.use_skill = item.id
    Call_Common_Event.user_unit = @subject.actor?
    Call_Common_Event.user = @subject.actor? ? @subject.actor.id : @subject.enemy.id
    call_common_event(item.call_common_event_id) if item.call_common_event?
    call_common_event_use_item
  end
  #--------------------------------------------------------------------------
  # ● 反撃の発動
  #--------------------------------------------------------------------------
  alias call_common_event_invoke_counter_attack invoke_counter_attack
  def invoke_counter_attack(target, item)
    Call_Common_Event.last_battler = target
    invoke_counter_attack(target, item)   
  end
  #--------------------------------------------------------------------------
  # ● コモンイベントの呼び出し
  #--------------------------------------------------------------------------
  def call_common_event(common_event_id)
    $game_temp.reserve_common_event(common_event_id)
    process_event
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
[/pre]

点评

感谢感谢。  发表于 2015-4-30 00:44
好啦,回来啦,这几天太忙了。。  发表于 2015-4-27 19:12
感谢帮忙或提供思路,应该是我不好意思。  发表于 2015-4-27 14:26
如果可以的话晚上或者明天给你?  发表于 2015-4-25 17:22
啊啊啊啊,抱歉。。。这几天事儿比较多,忘了  发表于 2015-4-25 17:22

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部