A Skill that throws enemies?
#2
(09-28-2024, 08:42 AM)Bennerdeben Wrote: If anyone knows ways to make this work, please let me know.

I kinda came up with ... something.  I call it "Collateral Damage"

Essentially, if a skill hits a target, one (or more depending on skill) also get hit.

Code:
module Collateral
  SKILLS = {}
 
 
 
  SKILLS[57] = false
  SKILLS[58] = true
 
 
 
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
#  This class deals with battlers. It's used as a superclass for the Game_Actor
#  and Game_Enemy classes.
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias collateral_init initialize
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :collateral_flag          # Collateral damage flag
  attr_accessor :collateral_qty_flag      # Collateral quantity flag
  attr_accessor :collateral_performed    # Collateral prevent looping
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Perform the original method
    collateral_init
    # New flags in play
    @collateral_flag      = false
    @collateral_qty_flag  = false
    collateral_performed  = false
  end
end


#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias collateral_update_phase4_step2 update_phase4_step2
  alias collateral_make_skill_action_result make_skill_action_result
  alias collateral_update_phase4_step3 update_phase4_step3
  alias collateral_update_phase4_step6 update_phase4_step6
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 2 : start action)
  #--------------------------------------------------------------------------
  def update_phase4_step2
    #
    # Clear new flags battler at each one's action start
    @active_battler.collateral_flag      = false
    @active_battler.collateral_qty_flag  = false
    @active_battler.collateral_performed  = false
    #
    # Perform the original method
    collateral_update_phase4_step2
    #
  end
  #--------------------------------------------------------------------------
  # * Make Skill Action Results
  #--------------------------------------------------------------------------
  def make_skill_action_result
    #
    # Only do this if not already performed (no looping)
    unless @active_battler.collateral_performed
      # Get the skill ID
      id = @active_battler.current_action.skill_id
      #
      # IF we did define a collateral skill)
      if Collateral::SKILLS.has_key?(id)
        # Set that there will be collateral damage
        @active_battler.collateral_flag = true
        # IF flag set to true, random number up to all party can be hit
        if Collateral::SKILLS[id] == true
          @active_battler.collateral_qty_flag = true
        end
      end
      #
    end
    # perform the original method
    collateral_make_skill_action_result
    #
  end
 
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 3 : animation for action performer)
  #--------------------------------------------------------------------------
  def update_phase4_step3
    #
    # Just skip the attacker animatics if we are performing a loop
    if @active_battler.collateral_performed == true
      @phase4_step = 4
      return
    end
    #
    # Perform the original method
    collateral_update_phase4_step3
    #
  end
 
 
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 6 : refresh)
  #--------------------------------------------------------------------------
  def update_phase4_step6
    #
    # ONLY if the collateral flag is true
    if @active_battler.collateral_flag == true
      #
      # Set flag showing collateral damage is performed (no looping)
      @active_battler.collateral_performed = true
      # Clear the old flag
      @active_battler.collateral_flag = false
     
     
      # If we have All targets hit
      if @active_battler.collateral_qty_flag == true
        #
        # Make temp copy of all battlers targeted
        old_battlers = @target_battlers
        # Clear targets
        @target_battlers = []
        # Push all not-hit targets (whether actor or enemy targets)
        if @active_battler.is_a?(Game_Actor)       
          for enemy in $game_troop.enemies
            next if old_battlers.include?(enemy)
            @target_battlers.push(enemy) if enemy.exist?
          end         
        else
          for actor in $game_party.actors
            next if old_battlers.include?(actor)
            @target_battlers.push(actor) if actor.exist?
          end 
        end
        #
      # Otherwise, ONE random person hit
      else
        # Get our already hit target
        old_index = @active_battler.current_action.target_index
        # Clear a temp list
        target_list = []
        # Branch on actor or enemy and populate with IDs
        if @active_battler.is_a?(Game_Actor)
          for i in 0...$game_troop.enemies.size
            next if i == old_index
            target_list.push(i)
          end
        else
          for i in 0...$game_party.actors.size
            next if i == old_index
            target_list.push(i)
          end
        end
        #
        # Randomly select an enemy
        target_id = rand(target_list.size-1)
        # And make it the new target
        @active_battler.current_action.target_index = target_list[target_id]
        #       
      end
      #
      # Refresh status window
      @status_window.refresh
      # Show skill name on help window
      @help_window.set_text(@skill.name, 1)
      # Set animation ID
      @animation1_id = @skill.animation1_id
      @animation2_id = @skill.animation2_id
      # Set command event ID
      @common_event_id = @skill.common_event_id
      # Set target battlers
      set_target_battlers(@skill.scope)
      # Apply skill effect
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
      # Shift to step 3
      @phase4_step = 3
      # Exit method
      return
      #
    end
    #
    # Perform the original method
    collateral_update_phase4_step6
    #
  end
