查看: 2529|回复: 4

[已经解决] 如何释放一个技能实现两个技能

[复制链接]
梦石
0
星屑
319
在线时间
27 小时
注册时间
2021-8-13
回帖
2
发表于 2022-7-7 20:57:26 | 显示全部楼层 |阅读模式

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

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

×
假设有
技能<鼓舞>:使己方全体物攻上升
技能<恢复>:使己方全体恢复100HP
怎么做到在只释放技能<鼓舞>的前提下,同时实现技能<鼓舞>和<恢复>的效果
梦石
0
星屑
29901
在线时间
5734 小时
注册时间
2016-3-8
回帖
1653
发表于 2022-7-7 21:35:02 | 显示全部楼层
https://himeworks.com/2014/03/skill-links/[pre lang="ruby"]=begin
#===============================================================================
Title: Skill Links
Author: Hime
Date: Feb 15, 2015
URL: http://www.himeworks.com/2014/03/30/skill-links/
--------------------------------------------------------------------------------
** Change log
Feb 15, 2014
   - fixed typo
Dec 1, 2014
   - Implemented skill link conditions
Jul 14, 2014
   - skill links are not activated if there is no current action
Mar 30, 2014
   - Initial release
--------------------------------------------------------------------------------   
** Terms of Use
* Free to use in non-commercial projects
* Contact me for commercial use
* No real support. The script is provided as-is
* Will do bug fixes, but no compatibility patches
* Features may be requested but no guarantees, especially if it is non-trivial
* Credits to Hime Works in your project
* Preserve this header
--------------------------------------------------------------------------------
** Description

This script allows you to create "skill links" which are basically a way to
connect skill effects together.

Skill links are purely a development concept: they are created to allow you
to specify multiple behavior that should occur when a single skill is used.
In particular, it allows a single skill to execute damage formulas and effects
under different scopes.

For example, suppose you wanted to create a skill that damages the enemies,
but also heals all allies as a secondary effect. By default, there is no easy
way to accomplish this without resorting to common events or complex formulas,
and even that may have its own limitations.

However, there are few  things that you CAN do.
It is easy to create a skill that will damage all enemies
It is also easy to create a skill that will heal all allies.

This script introduces the link between the two skills: you simply specify the
healing skill as a "linked skill" to the damaging skill, and now whenever you
execute the damaging skill, the healing skill will automatically run as well.

--------------------------------------------------------------------------------
** Installation

In the script editor, place this script below Materials and above Main

--------------------------------------------------------------------------------
** Usage

To create a skill link, note-tag a skill or item with

   <link skill: ID>
   
Where ID is the ID of the skill you want to link.

You can also create item links. Note-tag a skill or item with

   <link item: ID>
   
Where ID is the ID of the item you want to link.

You can have items linked to skills, or skills linked to items.

-- Link Conditions --

You can create link conditions. These conditions specify whether the linked
skill or item will be executed. They will be executed only if the conditions
are met.

To create a link condition, use the note-tag

   <link condition: link_ID>
     FORMULA
   </link condition>
   
Where the link ID is the ID of the link data that you created earlier.
The ID is assigned based on the order that they appear, so the very first
<link skill> tag is ID 1, the next is ID 2, and so on.

The following variables are available

   a - action user
   b - action target
   p - game party
   t - game troop
   s - game switches
   v - game variables

--------------------------------------------------------------------------------
** Notes

This script does not play animations for skill links.

#===============================================================================
=end
$imported = {} if $imported.nil?
$imported[:TH_SkillLinks] = true
#===============================================================================
# ** Configuration
#===============================================================================
module TH
  module Skill_Links
    Regex = /<(link[-_ ]item|link[-_ ]skill):\s*(\d+)\s*>/i   
    Cond_Regex = /<link[-_ ]condition:\s*(\d+)\s*>(.*?)<\/link[-_ ]condition>/im
  end
end
#===============================================================================
# ** Rest of script
#===============================================================================
module RPG
  class UsableItem < BaseItem
   
    def skill_links
      load_notetag_skill_links unless @skill_links
      return @skill_links
    end
   
    def load_notetag_skill_links
      @skill_links = []
      results = self.note.scan(TH::Skill_Links::Regex)
      results.each do |res|
        data = Data_SkillLink.new
        data.id = res[1].to_i
        if res[0] =~ /skill/i
          data.type = :skill
        else
          data.type = :item
        end
        @skill_links << data
      end
      
      results = self.note.scan(TH::Skill_Links::Cond_Regex)
      results.each do |res|
        id = res[0].to_i
        cond = res[1].strip
        @skill_links[id-1].condition = cond
      end
    end
  end
end

