Script Request: Damage Sequence ADD ON - True "Random Targeting" per each hit of a sequence

Good morning / Afternoon / evening , everyone.

I am in need of your assistance once again.

I suppose I should also let you know that I am using Lecode's Damage Sequence

if true #============================================================================== #- Damage Sequence #- By Lecode #- Version 1.1 #------------------------------------------------------------------------------ # This script allows you to synchronize skills and items' damage with their # animations. To put it simply, the player can now deal damage # during an animation. Thus, you can decide to make # real multiple-hits skills or to deal damage at # a specifique frame. (animation's frame) #------------------------------------------------------------------------------ # INSTRUCTION: Skills and Items notetags #------------------------------------------------------------------------------ # The tag is: # <damage sequence> # [frame,formula,effects?,crit?,never_miss?] # [frame,formula,effects?,crit?,never_miss?] # ...... # </damage sequence> # # Specify the frames where damages are dealt. # You can also specify if you allow the skill/item to: # - Apply effects (effects?) # - Try to crit (crit?) # - Certain hit (nerver_miss?) # Also, you can set a custom damage formula for that specific frame. # Replace "formula" with "" or nil to use the default formula. # Example: =begin <damage sequence> [2, nil, false, true, false] [5,"a.agi*3", true, false, true] [10,"", false, true, false] </damage sequence> Inflicts damage at frames 2, 5 and 10. The first hit use the default formula and doesn't apply effects. The second one use a special formula (a.agi*3), apply effects, is garanted, but can't try a critical effect. The last hit use the default formula and doesn't apply effects. =end #------------------------------------------------------------------------------ # Notes #------------------------------------------------------------------------------ # The script is compatible with the default battle system and # with Yanfly's battle engine. # Let me know if you face some compatibility issues. # PERHAPS I will solve them. #------------------------------------------------------------------------------ # Terms of Use #------------------------------------------------------------------------------ # Credits to Lecode # Free for non-commercial projects # Contact me for commercial use #------------------------------------------------------------------------------ # Versions: # 1.0 - Initial release # 1.1 - Added the possibility to control critical # and guaranted hits, and formula. Also, merge all tags into # an unique one. #============================================================================== $imported = {} if $imported.nil? module Lecode module DamageSequence Allow_Blink_Effects = false end end #============================================================================== class RPG::UsableItem attr_accessor :leds_frame def leds_initialize @leds_frame = -1 @dmg_sequence = [] @formula_sequence = Hash.new(@damage.formula) @effects_sequence = Hash.new(true) @crit_sequence = Hash.new(true) @nvmiss_sequence = Hash.new(false) #- read = false lines = [] self.note.split(/[\r\n]+/).each { |line| case line when /<damage sequence>/ read = true when /<\/damage sequence>/ read = false else if read lines.push(line) end end } #- lines.each { |line| array = eval(line.gsub("\s","")) frame = array[0] formula = array[1] @dmg_sequence.push(frame) @formula_sequence[frame] = formula if !formula.nil? && formula != "" @effects_sequence[frame] = array[2] @crit_sequence[frame] = array[3] @nvmiss_sequence[frame] = array[4] } end def leds_hit?(frame) @dmg_sequence.include?(frame) end def leds_effects? @effects_sequence[@leds_frame] end def leds_crit? @crit_sequence[@leds_frame] end def leds_nvmiss? @nvmiss_sequence[@leds_frame] end def leds_formula @formula_sequence[@leds_frame] end def leds_valid? self.note =~ /<damage sequence>/i end end class Scene_Battle alias ledmgseq_create_spriteset create_spriteset def create_spriteset ledmgseq_create_spriteset #- Attach actors to their sprites @spriteset.leds_update_actor_sprites end alias ledmgseq_use_item use_item def use_item $game_temp.leds_from_default_method = true ledmgseq_use_item $game_temp.leds_from_default_method = false end alias ledmgseq_show_anim show_animation def show_animation(targets, animation_id) item = @subject.current_action.item #- before_ledmg_sequence(item,targets) ledmgseq_show_anim(targets, animation_id) after_ledmg_sequence(item,targets) end def before_ledmg_sequence(item,targets) #- Prepare the sequence return unless item.leds_valid? ndata = {:user => @subject, :item => item} targets.each { |target| sprite = target.leds_sprite next if sprite.nil? sprite.set_leds_data(ndata) target.under_leds = true } end def after_ledmg_sequence(item,targets) #- End of sequence return unless item.leds_valid? targets.each { |target| sprite = target.leds_sprite next if sprite.nil? sprite.reset_leds_data target.under_leds = false } end alias ledmgseq_invoke_item invoke_item def invoke_item(target, item) #- Prevent tagged skills to deal damage #- in a normal way if item.leds_valid? && !$imported["YEA-BattleEngine"] return if $game_temp.leds_from_default_method end ledmgseq_invoke_item(target, item) end #- Another prevention in case of #- Yea BattleEngine is used alias ledmgseq_ica invoke_counter_attack def invoke_counter_attack(target,item) if $imported["YEA-BattleEngine"] if item.leds_valid? return if $game_temp.leds_from_default_method end end ledmgseq_ica(target,item) end #- Another prevention in case of #- Yea BattleEngine is used alias ledmgseq_imr invoke_magic_reflection def invoke_magic_reflection(target,item) if $imported["YEA-BattleEngine"] if item.leds_valid? return if $game_temp.leds_from_default_method end end ledmgseq_imr(target,item) end #- Another prevention in case of #- Yea BattleEngine is used alias ledmgseq_aie apply_item_effects def apply_item_effects(target,item) if $imported["YEA-BattleEngine"] if item.leds_valid? return if $game_temp.leds_from_default_method end end ledmgseq_aie(target,item) end #- Called by Sprite_Battler def execute_ledmg_sequence(target,user,item,frame) return unless item.leds_hit?(frame) #- Process Hit item.leds_frame = frame item.damage.formula = item.leds_formula $game_temp.leds_from_default_method = false if $imported["YEA-BattleEngine"] #- Use a special method invoke_item_single_hit(target,item) else #- Use the default method for compatibility #- purposes invoke_item(target,item) end $game_temp.leds_from_default_method = true item.leds_frame = -1 end def invoke_item_single_hit(target, item) if rand < target.item_cnt(@subject, item) invoke_counter_attack(target, item) elsif rand < target.item_mrf(@subject, item) invoke_magic_reflection(target, item) else apply_item_effects(apply_substitute(target, item), item) end @subject.last_target_index = target.index end alias ledmgseq_check_substitute check_substitute def check_substitute(target, item) return false if item.leds_nvmiss? ledmgseq_check_substitute(target, item) end end class Game_Battler attr_accessor :under_leds attr_accessor :leds_fix_targets alias ledmgseq_initialize initialize def initialize(*args) @under_leds = false ledmgseq_initialize(*args) end def leds_sprite scene = SceneManager.scene return nil unless SceneManager.scene_is?(Scene_Battle) return scene.spriteset.actor_sprites.find { |s| s.leds_battler == self } if actor? return scene.spriteset.enemy_sprites.find { |s| s.leds_battler == self } end alias ledmgseq_iea item_effect_apply def item_effect_apply(user, item, effect) ledmgseq_iea(user, item, effect) if item.leds_effects? #- Fix: Yea's BE pops a "NULL" @result.clear if $imported["YEA-BattleEngine"] end alias ledmgseq_iue item_user_effect def item_user_effect(user, item) ledmgseq_iue(user, item) if item.leds_effects? #- Fix: Yea's BE pops a "NULL" @result.clear if $imported["YEA-BattleEngine"] end alias ledmgseq_item_hit item_hit def item_hit(user,item) return 1 if item.leds_nvmiss? ledmgseq_item_hit(user,item) end alias ledmgseq_item_eva item_eva def item_eva(user,item) return 0 if item.leds_nvmiss? ledmgseq_item_eva(user,item) end alias ledmgseq_item_cri item_cri def item_cri(user,item) return 0 unless item.leds_crit? ledmgseq_item_cri(user,item) end end class Game_Actor alias ledmgseq_pde perform_damage_effect def perform_damage_effect ledmgseq_pde return unless @under_leds return if Lecode::DamageSequence::Allow_Blink_Effects @sprite_effect_type = nil end end class Game_Enemy alias ledmgseq_pde perform_damage_effect def perform_damage_effect ledmgseq_pde return unless @under_leds return if Lecode::DamageSequence::Allow_Blink_Effects @sprite_effect_type = nil end end class Sprite_Battler attr_accessor :leds_battler attr_reader :leds_data alias ledmgseq_initialize initialize def initialize(*args) ledmgseq_initialize(*args) @leds_data = {} @leds_battler = nil return if @battler.nil? @leds_battler = @battler end def set_leds_data(data) @leds_data = data end def reset_leds_data @leds_data.clear end alias ledmgseq_update_animation update_animation def update_animation ledmgseq_update_animation return unless animation? if @ani_duration % @ani_rate == 0 if @ani_duration > 0 #- Call damage for each frame call_ledmg_sequence end end end def call_ledmg_sequence frame_index = @animation.frame_max frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate #- call damage sequence unless cant_call_ledmg_sequence? user = @leds_data[:user] item = @leds_data[:item] scene = SceneManager.scene scene.execute_ledmg_sequence(@leds_battler,user,item,frame_index) end end def cant_call_ledmg_sequence? return true if @leds_data.empty? return true if @leds_battler.nil? return true unless SceneManager.scene_is?(Scene_Battle) return false end end class Game_Temp attr_accessor :leds_from_default_method alias ledmgseq_initialize initialize def initialize @leds_from_default_method = false ledmgseq_initialize end end class Spriteset_Battle attr_reader :actor_sprites attr_reader :enemy_sprites def leds_update_actor_sprites $game_party.battle_members.each_with_index { |m,i| sprite = @actor_sprites[i] next if sprite.nil? sprite.leds_battler = m } end end module DataManager class <<self; alias ledmgseq_load_database load_database; end def self.load_database ledmgseq_load_database ($data_skills+$data_items).each { |obj| next if obj.nil? obj.leds_initialize } end end # DataManager end

