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

Project1

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

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
723
在线时间
530 小时
注册时间
2010-6-9
帖子
840
跳转到指定楼层
1
发表于 2015-4-22 15:16:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
战斗部分(技能伤害部分)因为父类不一样,导致如下:
RUBY 代码复制
  1. def draw_window_backg
  2.                 windowbg = Cache.picture("/windowbg")
  3.                 src_rect = Rect.new(0,0,windowbg.width ,windowbg.height)
  4.                 contents.blt(0, 0, windowbg, src_rect,125)
  5.         end


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

Lv4.逐梦者 (版主)

无限の剣制

梦石
0
星屑
10009
在线时间
5019 小时
注册时间
2013-2-28
帖子
5030

开拓者贵宾

2
发表于 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
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3258
在线时间
1120 小时
注册时间
2009-4-15
帖子
815
3
发表于 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
回复 支持 反对

使用道具 举报

Lv2.观梦者 (暗夜天使)

卑微的梦

梦石
0
星屑
515
在线时间
820 小时
注册时间
2013-2-23
帖子
1185

短篇九勇士组季军

4
发表于 2015-4-23 23:28:56 手机端发表。 | 只看该作者
本帖最后由 子弹君 于 2015-4-27 19:11 编辑

技能前置公共事件
【技能效果触发之前预约一个公共事件】
=================================
待编辑 (目前手机状态)
使用方法:在技能备注上填上[コモン呼出 = 20],这样就是技能前置一个20号公共事件
RUBY 代码复制
  1. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  2.  
  3. #==============================================================================
  4. #                   ◆ コモンイベント呼出し ver2.03 ◆ VX Ace ◆
  5. #                                                     by Oz
  6. #------------------------------------------------------------------------------
  7. #  スキル発動前にコモンイベントを呼び出します。スキルの詠唱イベントとかに
  8. # 使えると思います。スキルのメモに
  9. # [コモン呼出(call commonでもok) コモンイベントID]
  10. # と記述するとスキル使用前にコモンイベントIDを実行します。
  11. # イベントのスクリプトで使用者のユニット、使用者、スキルを取得したい場合は、
  12. # 以下のメソッドをイベントのスクリプトで呼び出すことで取得できます。
  13. # user_unit_in_battle  →  使用者が味方ならtrue、敵ならfalse
  14. # user_in_battle      → スキル発動したキャラのIDです。
  15. # use_skill_in_battle  →  発動するスキルIDです。
  16. # よくわかんない人用にDBの変数に入れることもできます。使わない場合 nil に
  17. # にしてください。
  18. # 戦闘中以外に呼び出した場合、0を返します。(使用者のユニットはtrueを返します。)
  19. # 戦闘前、勝利時、敗北時、逃走時にコモンイベントを呼び出せるようにしました。
  20. # 0を指定するとコモンイベントは呼び出ししません。
  21. # Call_Common_Event.phase で戦闘開始前、勝利時、敗北時、逃走時を取得できます。
  22. #==============================================================================
  23.  
  24. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  25.  
  26. $imported = {} if $imported == nil
  27. $imported["Call_Common_Event"] = true
  28.  
  29. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  30.  
  31. #==============================================================================
  32. # ★ 設定項目 Call Common Event ★
  33. #==============================================================================
  34.  
  35. module Call_Common_Event
  36.   #スキル発動者のユニット用変数(0:敵、1:味方)
  37.   User_Unit_Variable_ID = nil
  38.   #スキル発動者用変数
  39.   User_Variable_ID = nil
  40.   #スキル用変数
  41.   Use_Skill_Variable_ID = nil
  42.   #戦闘前
  43.   Standby_Event_ID = 0
  44.   #戦闘勝利時
  45.   Won_Event_ID = 0
  46.   #戦闘敗北時
  47.   Defeat_Event_ID = 0
  48.   #戦闘逃走時
  49.   Escaped_Event_ID = 0
  50. end
  51.  
  52. #==============================================================================
  53. # ★ 設定項目 Call Common Event ★
  54. #==============================================================================
  55.  
  56. module Call_Common_Event_System_Word
  57.   Call_Common_Event = /\[(?:コモン呼出|call\s*common)\s*[==]\s*(\d+)\]/i
  58. end
  59.  
  60. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  61.  
  62. #==============================================================================
  63. # ■ RPG::Item
  64. #==============================================================================
  65.  
  66. class RPG::UsableItem
  67.   #------------------------------------------------------------------------
  68.   # ○ キャッシュを生成
  69.   #------------------------------------------------------------------------
  70.   def create_call_common_event_cache
  71.     @call_common_event = false
  72.     @call_common_event_id = 0
  73.     self.note.each_line{|line|
  74.       case line
  75.       when Call_Common_Event_System_Word::Call_Common_Event
  76.         @call_common_event = true
  77.         @call_common_event_id = $1.to_i
  78.       end
  79.     }
  80.   end
  81.   #------------------------------------------------------------------------
  82.   # ○ コモン呼出?
  83.   #------------------------------------------------------------------------
  84.   def call_common_event?
  85.     create_call_common_event_cache if @call_common_event.nil?
  86.     return @call_common_event
  87.   end
  88.   #------------------------------------------------------------------------
  89.   # ○ コモン呼出ID
  90.   #------------------------------------------------------------------------
  91.   def call_common_event_id
  92.     create_call_common_event_cache unless @call_common_event_id
  93.     return @call_common_event_id
  94.   end
  95. end
  96.  
  97. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  98.  
  99. #==============================================================================
  100. # ■ Call Common Event
  101. #==============================================================================
  102.  
  103. module Call_Common_Event
  104.   #--------------------------------------------------------------------------
  105.   # ● メンバ変数の初期化
  106.   #--------------------------------------------------------------------------
  107.   def self.initialize(proc = nil)
  108.     @user_unit = true
  109.     @user = 0
  110.     @use_skill = 0
  111.     @call_event_proc = proc
  112.     @phase = :standby
  113.     clear_last_battler
  114.   end
  115.   #--------------------------------------------------------------------------
  116.   # ● ユニット
  117.   #--------------------------------------------------------------------------
  118.   def self.user_unit
  119.     initialize if @user_unit.nil?
  120.     return @user_unit
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 発動者
  124.   #--------------------------------------------------------------------------
  125.   def self.user
  126.     initialize unless @user   
  127.     return @user
  128.   end
  129.   #--------------------------------------------------------------------------
  130.   # ● スキル
  131.   #--------------------------------------------------------------------------
  132.   def self.use_skill
  133.     initialize unless @use_skill
  134.     return @use_skill
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● フェイズ
  138.   #--------------------------------------------------------------------------
  139.   def self.phase
  140.     initialize unless @phase
  141.     return @phase
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● ユニット
  145.   #--------------------------------------------------------------------------
  146.   def self.user_unit=(user_unit)
  147.     @user_unit = user_unit
  148.     self.user_unit_variable = user_unit
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 発動者
  152.   #--------------------------------------------------------------------------
  153.   def self.user=(user)
  154.     @user = user
  155.     self.user_variable = user
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● スキル
  159.   #--------------------------------------------------------------------------
  160.   def self.use_skill=(skill)
  161.     @use_skill = skill
  162.     self.use_skill_variable = skill
  163.   end
  164.   #--------------------------------------------------------------------------
  165.   # ● ユニット変数
  166.   #--------------------------------------------------------------------------
  167.   def self.user_unit_variable=(value)
  168.     return unless User_Unit_Variable_ID
  169.     $game_variables[User_Unit_Variable_ID] = value ? 1 : 0
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ● 発動者変数
  173.   #--------------------------------------------------------------------------
  174.   def self.user_variable=(value)
  175.     return unless User_Variable_ID
  176.     $game_variables[User_Variable_ID] = value
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 発動スキル変数
  180.   #--------------------------------------------------------------------------
  181.   def self.use_skill_variable=(value)
  182.     return unless Use_Skill_Variable_ID
  183.     $game_variables[Use_Skill_Variable_ID] = value
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ● 戦闘開始前
  187.   #--------------------------------------------------------------------------
  188.   def self.standby?
  189.     @phase == :standby
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # ● 勝利後
  193.   #--------------------------------------------------------------------------
  194.   def self.won?
  195.     @phase == :won
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● 敗北後
  199.   #--------------------------------------------------------------------------
  200.   def self.defeat?
  201.     @phase == :defeat
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 逃走中
  205.   #--------------------------------------------------------------------------
  206.   def self.escaped?
  207.     @phase == :escaped
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # ● 開始前
  211.   #--------------------------------------------------------------------------
  212.   def self.call_standby_event
  213.     return unless Standby_Event_ID > 0
  214.     @phase = :standby
  215.     @call_event_proc.call(Standby_Event_ID) if @call_event_proc
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 勝利時
  219.   #--------------------------------------------------------------------------
  220.   def self.call_won_event
  221.     return unless Won_Event_ID > 0
  222.     @phase = :won
  223.     @call_event_proc.call(Won_Event_ID) if @call_event_proc
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● 敗北時
  227.   #--------------------------------------------------------------------------
  228.   def self.call_defeat_event
  229.     return unless Defeat_Event_ID > 0
  230.     @phase = :defeat
  231.     @call_event_proc.call(Defeat_Event_ID) if @call_event_proc
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # ● 逃走時
  235.   #--------------------------------------------------------------------------
  236.   def self.call_escaped_event
  237.     return unless Escaped_Event_ID > 0
  238.     @phase = :escaped
  239.     @call_event_proc.call(Escaped_Event_ID) if @call_event_proc
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 最後の行動者
  243.   #--------------------------------------------------------------------------
  244.   def self.last_battler=(battler)
  245.     @last_battler = battler
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● アクター:ランダム
  249.   #--------------------------------------------------------------------------
  250.   def self.actor_randam
  251.     members = $game_party.alive_members
  252.     actor = members[rand * members.size]
  253.     return actor ? actor.id : 0
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● アクター:最後の行動者
  257.   #--------------------------------------------------------------------------
  258.   def self.last_actor
  259.     return 0 if @last_battler.nil? || @last_battler.enemy?
  260.     return @last_battler.actor.id
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● エネミー:最後の行動者
  264.   #--------------------------------------------------------------------------
  265.   def self.last_enemy
  266.     return 0 if @last_battler.nil? || @last_battler.actor?
  267.     return @last_battler.enemy.id
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● 最後の行動者:クリアー
  271.   #--------------------------------------------------------------------------
  272.   def self.clear_last_battler
  273.     @last_battler = nil
  274.   end
  275. end
  276.  
  277. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  278.  
  279. #==============================================================================
  280. # ■ BattleManager
  281. #------------------------------------------------------------------------------
  282. #  戦闘の進行を管理するモジュールです。
  283. #==============================================================================
  284.  
  285. class << BattleManager
  286.   #--------------------------------------------------------------------------
  287.   # ● 戦闘開始
  288.   #--------------------------------------------------------------------------
  289.   alias call_common_event_battle_start battle_start
  290.   def battle_start
  291.     call_common_event_battle_start
  292.     Call_Common_Event.call_standby_event
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● 勝利の処理
  296.   #--------------------------------------------------------------------------
  297.   alias call_common_event_process_victory process_victory
  298.   def process_victory
  299.     return if Call_Common_Event.won?
  300.     Call_Common_Event.call_won_event
  301.     call_common_event_process_victory   
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 中断の処理
  305.   #--------------------------------------------------------------------------
  306.   alias call_common_event_process_abort process_abort
  307.   def process_abort
  308.     return if Call_Common_Event.escaped?
  309.     Call_Common_Event.call_escaped_event
  310.     call_common_event_process_abort
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 敗北の処理
  314.   #--------------------------------------------------------------------------
  315.   alias call_common_event_process_defeat process_defeat
  316.   def process_defeat
  317.     return if Call_Common_Event.defeat?
  318.     Call_Common_Event.call_defeat_event
  319.     call_common_event_process_defeat
  320.   end
  321. end
  322.  
  323. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  324.  
  325. #==============================================================================
  326. # ? Command
  327. #==============================================================================
  328.  
  329. module Commands
  330.   module_function
  331.   #--------------------------------------------------------------------------
  332.   # ● ユーザのユニット
  333.   #--------------------------------------------------------------------------
  334.   def user_unit_in_battle
  335.     return true unless $game_party.in_battle
  336.     Call_Common_Event.user_unit
  337.   end
  338.   #--------------------------------------------------------------------------
  339.   # ● ユーザ
  340.   #--------------------------------------------------------------------------
  341.   def user_in_battle
  342.     return 0 unless $game_party.in_battle
  343.     Call_Common_Event.user
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # ● 発動スキル
  347.   #--------------------------------------------------------------------------
  348.   def use_skill_in_battle
  349.     return 0 unless $game_party.in_battle
  350.     Call_Common_Event.use_skill
  351.   end
  352. end
  353.  
  354. class Game_Interpreter
  355.   include Commands
  356. end
  357.  
  358. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
  359.  
  360. #==============================================================================
  361. # ■ Scene_Battle
  362. #------------------------------------------------------------------------------
  363. #  バトル画面の処理を行うクラスです。
  364. #==============================================================================
  365.  
  366. class Scene_Battle < Scene_Base
  367.   #--------------------------------------------------------------------------
  368.   # ● 開始処理
  369.   #--------------------------------------------------------------------------
  370.   alias call_common_event_start start
  371.   def start
  372.     Call_Common_Event.initialize(method(:call_common_event))
  373.     call_common_event_start
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   # ● 戦闘行動終了時の処理
  377.   #--------------------------------------------------------------------------
  378.   alias call_common_event_process_action_end process_action_end
  379.   def process_action_end
  380.     unless call_common_event_process_action_end
  381.       Call_Common_Event.clear_last_battler
  382.       return false
  383.     else
  384.       return true
  385.     end
  386.   end
  387.   #--------------------------------------------------------------------------
  388.   # ● スキル/アイテムの使用
  389.   #--------------------------------------------------------------------------
  390.   alias call_common_event_use_item use_item
  391.   def use_item
  392.     item = @subject.current_action.item
  393.     Call_Common_Event.last_battler = @subject
  394.     Call_Common_Event.use_skill = item.id
  395.     Call_Common_Event.user_unit = @subject.actor?
  396.     Call_Common_Event.user = @subject.actor? ? @subject.actor.id : @subject.enemy.id
  397.     call_common_event(item.call_common_event_id) if item.call_common_event?
  398.     call_common_event_use_item
  399.   end
  400.   #--------------------------------------------------------------------------
  401.   # ● 反撃の発動
  402.   #--------------------------------------------------------------------------
  403.   alias call_common_event_invoke_counter_attack invoke_counter_attack
  404.   def invoke_counter_attack(target, item)
  405.     Call_Common_Event.last_battler = target
  406.     invoke_counter_attack(target, item)   
  407.   end
  408.   #--------------------------------------------------------------------------
  409.   # ● コモンイベントの呼び出し
  410.   #--------------------------------------------------------------------------
  411.   def call_common_event(common_event_id)
  412.     $game_temp.reserve_common_event(common_event_id)
  413.     process_event
  414.   end
  415. end
  416.  
  417. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

点评

感谢感谢。  发表于 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 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-4 18:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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