class Data_SkillLink

  attr_accessor :id
  attr_accessor :type
  attr_accessor :condition
  
  def initialize
    @type = nil
    @id = 0
    @condition = ""
  end
  
  def item
    return $data_skills[@id] if @type == :skill
    return $data_items[@id] if @type == :item
  end
  
  def condition_met?(user, target)
    return true if @condition.empty?
    return eval_condition(user, target)
  end
  
  def eval_condition(a, b, p=$game_party, t=$game_troop, s=$game_switches, v=$game_variables)
    eval(@condition)
  end
end

class Scene_Battle < Scene_Base
  
  alias :th_skill_links_use_item :use_item
  def use_item
    th_skill_links_use_item
    check_item_links
  end

  def check_item_links
    return unless @subject.current_action
    item = @subject.current_action.item
    item.skill_links.each do |link_data|
      
      use_item_link(link_data)
    end
  end
  
  def use_item_link(link_data)
    link_item = link_data.item
    @subject.use_item(link_item)
    refresh_status
    if link_item.is_a?(RPG::Skill)
      @subject.current_action.set_skill(link_item.id)
    else
      @subject.current_action.set_item(link_item.id)
    end
    targets = @subject.current_action.make_targets.compact
    targets.each do |target|   
      link_item.repeats.times do
        next unless link_data.condition_met?(@subject, target)
        invoke_item(target, link_item)
      end
    end
  end
end[/pre]


欢迎加入群聊【RPG Maker 学习交流】:https://jq.qq.com/?_wv=1027&k=VUEWdwLl
回复

使用道具 举报

梦石
0
星屑
2085
在线时间
185 小时
注册时间
2022-6-24
回帖
148
发表于 2022-7-8 01:51:15 | 显示全部楼层
一次性放两个技能吗???
在尝试做游戏了,但还是个菜狗(结果现在编程,音乐和剧情设计没开始学,画画也暂时没时间学了(;д;))

(个人精神状况不是很好,有时会说出一些奇怪且根本没法理解意思的话,直接无视就好,如果说出的话不小心冒犯到你,我会在精神状况良好时和你道歉的(`・ω・´)(不过一般在感觉到不适时会直接下线,请勿过于担心))
回复

使用道具 举报

梦石
0
星屑
1844
在线时间
179 小时
注册时间
2018-12-28
回帖
52
发表于 2022-7-11 01:35:49 | 显示全部楼层
技能A的使用效果里,加上使用技能B的公共事件?
生若浮海,思如渡船。
回复

使用道具 举报

梦石
0
星屑
2085
在线时间
185 小时
注册时间
2022-6-24
回帖
148
发表于 2022-7-11 22:07:23 | 显示全部楼层
  1. #==============================================================================
  2. # ★ RGSS3_使用者効果 Ver1.01
  3. #==============================================================================
  4. =begin

  5. 作者:tomoaky
  6. webサイト:ひきも記は閉鎖しました。 (http://hikimoki.sakura.ne.jp/)

  7. スキルやアイテムに、対象への効果とは別に使用者への効果を追加できます

  8. スキル(アイテム)のメモ欄に <使用者効果 2> と書くことで
  9. (人话就是在技能里写备注ID,就能无显示使用其他技能)

  10. 2015/09/17  Ver1.01
  11. ・敵が逃げるとエラー落ちする不具合を修正

  12. 2013/06/18  Ver1.0
  13. 公開

  14. =end

  15. #==============================================================================
  16. # ■ Scene_Battle
  17. #==============================================================================
  18. class Scene_Battle < Scene_Base
  19.   #--------------------------------------------------------------------------
  20.   # ● スキル/アイテムの使用
  21.   #--------------------------------------------------------------------------
  22.   alias tmusereff_scene_battle_use_item use_item
  23.   def use_item
  24.     tmusereff_scene_battle_use_item
  25.     return unless @subject.current_action
  26.     item = @subject.current_action.item
  27.     if item.is_a?(RPG::UsableItem) && /<使用者効果\s*(\d+)\s*>/ =~ item.note
  28.       reaction_skill = $data_skills[$1.to_i]
  29.       @subject.item_apply(@subject, reaction_skill)
  30.       refresh_status
  31.       @log_window.display_action_results(@subject, reaction_skill)
  32.     end
  33.   end
  34. end

复制代码

经过大概的测试,大抵就是我写的注释的效果(日文机翻后还是搞不懂),应该符合你的要求,一次性两个效果
在尝试做游戏了,但还是个菜狗(结果现在编程,音乐和剧情设计没开始学,画画也暂时没时间学了(;д;))

(个人精神状况不是很好,有时会说出一些奇怪且根本没法理解意思的话,直接无视就好,如果说出的话不小心冒犯到你,我会在精神状况良好时和你道歉的(`・ω・´)(不过一般在感觉到不适时会直接下线,请勿过于担心))
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部