I am using this to time damage registry with animation frames. I am trying to implement spells kind of like Meteor from FF8 that targets randomly each time.

I also tried to use Yanfly's target manager but it didn't seem to work either

RPG maker by default only targets 1 random enemy but the next hits target the same enemy

What I'm trying to do is to make it so that the in the damage sequence registry will indeed at my command target a random foe per every hit, not the same foe, but a different random foe for each hit.

Is this possible to achieve?

Any help would be greatly appreciated!!
Yanfly's target manager includes the notetag <targets: target x random foes> which should be doing exactly what you're asking for. If it doesn't, you need to be asking for support with that script as something in your project isn't working correctly.
What happens if you have the skill set to one random enemy and does a repeat X times?
What happens if you have the skill set to one random enemy and does a repeat X times?
it just repeats the damage on the same enemy it chose randomly...

I wanted to make it with the damage sequence so that it will hit like this


for example:


first meteor hits enemy 1, will hit enemy 1 again, but then it hits enemy 2, then 3, then 1 then 2 again. in a random manner.

Maybe could you guys just add an addon for Lecode's script that allows me to notetag a skill to IGNORE the default scope target and target each enemy randomly... I understand this may be maybe impossible of course! I appreciate any help.

Basically the attack will target 1 Random foe PER EVERY sequencial hit! That is why I think the Damage Sequence script should be kept in mind for making this work...!
it just repeats the damage on the same enemy it chose randomly...