end

The way THIS works...

It sees if a defined skill hits others.. collteral.   It then does the skill on the target.  THEN... it loops back and hits all the others AFTERWARDs.  Gives it a bit of a BAM! then a followed-up  BOOM! effect on everyone else. :D

When it DOES perform the original BAM! on the first target, that's when worked to select another target. I bypassed the scopes method which ... does no good here. And whether you randomly hit all party members or just one other party member, I worked to ensure the principle first enemy hit was not part of the group hit afterwards. AKA... you can't accidentally hit the same target twice with this attack.

Oh, but be warned... tied to skills, it should let enemies do the same to YOU!

As to a stun effect, well... that could merely be a state change you apply to the skill itself. Winking
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)

[Image: QrnbKlx.jpg]
[Image: sGz1ErF.png]    [Image: liM4ikn.png]    [Image: fdzKgZA.png]    [Image: sj0H81z.png]
[Image: QL7oRau.png]    [Image: uSqjY09.png]    [Image: GAA3qE9.png]    [Image: 2Hmnx1G.png]    [Image: BwtNdKw.png%5B]
  Above are clickable links
Reply }


Messages In This Thread
A Skill that throws enemies? - by Bennerdeben - 09-28-2024, 08:42 AM
RE: A Skill that throws enemies? - by DerVVulfman - 09-29-2024, 09:49 PM
RE: A Skill that throws enemies? - by Bennerdeben - 09-30-2024, 09:10 AM
RE: A Skill that throws enemies? - by DerVVulfman - 09-30-2024, 03:33 PM
RE: A Skill that throws enemies? - by Bennerdeben - 10-01-2024, 08:18 AM
RE: A Skill that throws enemies? - by DerVVulfman - 10-01-2024, 08:19 PM
RE: A Skill that throws enemies? - by Bennerdeben - 10-02-2024, 12:49 PM
RE: A Skill that throws enemies? - by DerVVulfman - 10-03-2024, 04:15 AM
RE: A Skill that throws enemies? - by Bennerdeben - 10-03-2024, 09:02 AM
RE: A Skill that throws enemies? - by DerVVulfman - 10-08-2024, 02:15 PM
RE: A Skill that throws enemies? - by Bennerdeben - 10-08-2024, 05:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Actors & enemies without Morale Bennerdeben 4 2,072 07-15-2023, 06:21 PM
Last Post: Bennerdeben
   [RMXP] Showing skill gained by leveling up on battle result FrQise 12 12,296 05-07-2021, 02:05 PM
Last Post: FrQise
   Skill Cooldown script Fenriswolf 11 16,101 12-10-2019, 11:10 AM
Last Post: Fenriswolf
   Scan skill should show states Tumen 5 9,071 05-02-2017, 03:33 AM
Last Post: DerVVulfman
   Dervvulfman's Skill Tree (Micko's) Passive Skill Malfunction! reiji1337 6 9,568 04-28-2017, 03:27 AM
Last Post: reiji1337
   RMXP SKill animations too bright (overlaying the battle screen) Starmage 4 10,024 06-13-2016, 03:41 AM
Last Post: Starmage
   Lycan abs - Making enemies flee on sight ChickenFetus 1 4,352 06-07-2016, 04:39 AM
Last Post: DerVVulfman
   Atoa ACBS HP Regen Skill Lightness 11 13,741 03-11-2016, 10:43 PM
Last Post: Lightness
   Inserting MOG Chain Commands in a particular Skill ID iceflux 6 12,656 08-27-2015, 06:33 PM
Last Post: iceflux
   Jumping Enemies? Bounty Hunter Lani 2 5,166 01-17-2015, 06:58 AM
Last Post: Bounty Hunter Lani



Users browsing this thread: 2 Guest(s)