Mr. Mo v 5.5 + Immense Events
#17
Okey I checked this and... we have still problem but in this time I show You this in movie and some pictures.


https://www.mediafire.com/file/djxjqck5a...m.mp4/file


As you can see in the video, the huge event still takes no damage and the arrow passes through it instead of being removed on contact and dealing damage.


Okay I solved this problem like this:

Code:
#==============================================================================
# ** MrMo's Immense Events Patch
#------------------------------------------------------------------------------
#    by DerVVulfman
#    version 1.2
#    10-30-2024
#    RGSS / RPGMaker XP
#
#==============================================================================
#
#  INSTALLATION:
#
#  The Immense Events script must be below MrMo's ABS.
#  This patch goes below both.
#  Par-tay!
#
#------------------------------------------------------------------------------
#
#  USAGE:
#
#  Apply the 'size' command used by Immense Events to the 'first page' in any
#  enemy event.  The size is only defined once for any event and won't reset.
#  Using the 'size' command multiple times for an event changing its graphics
#  will not function.
#
#------------------------------------------------------------------------------


#==============================================================================
# ** MrMo_ABS
#------------------------------------------------------------------------------
#  This class deals with the Action Battle System and controls all Player,
#  Enemy and Companion Actions on the map.
#==============================================================================

class MrMo_ABS
  #--------------------------------------------------------------------------
  # * In Direction?(source, target) - Near Fantastica
  #    source : source of search (object performing test)
  #    target : target of search (object being searched)
  #--------------------------------------------------------------------------
  def in_direction?(source, target)
    #
    # Obtain size differences
    change          = get_size(target)
    o_ch_x, o_ch_y  = change[0], change[1]
    #
    # Get facing direction of search source
    dir = source.direction
    #
    # Cycle through object/target x coordinates
    for x in (target.x - o_ch_x)..(target.x + o_ch_x)
      # Return with success based on direction and coordinates
      return true if dir == 2 and source.y <= target.y and source.x == x
      return true if dir == 8 and source.y >= target.y and source.x == x
    end
    #
    # Cycle through object/target y coordinates
    for y in (target.y - o_ch_y)..(target.y)
      # Return with success based on direction and coordinates
      return true if dir == 4 and source.x >= target.x and source.y == y
      return true if dir == 6 and source.x <= target.x and source.y == y
    end
    #
    # Return failed
    return false
    #
  end
  #--------------------------------------------------------------------------
  # * In Range?(Element, Object, Range) - Near Fantastica
  #    source : source of search (object performing test)
  #    target : target of search (object being searched)
  #    range  : range distance in tiles
  #--------------------------------------------------------------------------
  def in_range?(source, target, range)
    #
    # Get differences
    change          = get_size(source)
    s_ch_x, s_ch_y  = change[0], change[1]
    change          = get_size(target)
    t_ch_x, t_ch_y  = change[0], change[1]
    #
    # Loop through source and target coordinates with tile extensions
    for xs in (source.x - s_ch_x)..(source.x + s_ch_x)
      for xt in (target.x - t_ch_x)..(target.x + t_ch_x)
        for ys in (source.y - s_ch_y)..(source.y)
          for yt in (target.y - t_ch_y)..(target.y)
            #
            # Confirm if updated coordinates are within the range test
            return true if in_range_numeric?(xs, ys, xt, yt, range)
            #
          end
        end
      end
    end
    #
    # Exit method with no confirmation
    return false
    #
  end
  #--------------------------------------------------------------------------
  # * In Range based on given values (variant of Near Fantastica's)
  #    s_x  : source object's x-coordinates
  #    s_y  : source object's y-coordinates
  #    t_x  : target object's x-coordinates
  #    t_y  : target object's y-coordinates
  #    range : range distance in tiles
  #--------------------------------------------------------------------------
  def in_range_numeric?(s_x, s_y, t_x, t_y, range)
    #
    x = (s_x - t_x) * (s_x - t_x)
    y = (s_y - t_y) * (s_y - t_y)
    r = x + y
    return true if r <= (range * range)
    return false
    #
  end
  #--------------------------------------------------------------------------
  # * Obtain extending tile quantity (size) based on facing direction
  #    t : target object character
  #--------------------------------------------------------------------------
  def get_size(t)
    #
    # Get facing direction of target
    d = t.direction
    #   
    # Set the size variables depending on the direction
    t_x = ((d == 2 or d == 8) ? t.vertical_size_x : t.horizontal_size_x).to_i
    t_y = ((d == 2 or d == 8) ? t.vertical_size_y : t.horizontal_size_y).to_i
    #   
    # Work out the number of tiles either side of the event
    t_x /= 2
    t_y -= 1
    #
    # Return array with horizontal and vertical tile extensions
    return [t_x, t_y]
    #
  end
end



#==============================================================================
# ** Range_Base
#------------------------------------------------------------------------------
#  This class handles missiles fired in battle. It's used within the ABS Engine
#  and is a superclass for both Game_Ranged_Weapon and Game_Ranged_Skill.
#==============================================================================

