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

Project1

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

[已经解决] 糾結的青魔法腳本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2012-9-24
帖子
31
跳转到指定楼层
1
发表于 2012-11-21 13:39:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
地球村找到的脚本,但是测试时候发现音效部分出错了。
说是找不到SE文件。但是明明有啊。
求帮看这个脚本有啥问题...
主要就是一个学习青魔法的脚本.
  1. # ╔═══════════════════════════════════════════════════════╤══════╤═══════════╗
  2. # ║ Blue Magic                                            │ v1.0 │ (7/29/12) ║
  3. # ╚═══════════════════════════════════════════════════════╧══════╧═══════════╝
  4. # Script by:
  5. #     Mr. Bubble ( http://mrbubblewand.wordpress.com/ )
  6. #--------------------------------------------------------------------------
  7. # This script is based off the concept of "Blue Magic" from the Final Fantasy
  8. # series. Blue Magic is the ability to use skills originally cast by enemies.
  9. # Those who have the talent to cast Blue Magic are called Blue Mages.
  10. #
  11. # This script is meant to serve a base script for future scripts also based
  12. # off the concept of Blue Magic/Blue Mages.
  13. #--------------------------------------------------------------------------
  14. #   ++ Changelog ++
  15. #--------------------------------------------------------------------------
  16. # v1.0 : Initial release. (7/29/2012)
  17. #--------------------------------------------------------------------------
  18. #   ++ Installation ++
  19. #--------------------------------------------------------------------------
  20. # Install this script in the Materials section in your project's
  21. # script editor.
  22. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  23. #   ++ Notetags ++
  24. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  25. # Note: Some tags are given shorter tags for typing convenience. You only
  26. #       need to use one <tag> from a given group for a notebox.
  27. #       Use common sense.
  28. #
  29. # The following Notetag is for Skills only:
  30. #
  31. # <blue magic>
  32. #   This tag flags the skill as Blue Magic. Actors capable of learning
  33. #   Blue Magic will learn the skill when directly hit by it.
  34. #
  35. #--------------------------------------------------------------------------
  36. # The following Notetag is for Actors, Classes, Weapons, Armors, and States:
  37. #
  38. # <blue magic: learning>
  39. #   This tag allows an Actor to learn Blue Magic skills when hit by them.
  40. #   If a Class has this tag, then an Actor must be that class to learn
  41. #   Blue Magic. If a Weapon or Armor has this tag, an Actor must equip
  42. #   it to take effect. If a State has this tag then an Actor must be
  43. #   inflicted by that state. Any Blue Magic learning notifications in
  44. #   battle are shown after an action is complete.
  45. #
  46. #--------------------------------------------------------------------------
  47. #   ++ Compatibility ++
  48. #--------------------------------------------------------------------------
  49. # This script aliases the following default VXA methods:
  50. #
  51. #     DataManager#load_database
  52. #     Game_ActionResult#clear
  53. #     Game_Battler#item_apply
  54. #     Scene_Battle#process_action_end
  55. #     Scene_Battle#use_item
  56. #   
  57. # There are no default method overwrites.
  58. #
  59. # Requests for compatibility with other scripts are welcome.
  60. #--------------------------------------------------------------------------
  61. #   ++ Terms and Conditions ++
  62. #--------------------------------------------------------------------------
  63. # Please do not repost this script elsewhere without permission.
  64. # Free for non-commercial use. For commercial use, contact me first.
  65. #
  66. # Newest versions of this script can be found at
  67. #                                           http://mrbubblewand.wordpress.com/
  68. #==============================================================================

  69. $imported ||= {}
  70. $imported["BubsBlueMagic"] = true

  71. #==========================================================================
  72. # ++ START OF USER CUSTOMIZATION MODULE ++
  73. #==========================================================================
  74. module Bubs
  75.   #==========================================================================
  76.   # ++ Blue Magic Settings
  77.   #==========================================================================
  78.   module BlueMagic
  79.   #--------------------------------------------------------------------------
  80.   #   Alternative Blue Magic Learning Methods
  81.   #--------------------------------------------------------------------------
  82.   # Be default, actors capable of learning Blue Magic will learn new spells
  83.   # by being directly hit by Blue Magic spells cast by enemies. These
  84.   # settings determine the alternative methods in which actors can learn
  85.   # Blue Magic.
  86.   #
  87.   # true  : Actors can learn Blue Magic regardless of who it hits.
  88.   # false : Actors must be hit directly with Blue Magic to learn.
  89.   LEARN_BY_SIGHT = false
  90.   # true  : Actors can learn Blue Magic cast by other actors.
  91.   # false : Actors can only learn Blue Magic from enemies.
  92.   LEARN_BY_ALLIES = false
  93.   
  94.   #--------------------------------------------------------------------------
  95.   #   Blue Magic Learned Battle Message
  96.   #--------------------------------------------------------------------------
  97.   # This defines the message displayed in battle when an actor learns a
  98.   # Blue Magic skill.
  99.   #
  100.   # The first %s is automatically replaced by the actor's name.
  101.   # The second %2 is automatically replaced by the skill's name.
  102.   BLUE_MAGIC_LEARNED_MESSAGE = "%s learned %s."
  103.   
  104.   #--------------------------------------------------------------------------
  105.   #   Blue Magic Learned Sound Effect
  106.   #--------------------------------------------------------------------------
  107.   # Sound effect played when the Blue Magic learned message is displayed.
  108.   # Filename is a sound effect found in the Audio/SE/ folder.
  109.   #
  110.   #                        "filename", volume, pitch
  111.   BLUE_MAGIC_LEARNED_SE = [  "Chime2",     80,   100]
  112.   
  113.   #--------------------------------------------------------------------------
  114.   #   Blue Magic Message Wait
  115.   #--------------------------------------------------------------------------
  116.   # This setting determines how long the Blue Magic learned message is
  117.   # displayed in battle. Higher values increase the wait time.
  118.   BLUE_MAGIC_LEARNED_MESSAGE_WAIT = 3

  119.   end # module BlueMagic
  120. end # module Bubs

  121. #==========================================================================
  122. # ++ END OF USER CUSTOMIZATION MODULE ++
  123. #==========================================================================




  124. #==============================================================================
  125. # ++ Sound
  126. #==============================================================================
  127. module Sound
  128.   #--------------------------------------------------------------------------
  129.   # new method : play_blue_magic_learned
  130.   #--------------------------------------------------------------------------
  131.   def self.play_blue_magic_learned
  132.     filename = Bubs::BlueMagic::BLUE_MAGIC_LEARNED_SE[0]
  133.     volume = Bubs::BlueMagic::BLUE_MAGIC_LEARNED_SE[1]
  134.     pitch = Bubs::BlueMagic::BLUE_MAGIC_LEARNED_SE[2]
  135.     Audio.se_play(filename, volume, pitch)
  136.   end
  137.   
  138. end # module Sound


  139. #==========================================================================
  140. # ++ DataManager
  141. #==========================================================================
  142. module DataManager
  143.   #--------------------------------------------------------------------------
  144.   # alias : load_database
  145.   #--------------------------------------------------------------------------
  146.   class << self; alias load_database_bubs_bluemagic load_database; end
  147.   def self.load_database
  148.     load_database_bubs_bluemagic # alias
  149.     load_notetags_bubs_bluemagic
  150.   end
  151.   
  152.   #--------------------------------------------------------------------------
  153.   # new method : load_notetags_bubs_bluemagic
  154.   #--------------------------------------------------------------------------
  155.   def self.load_notetags_bubs_bluemagic
  156.     groups = [$data_skills, $data_weapons, $data_armors, $data_actors,
  157.               $data_states, $data_classes, $data_enemies, $data_items]
  158.     for group in groups
  159.       for obj in group
  160.         next if obj.nil?
  161.         obj.load_notetags_bubs_bluemagic
  162.       end # for obj
  163.     end # for group
  164.   end # def
  165.   
  166. end # module DataManager


  167. #==========================================================================
  168. # ++ Bubs::Regexp
  169. #==========================================================================
  170. module Bubs
  171.   module Regexp
  172.     BLUE_MAGIC_SKILL_TAG = /<BLUE[_\s]?MAGIC>/i
  173.     BLUE_MAGIC_LEARNING_TAG = /<BLUE[_\s]?MAGIC:\s*LEARNING>/i
  174.    
  175.   end # module Regexp
  176. end # module Bubs


  177. #==========================================================================
  178. # ++ RPG::BaseItem
  179. #==========================================================================
  180. class RPG::BaseItem
  181.   #--------------------------------------------------------------------------
  182.   # public instance variables
  183.   #--------------------------------------------------------------------------
  184.   attr_accessor :blue_magic
  185.   attr_accessor :blue_magic_learning
  186.   #--------------------------------------------------------------------------
  187.   # common cache : load_notetags_bubs_bluemagic
  188.   #--------------------------------------------------------------------------
  189.   def load_notetags_bubs_bluemagic
  190.     @blue_magic = false if self.is_a?(RPG::UsableItem)
  191.     @blue_magic_learning = false unless self.is_a?(RPG::UsableItem)

  192.     self.note.split(/[\r\n]+/).each { |line|
  193.       case line
  194.       when Bubs::Regexp::BLUE_MAGIC_SKILL_TAG
  195.         next unless self.is_a?(RPG::Skill)
  196.         @blue_magic = true
  197.         
  198.       when Bubs::Regexp::BLUE_MAGIC_LEARNING_TAG
  199.         next if self.is_a?(RPG::UsableItem)
  200.         @blue_magic_learning = true
  201.         
  202.       end # case
  203.     } # self.note.split
  204.   end # def load_notetags_bubs_bluemagic
  205. end # class RPG::BaseItem


  206. #==============================================================================
  207. # ++ Window_BattleLog
  208. #==============================================================================
  209. class Window_BattleLog < Window_Selectable
  210.   #--------------------------------------------------------------------------
  211.   # new method : display_learned_blue_magic
  212.   #--------------------------------------------------------------------------
  213.   def display_learned_blue_magic(actor)
  214.     id = actor.result.blue_magic_skill_to_learn
  215.     fmt = Bubs::BlueMagic::BLUE_MAGIC_LEARNED_MESSAGE
  216.     add_text( sprintf(fmt, actor.name, $data_skills[id].name) )
  217.     Sound.play_blue_magic_learned
  218.    
  219.     Bubs::BlueMagic::BLUE_MAGIC_LEARNED_MESSAGE_WAIT.times do wait end
  220.     wait_for_effect
  221.   end
  222. end


  223. #==============================================================================
  224. # ++ Game_ActionResult
  225. #==============================================================================
  226. class Game_ActionResult
  227.   #--------------------------------------------------------------------------
  228.   # public instance variables
  229.   #--------------------------------------------------------------------------
  230.   attr_accessor :blue_magic_skill_to_learn
  231.   #--------------------------------------------------------------------------
  232.   # alias : clear
  233.   #--------------------------------------------------------------------------
  234.   alias clear_bubs_bluemagic clear
  235.   def clear
  236.     clear_bubs_bluemagic # alias
  237.    
  238.     @blue_magic_skill_to_learn = 0
  239.   end
  240. end


  241. #==============================================================================
  242. # ++ Game_Battler
  243. #==============================================================================
  244. class Game_Battler < Game_BattlerBase
  245.   #--------------------------------------------------------------------------
  246.   # alias : item_apply
  247.   #--------------------------------------------------------------------------
  248.   alias item_apply_bubs_bluemagic item_apply
  249.   def item_apply(user, item)
  250.     item_apply_bubs_bluemagic(user, item) # alias
  251.    
  252.     if blue_magic_learning_ok?(user, item)
  253.       @result.blue_magic_skill_to_learn = item.id
  254.     end
  255.   end
  256.   
  257.   #--------------------------------------------------------------------------
  258.   # new method : blue_magic_learning_ok?
  259.   #--------------------------------------------------------------------------
  260.   def blue_magic_learning_ok?(user, item)
  261.     item.blue_magic && blue_magic_learning? && @result.hit? &&
  262.     blue_magic_learn_by_allies?(user)
  263.   end
  264.   
  265.   #--------------------------------------------------------------------------
  266.   # new method : blue_magic_learning?
  267.   #--------------------------------------------------------------------------
  268.   def blue_magic_learning?
  269.     if actor?
  270.       return true if self.actor.blue_magic_learning
  271.       return true if self.class.blue_magic_learning
  272.       for equip in equips
  273.         next if equip.nil?
  274.         return true if equip.blue_magic_learning
  275.       end
  276.       for state in states
  277.         next if state.nil?
  278.         return true if state.blue_magic_learning
  279.       end
  280.     end
  281.     return false
  282.   end # def blue_magic_learning?
  283.   
  284.   #--------------------------------------------------------------------------
  285.   # new method : blue_magic_learn_by_allies?
  286.   #--------------------------------------------------------------------------
  287.   def blue_magic_learn_by_allies?(user)
  288.     if user.actor?
  289.       return Bubs::BlueMagic::LEARN_BY_ALLIES
  290.     else
  291.       return true
  292.     end
  293.   end # def

  294. end # class Game_Battler


  295. #==============================================================================
  296. # ++ Game_Actor
  297. #==============================================================================
  298. class Game_Actor < Game_Battler
  299.   #--------------------------------------------------------------------------
  300.   # new method : new_blue_magic_skill_learned?
  301.   #--------------------------------------------------------------------------
  302.   def new_blue_magic_skill_learned?
  303.     skill_id = @result.blue_magic_skill_to_learn
  304.     return false unless blue_magic_learning?
  305.     return false unless skill_id > 0
  306.     return false if skill_learn?($data_skills[skill_id])
  307.     learn_skill(skill_id)
  308.     return true
  309.   end
  310.   
  311.   #--------------------------------------------------------------------------
  312.   # new method : blue_magic_skills
  313.   #--------------------------------------------------------------------------
  314.   # returns an array of Blue Magic skill ids learned by the battler
  315.   def blue_magic_skills
  316.     @skills.select { |id| $data_skills[id].blue_magic }
  317.   end
  318.   
  319.   #--------------------------------------------------------------------------
  320.   # new method : learnable_blue_magic_from_target
  321.   #--------------------------------------------------------------------------
  322.   def learnable_blue_magic_from_target(target)
  323.     target.blue_magic_skills.select { |id| [email protected]?(id) }
  324.   end

  325. end # class Game_Actor


  326. #==============================================================================
  327. # ++ Game_Enemy
  328. #==============================================================================
  329. class Game_Enemy < Game_Battler
  330.   #--------------------------------------------------------------------------
  331.   # new method : blue_magic_skills
  332.   #--------------------------------------------------------------------------
  333.   # returns an array of Blue Magic skill ids learned by the battler
  334.   def blue_magic_skills
  335.     skill_ids = enemy.actions.collect { |action| action.skill_id }
  336.     skill_ids.uniq!.select! { |id| $data_skills[id].blue_magic }
  337.   end

  338. end # class Game_Enemy


  339. #==============================================================================
  340. # ++ Scene_Battle
  341. #==============================================================================
  342. class Scene_Battle < Scene_Base
  343.   #--------------------------------------------------------------------------
  344.   # alias : process_action_end
  345.   #--------------------------------------------------------------------------
  346.   # Checks all Blue Magic learn flags and displays message if found
  347.   alias process_action_end_bubs_bluemagic process_action_end
  348.   def process_action_end
  349.     $game_party.members.each do |actor|
  350.       if actor.new_blue_magic_skill_learned?
  351.         @log_window.display_learned_blue_magic(actor)
  352.         @log_window.clear
  353.       end
  354.     end
  355.     process_action_end_bubs_bluemagic # alias
  356.   end
  357.   
  358.   #--------------------------------------------------------------------------
  359.   # alias : use_item
  360.   #--------------------------------------------------------------------------
  361.   alias use_item_bubs_bluemagic use_item
  362.   def use_item
  363.     use_item_bubs_bluemagic # alias
  364.         
  365.     item = @subject.current_action.item
  366.     determine_blue_magic_learn_by_sight(@subject, item)
  367.   end # def

  368.   #--------------------------------------------------------------------------
  369.   # new method : determine_blue_magic_learn_by_sight
  370.   #--------------------------------------------------------------------------
  371.   def determine_blue_magic_learn_by_sight(subject, item)
  372.     return unless Bubs::BlueMagic::LEARN_BY_SIGHT
  373.     return unless item.blue_magic && subject
  374.     return unless blue_magic_learn_by_allies?(subject)
  375.     all_battle_members.each do |member|
  376.       if member.result.hit?
  377.         set_blue_magic_skill_to_learn_flags(item)
  378.         break
  379.       end # if
  380.     end # do
  381.   end # def
  382.    
  383.   #--------------------------------------------------------------------------
  384.   # new method : set_blue_magic_skill_to_learn_flags
  385.   #--------------------------------------------------------------------------
  386.   def set_blue_magic_skill_to_learn_flags(item)
  387.     $game_party.members.each do |actor|
  388.       if actor.blue_magic_learning?
  389.         actor.result.blue_magic_skill_to_learn = item.id
  390.       end # if
  391.     end # do
  392.   end # def
  393.    
  394.   #--------------------------------------------------------------------------
  395.   # new method : blue_magic_learn_by_allies?
  396.   #--------------------------------------------------------------------------
  397.   def blue_magic_learn_by_allies?(subject)
  398.     if subject.actor?
  399.       return Bubs::BlueMagic::LEARN_BY_ALLIES
  400.     else
  401.       return true
  402.     end
  403.   end # def
  404.   
  405. end # class Scene_Battle
