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

Project1

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

[已经解决] 关于被动技能设置的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
800
在线时间
1 小时
注册时间
2017-4-3
帖子
3
跳转到指定楼层
1
发表于 2017-4-3 23:04:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
想请教一下,如果想设置被动技能(类似面对同属性的对手时攻击力上升,或者是受到攻击时会反击这样的),该怎么设置呢?

点评

【警告】版规A-8 弃帖/提问后不管  发表于 2017-4-13 13:09

Lv1.梦旅人

梦石
0
星屑
800
在线时间
1 小时
注册时间
2017-4-3
帖子
3
2
 楼主| 发表于 2017-4-4 00:05:09 | 只看该作者
有大佬能帮帮忙吗?
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
10
星屑
7697
在线时间
690 小时
注册时间
2017-1-9
帖子
636

我没有哭开拓者

3
发表于 2017-4-4 01:08:44 | 只看该作者
我也是萌新dasi!
先发个dalao的脚本抛砖引玉吧,看看还有没有别的dalao愿意给你更详细的解答
  1. #===============================================================================
  2. # ■ 战斗中自动附加被动状态
  3. # By :VIPArcher [email: [email protected]]
  4. #  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
  5. #==============================================================================
  6. # ■ 在战斗开始时自动为每一位战斗者附加上设置好的状态,战斗结束时移除
  7. # 使用说明:
  8. #   在角色|职业|装备|敌人的备注栏备注<被动状态:状态ID> 例如 <被动状态:18>
  9. #   同时备注多个被动状态亦可叠加,都会为其附加上对应的状态。只有战斗开始时附加一次状态
  10. #   的备注栏应该也可以用,只要战斗开始前有某状态亦可附加上该状态备注栏里指定对的状态
  11. #==============================================================================
  12. $VIPArcherScript ||= {};$VIPArcherScript[:battle_state] = 20141102
  13. #--------------------------------------------------------------------------------
  14. class Game_Battler < Game_BattlerBase
  15.   #--------------------------------------------------------------------------
  16.   # ● 战斗开始处理
  17.   #--------------------------------------------------------------------------
  18.   alias state_battle_start on_battle_start
  19.   def on_battle_start
  20.     state_battle_start
  21.     self.feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each{ |line|
  22.     self.add_state($1.to_i) if line =~ /<被动状态:\s*(\d+)>/}}
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 战斗结束处理
  26.   #--------------------------------------------------------------------------
  27.   alias state_on_battle_end on_battle_end
  28.   def on_battle_end
  29.     state_on_battle_end
  30.     self.feature_objects.each {|obj| obj.note.split(/[\r\n]+/).each{ |line|
  31.     self.remove_state($1.to_i) if line =~ /<被动状态:\s*(\d+)>/}}
  32.   end
  33. end
复制代码