class Range_Base < Game_Character
  #--------------------------------------------------------------------------
  # * In Range?(Element, Object, Range) - Near Fantastica
  #    source : source of search (object performing test)
  #    target : target of search (object being searched)
  #    range  : range distance in tiles
  #--------------------------------------------------------------------------
  def in_range_ballistic?(x, y, target, range)
    #
    # Exit false if ballistic strikes parent/attacker
    return false if @parent == target && @parent == $game_player
    #
    # Get differences
    change          = $ABS.get_size(target)
    t_ch_x, t_ch_y  = change[0], change[1]
    #
    # Loop through source and target coordinates with tile extensions
    for xt in (target.x - t_ch_x)..(target.x + t_ch_x)
      for yt in (target.y - t_ch_y)..(target.y)
        #
        # Confirm if updated coordinates are within the range test
        return true if $ABS.in_range_numeric?(x, y, xt, yt, range)
        #
      end
    end
    #
    # Exit method with no confirmation
    return false
    #
  end
end



#==============================================================================
# ** Game_Ranged_Skill
#------------------------------------------------------------------------------
#  This class handles ranged missiles that deliver damage based on the skill
#  performed by the user.
#==============================================================================

class Game_Ranged_Skill < Range_Base
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    check_event_trigger_touch(@x, @y)
  end

  #--------------------------------------------------------------------------
  # * Check Event Trigger Touch(x, y)
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    # Exit if stop flag is set
    return if @stop

    # Hit player if missile is within range
    hit_player if in_range_ballistic?(x, y, $game_player, 1)

    # Iterate over all events on the map
    for event in $game_map.events.values
      # Skip events that are not enemies or are outside missile range
      next if $ABS.enemies[event.id] == nil || event == @parent
      next unless in_range_ballistic?(x, y, event, 1)

      # Check hit conditions
      if event.character_name == "" || $ABS.enemies[event.id].dead? || event.erased
        force_movement
      else
        # Hit large event
        hit_event(event.id)
      end
    end
  end
end

#==============================================================================
# ** Game_Ranged_Weapon
#------------------------------------------------------------------------------
#  This class handles ranged missiles that deliver damage based on the weapon
#  currently equipped.
#==============================================================================

class Game_Ranged_Weapon < Range_Base
  #--------------------------------------------------------------------------
  # * Check Event Trigger Touch(x, y)
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    # Exit if stop flag is set
    return if @stop

    # Hit player if missile is within range
    hit_player if in_range_ballistic?(x, y, $game_player, 1)

    # Iterate over all events on the map
    for event in $game_map.events.values
      # Skip events that are not enemies, are outside missile range, or are the firing event
      next if $ABS.enemies[event.id] == nil || event == @parent
      next unless in_range_ballistic?(x, y, event, 1)

      # Check hit conditions
      if event.character_name == "" || $ABS.enemies[event.id].dead? || event.erased
        force_movement
      else
        # Hit large event
        hit_event(event.id)
      end
    end
  end
end

Changelog:

The following changes were made to the
Code:
check_event_trigger_touch
method in the
Code:
Game_Ranged_Skill
and
Code:
Game_Ranged_Weapon
classes to enable event-to-event attacks (not limited to player interactions). The key updates are as follows:

  1. Check if the event is an enemy: Added
    Code:
    next if $ABS.enemies[event.id] == nil
    to skip events that are not defined as enemies in the ABS system.
  2. Skip the parent event: Added
    Code:
    next if event == @parent
    so that the projectile does not hit the event that launched it (the parent event).
  3. Check if the event is within attack range: Added
    Code:
    next unless in_range_ballistic?(x, y, event, 1)
    to verify if the event is within attack range.
  4. Event hit conditions: If the event is inactive, dead, or erased, the
    Code:
    force_movement
    method is executed. Otherwise,
    Code:
    hit_event(event.id)
    is called to inflict damage on the target event.


EDIT 1:

Taking advantage of the opportunity Wulfman. Do you know how to disable the "jump" effect for a specific event when it is attacked?

An interesting option would be to add such a function to the comments. While it works for monsters, for heavy objects it looks funny. :D


Attached Files Thumbnail(s)
       
Reply }


Messages In This Thread
Mr. Mo v 5.5 + Immense Events - by Tepe - 10-28-2024, 10:29 AM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-28-2024, 09:12 PM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-30-2024, 08:36 PM
RE: Mr. Mo v 5.5 + Immense Events - by kyonides - 10-30-2024, 09:28 PM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-30-2024, 10:03 PM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-31-2024, 02:13 AM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-31-2024, 02:36 AM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-31-2024, 03:10 AM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-31-2024, 10:51 AM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 10-31-2024, 03:37 PM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 11-03-2024, 01:00 AM
RE: Mr. Mo v 5.5 + Immense Events - by Tepe - 11-03-2024, 05:57 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Icon Display 1.0 scripts makes events impossible to go to events, which are passable Djigit 0 3,890 01-03-2015, 09:11 PM
Last Post: Djigit
   in FPLE touching events after battle causes rpg maker to crash ThePrinceofMars 1 5,501 11-27-2014, 09:11 PM
Last Post: MechanicalPen



Users browsing this thread: 6 Guest(s)