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

Project1

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

[已经解决] 求一个攻击后触发技能的脚本(如有需求可悬赏)

[复制链接]

Lv2.观梦者

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

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

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

x
求教,一个攻击后随机触发技能的脚本。
流程如下:
攻击——判断技能1释放概率,满足则释放该技能,不满足则判断技能2释放概率——如上循环,直至判断技能4。故备注我认为是<randomskill:1,4,7,10,9>如此设置。
求该类脚本或悬赏该类脚本。

Lv3.寻梦者

闇吼者の災悪眷族
不気味存在締造者

梦石
0
星屑
1366
在线时间
2881 小时
注册时间
2014-7-29
帖子
6491
2
发表于 2014-12-16 12:27:09 | 只看该作者
本帖最后由 三途亚梦 于 2014-12-16 12:38 编辑

其实只要用公共事件结合脚本写法的强制战斗指令就可以做到这样的效果了呢。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
110
在线时间
121 小时
注册时间
2009-7-17
帖子
139
3
发表于 2014-12-16 16:52:38 | 只看该作者
在技能的备注栏里备注,具体方法下面有说明,虽然是英文,不过很简单,是在看不懂百度翻译就足够你用了
  1. #==============================================================================
  2.         #
  3.         # ▼ Yanfly Engine Ace - Follow-Up Skill v1.01
  4.         # -- Last Updated: 2012.02.12
  5.         # -- Level: Normal
  6.         # -- Requires: n/a
  7.         #
  8.         #==============================================================================
  9.        
  10.         $imported = {} if $imported.nil?
  11.         $imported["YEA-FollowUpSkill"] = true
  12.        
  13.         #==============================================================================
  14.         # ▼ Updates
  15.         # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16.         # 2012.02.12 - Bug Fixed: Follow Up skills do not stack with multi-hits.
  17.         # 2012.02.05 - Started Script and Finished.
  18.         #
  19.         #==============================================================================
  20.         # ▼ Introduction
  21.         # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22.         # This script allows for follow-up skills when the skill lands a successful hit
  23.         # (ie. no misses or evades). The script provides a chance to proceed with a
  24.         # follow-up skill or a guaranteed follow-up skill provided that the prior skill
  25.         # has successfully connected.
  26.         #
  27.         #==============================================================================
  28.         # ▼ Instructions
  29.         # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30.         # To install this script, open up your script editor and copy/paste this script
  31.         # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32.         #
  33.         # -----------------------------------------------------------------------------
  34.         # Skill Notetags - These notetags go in the skill notebox in the database.
  35.         # -----------------------------------------------------------------------------
  36.         # <follow up x>
  37.         # This causes the skill x to have a 100% chance of a follow-up upon usage of
  38.         # the current skill and the current skill landing a successful hit.
  39.         #
  40.         # <follow up x: y%>
  41.         # This causes the skill x to have y% chance of a follow-up upon usage of the
  42.         # current skill and the current skill landing a successful hit.
  43.         #
  44.         # <follow up state: x>
  45.         # <follow up all states: x, x>
  46.         # This causes the follow-up skill to require all of the states x to follow-up.
  47.         # If one state is missing, the follow-up skill will not occur. To add in more
  48.         # states required, insert multiples of this notetag.
  49.         #
  50.         # <follow up any states: x, x>
  51.         # This causes the follow-up skill to require at least one of the listed states
  52.         # x to follow-up. If all states are missing, the follow-up skill will not
  53.         # occur. To add in more states required, insert multiples of this notetag.
  54.         #
  55.         # <follow up switch: x>
  56.         # <follow up all switch: x, x>
  57.         # This causes the follow-up skill to require all switches x to be ON before the
  58.         # skill will follow-up. If one switch is OFF, the follow-up skill will not
  59.         # occur. To add in more switches required, insert multiples of this notetag.
  60.         #
  61.         # <follow up any switch: x, x>
  62.         # This causes the follow-up skill to require at least one of the listed
  63.         # switches to be ON before the the follow-up skill will occur. If all switches
  64.         # are off, the follow-up skill will not occur. To add in more switches required
  65.         # insert multiples of this notetag.
  66.         #
  67.         # <follow up eval>
  68.         # string
  69.         # string
  70.         # </follow up eval>
  71.         # For the more advanced users, replace string with code to determine whether
  72.         # or not the skill will follow-up. If multiple lines are used, they are all
  73.         # considered part of the same line.
  74.         #
  75.         #==============================================================================
  76.         # ▼ Compatibility
  77.         # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  78.         # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  79.         # it will run with RPG Maker VX without adjusting.
  80.         #
  81.         #==============================================================================
  82.         # ▼ Editting anything past this point may potentially result in causing
  83.         # computer damage, incontinence, explosion of user's head, coma, death, and/or
  84.         # halitosis so edit at your own risk.
  85.         #==============================================================================
  86.        
  87.         module YEA
  88.         module REGEXP
  89.         module SKILL
  90.        
  91.         FOLLOWUP = /<(?:FOLLOW_UP|follow up)[ ](\d+)>/i
  92.         FOLLOWUP_CHANCE = /<(?:FOLLOW_UP|follow up)[ ](\d+):[ ](\d+)([%%])>/i
  93.         FOLLOWUP_STATES =
  94.         /<(?:FOLLOW_UP_STATE|follow up state):[ ](\d+(?:\s*,\s*\d+)*)>/i
  95.         FOLLOWUP_ALL_STATES =
  96.         /<(?:FOLLOW_UP_ALL_STATES|follow up all states):[ ](\d+(?:\s*,\s*\d+)*)>/i
  97.         FOLLOWUP_ANY_STATES =
  98.         /<(?:FOLLOW_UP_ANY_STATES|follow up any states):[ ](\d+(?:\s*,\s*\d+)*)>/i
  99.         FOLLOWUP_SWITCH =
  100.         /<(?:FOLLOW_UP_SWITCH|follow up switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  101.         FOLLOWUP_ALL_SWITCH =
  102.         /<(?:FOLLOW_UP_ALL_SWITCH|follow up all switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  103.         FOLLOWUP_ANY_SWITCH =
  104.         /<(?:FOLLOW_UP_ANY_SWITCH|follow up any switch):[ ](\d+(?:\s*,\s*\d+)*)>/i
  105.         FOLLOWUP_EVAL_ON = /<(?:FOLLOW_UP_EVAL|follow up eval)>/i
  106.         FOLLOWUP_EVAL_OFF = /<\/(?:FOLLOW_UP_EVAL|follow up eval)>/i
  107.        
  108.         end # SKILL
  109.         end # REGEXP
  110.         end # YEA
  111.        
  112.         #==============================================================================
  113.         # ■ DataManager
  114.         #==============================================================================
  115.        
  116.         module DataManager
  117.        
  118.         #--------------------------------------------------------------------------
  119.         # alias method: load_database
  120.         #--------------------------------------------------------------------------
  121.         class <<self; alias load_database_fus load_database; end
  122.         def self.load_database
  123.         load_database_fus
  124.         load_notetags_fus
  125.         end
  126.        
  127.         #--------------------------------------------------------------------------
  128.         # new method: load_notetags_fus
  129.         #--------------------------------------------------------------------------
  130.         def self.load_notetags_fus
  131.         for obj in $data_skills
  132.         next if obj.nil?
  133.         obj.load_notetags_fus
  134.         end
  135.         end
  136.        
  137.         end # DataManager
  138.        
  139.         #==============================================================================
  140.         # ■ RPG::BaseItem
  141.         #==============================================================================
  142.        
  143.         class RPG::Skill < RPG::UsableItem
  144.        
  145.         #--------------------------------------------------------------------------
  146.         # public instance variables
  147.         #--------------------------------------------------------------------------
  148.         attr_accessor :follow_up
  149.         attr_accessor :follow_chance
  150.         attr_accessor :follow_states_all
  151.         attr_accessor :follow_states_any
  152.         attr_accessor :follow_switch_all
  153.         attr_accessor :follow_switch_any
  154.         attr_accessor :follow_eval
  155.        
  156.         #--------------------------------------------------------------------------
  157.         # common cache: load_notetags_fus
  158.         #--------------------------------------------------------------------------
  159.         def load_notetags_fus
  160.         @follow_up = 0
  161.         @follow_chance = 1.0
  162.         @follow_states_all = []
  163.         @follow_states_any = []
  164.         @follow_switch_all = []
  165.         @follow_switch_any = []
  166.         @follow_eval = ""
  167.         @follow_eval_on = false
  168.         #---
  169.         self.note.split(/[\r\n]+/).each { |line|
  170.         case line
  171.         #---
  172.         when YEA::REGEXP::SKILL::FOLLOWUP
  173.         @follow_up = $1.to_i
  174.         @follow_chance = 1.0
  175.         when YEA::REGEXP::SKILL::FOLLOWUP_CHANCE
  176.         @follow_up = $1.to_i
  177.         @follow_chance = $2.to_i * 0.01
  178.         #---
  179.         when YEA::REGEXP::SKILL::FOLLOWUP_STATES
  180.         $1.scan(/\d+/).each { |num|
  181.         @follow_states_all.push(num.to_i) if num.to_i > 0 }
  182.         when YEA::REGEXP::SKILL::FOLLOWUP_ALL_STATES
  183.         $1.scan(/\d+/).each { |num|
  184.         @follow_states_all.push(num.to_i) if num.to_i > 0 }
  185.         when YEA::REGEXP::SKILL::FOLLOWUP_ANY_STATES
  186.         $1.scan(/\d+/).each { |num|
  187.         @follow_states_any.push(num.to_i) if num.to_i > 0 }
  188.         #---
  189.         when YEA::REGEXP::SKILL::FOLLOWUP_SWITCH
  190.         $1.scan(/\d+/).each { |num|
  191.         @follow_switch_all.push(num.to_i) if num.to_i > 0 }
  192.         when YEA::REGEXP::SKILL::FOLLOWUP_ALL_SWITCH
  193.         $1.scan(/\d+/).each { |num|
  194.         @follow_switch_all.push(num.to_i) if num.to_i > 0 }
  195.         when YEA::REGEXP::SKILL::FOLLOWUP_ANY_SWITCH
  196.         $1.scan(/\d+/).each { |num|
  197.         @follow_switch_any.push(num.to_i) if num.to_i > 0 }
  198.         #---
  199.         when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_ON
  200.         @follow_eval_on = true
  201.         when YEA::REGEXP::SKILL::FOLLOWUP_EVAL_OFF
  202.         @follow_eval_off = false
  203.         #---
  204.         else
  205.         @follow_eval += line.to_s if @follow_eval_on
  206.         end
  207.         } # self.note.split
  208.         #---
  209.         end
  210.        
  211.         end # RPG::Skill
  212.        
  213.         #==============================================================================
  214.         # ■ Game_Action
  215.         #==============================================================================
  216.        
  217.         class Game_Action
  218.        
  219.         #--------------------------------------------------------------------------
  220.         # public instance variables
  221.         #--------------------------------------------------------------------------
  222.         attr_accessor :follow_up
  223.        
  224.         end # Game_Action
  225.        
  226.         #==============================================================================
  227.         # ■ Game_Battler
  228.         #==============================================================================
  229.        
  230.         class Game_Battler < Game_BattlerBase
  231.        
  232.         #--------------------------------------------------------------------------
  233.         # alias method: item_user_effect
  234.         #--------------------------------------------------------------------------
  235.         alias game_battler_item_user_effect_fus item_user_effect
  236.         def item_user_effect(user, item)
  237.         game_battler_item_user_effect_fus(user, item)
  238.         user.process_follow_up_skill(item)
  239.         end
  240.        
  241.         #--------------------------------------------------------------------------
  242.         # new method: process_follow_up_skill
  243.         #--------------------------------------------------------------------------
  244.         def process_follow_up_skill(item)
  245.         return unless meet_follow_up_requirements?(item)
  246.         action = Game_Action.new(self)
  247.         action.set_skill(item.follow_up)
  248.         if current_action.nil?
  249.         action.decide_random_target
  250.         else
  251.         action.target_index = current_action.target_index
  252.         end
  253.         @actions.insert(1, action)
  254.         @actions[1].follow_up = true
  255.         end
  256.        
  257.         #--------------------------------------------------------------------------
  258.         # new method: meet_follow_up_requirements?
  259.         #--------------------------------------------------------------------------
  260.         def meet_follow_up_requirements?(item)
  261.         return false if item.nil?
  262.         return false unless item.is_a?(RPG::Skill)
  263.         return false if @actions[1] != nil && @actions[1].follow_up
  264.         return false if $data_skills[item.follow_up].nil?
  265.         return false unless follow_up_all_states?(item)
  266.         return false unless follow_up_any_states?(item)
  267.         return false unless follow_up_all_switch?(item)
  268.         return false unless follow_up_any_switch?(item)
  269.         return false unless follow_up_eval?(item)
  270.         return rand < item.follow_chance
  271.         end
  272.        
  273.         #--------------------------------------------------------------------------
  274.         # new method: follow_up_all_states?
  275.         #--------------------------------------------------------------------------
  276.         def follow_up_all_states?(item)
  277.         for state_id in item.follow_states_all
  278.         next if $data_states[state_id].nil?
  279.         return false unless state?(state_id)
  280.         end
  281.         return true
  282.         end
  283.        
  284.         #--------------------------------------------------------------------------
  285.         # new method: follow_up_any_states?
  286.         #--------------------------------------------------------------------------
  287.         def follow_up_any_states?(item)
  288.         return true if item.follow_states_any == []
  289.         for state_id in item.follow_states_any
  290.         next if $data_states[state_id].nil?
  291.         return true if state?(state_id)
  292.         end
  293.         return false
  294.         end
  295.        
  296.         #--------------------------------------------------------------------------
  297.         # new method: follow_up_all_switch?
  298.         #--------------------------------------------------------------------------
  299.         def follow_up_all_switch?(item)
  300.         for switch_id in item.follow_switch_all
  301.         return false unless $game_switches[switch_id]
  302.         end
  303.         return true
  304.         end
  305.        
  306.         #--------------------------------------------------------------------------
  307.         # new method: follow_up_any_switch?
  308.         #--------------------------------------------------------------------------
  309.         def follow_up_any_switch?(item)
  310.         return true if item.follow_switch_all == []
  311.         for switch_id in item.follow_switch_all
  312.         return true if $game_switches[switch_id]
  313.         end
  314.         return false
  315.         end
  316.        
  317.         #--------------------------------------------------------------------------
  318.         # new method: follow_up_eval?
  319.         #--------------------------------------------------------------------------
  320.         def follow_up_eval?(item)
  321.         return true if item.follow_eval == ""
  322.         return eval(item.follow_eval)
  323.         end
  324.        
  325.         end # Game_Battler
  326.        
  327.         #==============================================================================
  328.         #
  329.         # ▼ End of File
  330.         #
  331.         #==============================================================================
复制代码

点评

谢谢,认可该楼  发表于 2014-12-16 19:04
认可该楼  发表于 2014-12-16 19:02

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-21 23:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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