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

Project1

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

[有事请教] 技能/物品范围设定为不含使用者的单个队友

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1141
在线时间
158 小时
注册时间
2008-1-19
帖子
22
跳转到指定楼层
1
发表于 前天 09:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
VA默认的技能范围“单个队友”也可以选择使用者自身,但有些技能不适合做成可对自己使用(如使队友行动2次),尤其是在由敌人AI使用这些技能时如果选择自己十分违和。这个应该如何实现。
之前试着修改了技能实际作用的对象,但发现对敌人用的技能无效。希望能在选择时就把使用者自身排除出范围。

Lv5.捕梦者

梦石
0
星屑
26531
在线时间
5324 小时
注册时间
2016-3-8
帖子
1661
2
发表于 2 小时前 | 只看该作者
本帖最后由 alexncf125 于 2025-7-28 20:30 编辑

RUBY 代码复制
  1. =begin
  2.  
  3. - 技能效果范围:除自身外的单个队友 - What a silly title!
  4. - Made by: Sixth
  5.  
  6. - Description
  7.  
  8. This script will let you make a new scope for your skills (kinda).
  9. That scope will let the player target anyone from an ally except the user.
  10.  
  11. 首先,你需要将技能的效果范围设定为【单个队友】,然后添加技能备注:
  12.  
  13.   <非自身单个队友>
  14.  
  15. This will setup the new scope for the skill. It will work in the menu outside
  16. the battles too, but only on skills.(地图菜单中也会生效,但仅技能)
  17. Due to how the user is set for the items in the item menu (the member with the
  18. highest PHA stat will be the user every time you use an item), it wouldn't make
  19. much sense to enable this new scope there (but if you still used the mentioned
  20. note-tag on an item with the "One Ally" scope, it will function as expected
  21. during battles, so the user will not be able to use the item on him/herself.
  22.  
  23. As a necessary fix, I also made enemies not target the last troop member every
  24. time they use a skill with the "One Ally" scope. Instead, they will now target
  25. random allies, but if the used skill got the <one_ally_no_user> note-tag, they
  26. won't be able to target themselves with the skill.(脚本作者还修正了敌人使用
  27. 【单个队友】技能时只会对准最后一个敌群敌人的问题,当敌人使用带<非自身单个队友>备注
  28. 的技能时,会选择随机目标)
  29.  
  30. This is tested without any custom battle scripts, so there is no guarantee that
  31. it will work with those!
  32.  
  33. =end
  34.  
  35. class RPG::UsableItem < RPG::BaseItem
  36.  
  37.   attr_accessor :one_no_user
  38.  
  39.   def one_no_user
  40.     init_one_no_user if @one_no_user.nil?
  41.     return @one_no_user
  42.   end
  43.  
  44.   def init_one_no_user
  45.     @one_no_user = @note =~ /<非自身单个队友>/i ? true : false
  46.   end
  47.  
  48. end
  49.  
  50. class Game_Action
  51.  
  52.   alias check_no_user1232 item_target_candidates
  53.   def item_target_candidates
  54.     trgs = check_no_user1232
  55.     trgs.delete(subject) if item.one_no_user && item.for_one?
  56.     return trgs
  57.   end
  58.  
  59.   alias check_no_user1132 targets_for_friends
  60.   def targets_for_friends
  61.     if subject.is_a?(Game_Enemy) && item.scope == 7
  62.       ids = []
  63.       friends_unit.alive_members.each_with_index do |mem,i|
  64.         next if item.one_no_user && mem == subject
  65.         ids << $game_troop.members.index(mem)
  66.       end
  67.       @target_index = ids.sample
  68.     end
  69.     trgs = check_no_user1132
  70.     return trgs
  71.   end
  72.  
  73. end
  74.  
  75. class Game_BattlerBase
  76.  
  77.   alias check_no_user7541 usable?
  78.   def usable?(item)
  79.     return false if item.nil? || (item.one_no_user && friends_unit.alive_members.size <= 1)
  80.     check_no_user7541(item)
  81.   end
  82.  
  83. end
  84.  
  85. class Game_Actor < Game_Battler
  86.  
  87.   alias check_no_user9265 item_test
  88.   def item_test(user, item)
  89.     return false if item.one_no_user && self == user
  90.     check_no_user9265(user, item)
  91.   end
  92.  
  93. end
  94.  
  95. class Window_BattleActor < Window_BattleStatus
  96.  
  97.   def draw_actor_name(actor, x, y, width = 112)
  98.     if BattleManager.actor && BattleManager.actor.input.item.one_no_user &&
  99.        actor == BattleManager.actor
  100.        act_enable = false
  101.      else
  102.        act_enable = true
  103.     end
  104.     change_color(hp_color(actor),act_enable)
  105.     draw_text(x, y, width, line_height, actor.name)
  106.   end
  107.  
  108.   def current_item_enabled?
  109.     if BattleManager.actor && BattleManager.actor.input.item.one_no_user &&
  110.        $game_party.members[@index] == BattleManager.actor
  111.       return false
  112.     else
  113.       super
  114.     end
  115.   end
  116.  
  117. end
  118.  
  119. class Scene_Skill < Scene_ItemBase
  120.  
  121.   alias check_no_user8826 use_item
  122.   def use_item
  123.     if item.one_no_user && user == $game_party.members[@actor_window.index]
  124.       return Sound.play_buzzer
  125.     end
  126.     check_no_user8826
  127.   end
  128.  
  129. end
  130.  
  131. class Scene_Battle < Scene_Base
  132.  
  133.   alias check_no_user5413 on_actor_ok
  134.   def on_actor_ok
  135.     if BattleManager.actor.input.item.one_no_user &&
  136.        BattleManager.actor == $game_party.battle_members[@actor_window.index]
  137.       return Sound.play_buzzer
  138.     end
  139.     check_no_user5413
  140.   end  
  141.  
  142. end
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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