复制代码

Lv2.观梦者

梦石
0
星屑
465
在线时间
915 小时
注册时间
2011-5-11
帖子
438
2
发表于 2012-11-23 16:59:48 | 只看该作者
{:2_270:}这个脚本SE文件为固定的文件名
你可修改脚本的第113行
  1. BLUE_MAGIC_LEARNED_SE = [  "Chime2",     80,   100]#Chime2为SE文件名
复制代码

评分

参与人数 1梦石 +1 收起 理由
Mic_洛洛 + 1 认可答案,好人卡+1

查看全部评分

http://rpg.blue/static/image/smiley/yct/A059.gif中国字认识都不到一半,哪的心情学英语呀!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2012-9-24
帖子
31
3
 楼主| 发表于 2012-11-23 19:24:55 | 只看该作者
345912390 发表于 2012-11-23 16:59
这个脚本SE文件为固定的文件名
你可修改脚本的第113行

這個我見到了也試過了...很不幸...不行...
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
465
在线时间
915 小时
注册时间
2011-5-11
帖子
438
4
发表于 2012-11-24 10:47:46 | 只看该作者
orangepower 发表于 2012-11-23 19:24
這個我見到了也試過了...很不幸...不行...

{:2_258:}这个脚本与声音有关的好像只有第113行。你看一下,
工程目录/Audio/SE/  的文件夹是否存在与第113行文件名对应的.ogg格式的文件

如果还出错,那就不知道 了!
http://rpg.blue/static/image/smiley/yct/A059.gif中国字认识都不到一半,哪的心情学英语呀!
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
58 小时
注册时间
2012-9-24
帖子
31
5
 楼主| 发表于 2012-11-25 10:59:30 | 只看该作者
345912390 发表于 2012-11-24 10:47
这个脚本与声音有关的好像只有第113行。你看一下,
工程目录/Audio/SE/  的文件夹是否存在与第1 ...

啊我大概明白問題出在哪裡了,
可能是工程目錄沒SE,但是軟件自帶的裏面有...
忽略了這一點...
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-28 04:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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