I wanted to make it with the damage sequence so that it will hit like this


for example:


first meteor hits enemy 1, will hit enemy 1 again, but then it hits enemy 2, then 3, then 1 then 2 again. in a random manner.

Maybe could you guys just add an addon for Lecode's script that allows me to notetag a skill to IGNORE the default scope target and target each enemy randomly... I understand this may be maybe impossible of course! I appreciate any help.

Basically the attack will target 1 Random foe PER EVERY sequencial hit! That is why I think the Damage Sequence script should be kept in mind for making this work...!

bump

at the risk of sounding cheesy (no intention on being rude)

C'mon guys help a brotha out !! 🙂
RPG maker by default only targets 1 random enemy but the next hits target the same enemy
No it doesn't.

That only happens if you set the Scope to "1 Random Enemy" and try to make the Repeats count more than 1.

On the hand, setting the Scope to "2 Random Enemies" or "3 Random Enemies" or "4 Random Enemies" makes it target a random enemy for the 2nd and 3rd and 4th hits.

You're not supposed to use Repeats with it. If you use Repeats with 4 Random Enemies, it will just select one random target, repeat X number times on it and then select target #2 and repeat and etc etc for random target #3 and #4.

You only get a maximum of 4 hits with "4 Random Enemies", but it will be a random enemy every time (insofar as whatever RNG function the engine uses makes it random). Yanfly's Target Manager is supposed to let you set it to more than 4, but I don't know how it works, I have never used it.

The script you are using is supposed to be compatible with Yanfly's Battle Engine, so I'd be surprised if it actually doesn't work with the Target Manager.
One bumpy boy.

As you can see, I still wasn't able to make it work... Okay. Let us say you have a spell like Meteor from FF.

Each meteor when it hits the ground it damages a random enemy.

I would like an ADD ON for the damage sequence script that would allow me to create a SEQUENCE in which for example:

<damage sequence>
[16, nil, true, true, false, random target] would target enemy 1 eg.
[26, nil, true, true, false, random target] would target enemy 2 eg.
[36, nil, true, true, false, random target] would target enemy 3 eg.
[46, nil, true, true, false, random target] would target enemy 2 eg.
[56, nil, true, true, false, random target] would target enemy 2 eg.
</damage sequence>

If I manage to accomplish this my battle system would be set up completely.

So any assistance is greatly appreciated. I have faith that I can achieve this with a little help.
bump

Original thread: https://forums.rpgmakerweb.com/threads/script-request-damage-sequence-add-on-true-random-targeting-per-each-hit-of-a-sequence.134564/