另外,善用搜索,请在论坛搜索栏中搜索关键词“被动技能”
这个B天天摸鱼,快点来个谁把他从被窝里拖出来
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
292 小时
注册时间
2009-10-30
帖子
24
4
发表于 2017-4-4 04:44:09 | 只看该作者
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Passive States v1.02
  4. # -- Last Updated: 2012.01.23
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YEA-PassiveStates"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.23 - Compatibility Update: Doppelganger
  15. # 2012.01.08 - Added passive state checks for adding/removing states.
  16. # 2011.12.14 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script allows for actors, classes, weapons, armours, and enemies to have
  22. # passives that are based off of states. Passive states will be active at all
  23. # times and are immune to restrictions and will only disappear if the battler
  24. # dies. Once the battler revives, the passives will return.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Actor Notetags - These notetags go in the actors notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <passive state: x>
  36. # <passive state: x, x>
  37. # This will cause state x to be always on (unless the battler is dead). To have
  38. # multiple passives, insert multiples of this notetag.
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Class Notetags - These notetags go in the class notebox in the database.
  42. # -----------------------------------------------------------------------------
  43. # <passive state: x>
  44. # <passive state: x, x>
  45. # This will cause state x to be always on (unless the battler is dead). To have
  46. # multiple passives, insert multiples of this notetag.
  47. #
  48. # -----------------------------------------------------------------------------
  49. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  50. # -----------------------------------------------------------------------------
  51. # <passive state: x>
  52. # <passive state: x, x>
  53. # This will cause state x to be always on (unless the battler is dead). To have
  54. # multiple passives, insert multiples of this notetag.
  55. #
  56. # -----------------------------------------------------------------------------
  57. # Armour Notetags - These notetags go in the armours notebox in the database.
  58. # -----------------------------------------------------------------------------
  59. # <passive state: x>
  60. # <passive state: x, x>
  61. # This will cause state x to be always on (unless the battler is dead). To have
  62. # multiple passives, insert multiples of this notetag.
  63. #
  64. # -----------------------------------------------------------------------------
  65. # Enemy Notetags - These notetags go in the enemies notebox in the database.
  66. # -----------------------------------------------------------------------------
  67. # <passive state: x>
  68. # <passive state: x, x>
  69. # This will cause state x to be always on (unless the battler is dead). To have
  70. # multiple passives, insert multiples of this notetag.
  71. #
  72. #==============================================================================
  73. # ▼ Compatibility
  74. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  75. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  76. # it will run with RPG Maker VX without adjusting.
  77. #
  78. #==============================================================================
  79. # ▼ Editting anything past this point may potentially result in causing
  80. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  81. # halitosis so edit at your own risk.
  82. #==============================================================================

  83. module YEA
  84.   module REGEXP
  85.   module BASEITEM
  86.    
  87.     PASSIVE_STATE =
  88.       /<(?:PASSIVE_STATE|passive state):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
  89.    
  90.   end # BASEITEM
  91.   end # REGEXP
  92. end # YEA

  93. #==============================================================================
  94. # ■ DataManager
  95. #==============================================================================

  96. module DataManager
  97.   
  98.   #--------------------------------------------------------------------------
  99.   # alias method: load_database
  100.   #--------------------------------------------------------------------------
  101.   class <<self; alias load_database_pst load_database; end
  102.   def self.load_database
  103.     load_database_pst
  104.     load_notetags_pst
  105.   end
  106.   
  107.   #--------------------------------------------------------------------------
  108.   # new method: load_notetags_pst
  109.   #--------------------------------------------------------------------------
  110.   def self.load_notetags_pst
  111.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  112.       $data_enemies]
  113.     for group in groups
  114.       for obj in group
  115.         next if obj.nil?
  116.         obj.load_notetags_pst
  117.       end
  118.     end
  119.   end
  120.   
  121. end # DataManager

  122. #==============================================================================
  123. # ■ RPG::BaseItem
  124. #==============================================================================

  125. class RPG::BaseItem
  126.   
  127.   #--------------------------------------------------------------------------
  128.   # public instance variables
  129.   #--------------------------------------------------------------------------
  130.   attr_accessor :passive_states
  131.   
  132.   #--------------------------------------------------------------------------
  133.   # common cache: load_notetags_pst
  134.   #--------------------------------------------------------------------------
  135.   def load_notetags_pst
  136.     @passive_states = []
  137.     #---
  138.     self.note.split(/[\r\n]+/).each { |line|
  139.       case line
  140.       #---
  141.       when YEA::REGEXP::BASEITEM::PASSIVE_STATE
  142.         $1.scan(/\d+/).each { |num|
  143.         @passive_states.push(num.to_i) if num.to_i > 0 }
  144.       #---
  145.       end
  146.     } # self.note.split
  147.     #---
  148.   end
  149.   
  150. end # RPG::BaseItem

  151. #==============================================================================
  152. # ■ Game_BattlerBase
  153. #==============================================================================

  154. class Game_BattlerBase
  155.   
  156.   #--------------------------------------------------------------------------
  157.   # alias method: state?
  158.   #--------------------------------------------------------------------------
  159.   alias game_battlerbase_state_check_pst state?
  160.   def state?(state_id)
  161.     return true if passive_state?(state_id)
  162.     return game_battlerbase_state_check_pst(state_id)
  163.   end
  164.   
  165.   #--------------------------------------------------------------------------
  166.   # alias method: states
  167.   #--------------------------------------------------------------------------
  168.   alias game_battlerbase_states_pst states
  169.   def states
  170.     array = game_battlerbase_states_pst
  171.     array |= passive_states
  172.     return array
  173.   end
  174.   
  175.   #--------------------------------------------------------------------------
  176.   # new method: passive_state?
  177.   #--------------------------------------------------------------------------
  178.   def passive_state?(state_id)
  179.     @passive_states = [] if @passive_states.nil?
  180.     return @passive_states.include?(state_id)
  181.   end
  182.   
  183.   #--------------------------------------------------------------------------
  184.   # new method: passive_states
  185.   #--------------------------------------------------------------------------
  186.   def passive_states
  187.     array = []
  188.     if actor?
  189.       for state_id in self.actor.passive_states
  190.         array.push($data_states[state_id]) if passive_state_addable?(state_id)
  191.       end
  192.       for state_id in self.class.passive_states
  193.         array.push($data_states[state_id]) if passive_state_addable?(state_id)
  194.       end
  195.       for equip in equips
  196.         next if equip.nil?
  197.         for state_id in equip.passive_states
  198.           array.push($data_states[state_id]) if passive_state_addable?(state_id)
  199.         end
  200.       end
  201.     else # enemy
  202.       for state_id in self.enemy.passive_states
  203.         array.push($data_states[state_id]) if passive_state_addable?(state_id)
  204.       end
  205.       if $imported["YEA-Doppelganger"] && !self.class.nil?
  206.         for state_id in self.class.passive_states
  207.           array.push($data_states[state_id]) if passive_state_addable?(state_id)
  208.         end
  209.       end
  210.     end
  211.     create_passive_state_array(array)
  212.     sort_passive_states(array)
  213.     set_passive_state_turns(array)
  214.     return array
  215.   end
  216.   
  217.   #--------------------------------------------------------------------------
  218.   # new method: create_passive_state_array
  219.   #--------------------------------------------------------------------------
  220.   def create_passive_state_array(array)
  221.     @passive_states = []
  222.     for state in array
  223.       @passive_states.push(state.id)
  224.     end
  225.   end
  226.   
  227.   #--------------------------------------------------------------------------
  228.   # new method: passive_state_addable?
  229.   #--------------------------------------------------------------------------
  230.   def passive_state_addable?(state_id)
  231.     return false if $data_states[state_id].nil?
  232.     return alive?
  233.   end
  234.   
  235.   #--------------------------------------------------------------------------
  236.   # new method: set_passive_state_turns
  237.   #--------------------------------------------------------------------------
  238.   def sort_passive_states(array)
  239.     array.sort! do |state_a, state_b|
  240.       if state_a.priority != state_b.priority
  241.         state_b.priority <=> state_a.priority
  242.       else
  243.         state_a.id <=> state_b.id
  244.       end
  245.     end
  246.     return array
  247.   end
  248.   
  249.   #--------------------------------------------------------------------------
  250.   # new method: set_passive_state_turns
  251.   #--------------------------------------------------------------------------
  252.   def set_passive_state_turns(array)
  253.     for state in array
  254.       @state_turns[state.id] = 0 unless @states.include?(state.id)
  255.       @state_steps[state.id] = 0 unless @states.include?(state.id)
  256.     end
  257.   end
  258.   
  259. end # Game_BattlerBase

  260. #==============================================================================
  261. # ■ Game_Battler
  262. #==============================================================================

  263. class Game_Battler < Game_BattlerBase
  264.   
  265.   #--------------------------------------------------------------------------
  266.   # alias method: state_addable?
  267.   #--------------------------------------------------------------------------
  268.   alias game_battler_state_addable_ps state_addable?
  269.   def state_addable?(state_id)
  270.     return false if passive_state?(state_id)
  271.     return game_battler_state_addable_ps(state_id)
  272.   end
  273.   
  274.   #--------------------------------------------------------------------------
  275.   # alias method: remove_state
  276.   #--------------------------------------------------------------------------
  277.   alias game_battler_remove_state_ps remove_state
  278.   def remove_state(state_id)
  279.     return if passive_state?(state_id)
  280.     game_battler_remove_state_ps(state_id)
  281.   end
  282.   
  283. end # Game_Battler

  284. #==============================================================================
  285. #
  286. # ▼ End of File
  287. #
  288. #==============================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
800
在线时间
1 小时
注册时间
2017-4-3
帖子
3
5
 楼主| 发表于 2017-4-14 22:52:56 | 只看该作者
世界第一中二 发表于 2017-4-4 01:08
我也是萌新dasi!
先发个dalao的脚本抛砖引玉吧,看看还有没有别的dalao愿意给你更详细的解答

谢谢你!!
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 06:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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