Mr. Mo v 5.5 + Immense Events
#21
Fantastic job, fantastic addition and works great! Unfortunately, I still have to correct the previous code regarding attacks on large events, because I don't know why, but a situation suddenly occurred where, even though the events are in the same group, they can attack each other. It doesn't mean that they approach each other and attack, because that's not the case, but if an event with id 1 enters the shot trajectories of another event with id 1, the latter surprisingly gets hit by its bullet. I've been struggling with this for a long time, but I haven't found a solution yet. By the way, I have the impression that sometimes when a projectile flies into an event and should hit an enemy who is in the same trajectory, it also hits the one who is passing by in the field, even though the event size is not set higher than 1x1. As for solving the problem of allies shooting at allies, on the other hand I have no idea how to deal with it. Well, in such a case, you would either have to remove the projectile after firing it when it touches an allied event and does not deal damage, or a better way is to set the projectile to penetrate when it touches an allied event, so that it flies through the ally and hits the enemy in front of it, or...
Reply }
#22
First, I just wanted to test that it wasn't the Immense Events... so, I made a new map, set two of your oversized goblins in it, set both the enemy ID 1 (the Bowers), set their hate group to 1 (yeah, they hate each other), set their view range to a good 15 and their behavior to 3 so seeing and hearing would be good.

And hehehe... the arrows began to fly.  Not one arrow hit their target as friendly fire works, even for immense events as shown here:


.mp4   2024-11-02 21-39-37_Segment_0_x264.mp4 (Size: 324.1 KB / Downloads: 2)

The system checks if the arrow/projectile comes in contact with an event.  And only after coming in contact, it will check to see if the event is a player or enemy.  Well, putting it simply, anyway.  The arrow doesn't know what it is going to strike until it hits, and only then does it run the test.  

I put the player in harm's way in the above video, and he did get shot. So friendly fire seems to work.  You need to find a way to repeatedly recreate the issue and send a demo this way so it can be seen and evaluated.
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 }
#23
Okay, I made some progress, I analyzed your code again and I give you credit, it helped me again, although I still had to adjust it. The parent method that I introduced earlier caused an error that prevented smaller events from attacking, which could be attacked before I introduced the fix that allows large events to attack large events. Thus, I achieved the opposite situation xD. Finally, I managed to fix it. Now I have to adjust the pixelmovement that I use, plus solve the problem with allies attacking allies when they enter the trajectory of an ally's projectile. Here is the corrected version of the code:

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 seearch 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 diretion 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 diretion 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 coordinate 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 coordinate 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)
    #
    # If using non-official update to 4.5
    faux = (Object.const_defined?(:DEFEND_DAMAGE_PERCENT))
    #
    # Exit if the stop flag is set
    return if @stop
    #
    if faux
      # Exit and set stop flag if neither an enemy nor player
      if $ABS.enemies[@parent.id].nil? && !@parent.is_a?(Game_Player)
        return @stop = true
      end
    end
    #
    # Hit the player if missile in range of the player
    hit_player if in_range_ballistic?(x, y, $game_player, 1)
    #
    # Cycle through all map events
    for event in $game_map.events.values
      #
      # Skip if not an enemy, or missile not in range to strike or the same as parent
      next if $ABS.enemies[event.id].nil?   
      next unless in_range_ballistic?(x, y, event, 1)    
      #
      # Acquire hit condition tests
      if faux
        # Adding unofficial friendly-fire option
        hate    = true
        unless $ABS.enemies[@parent.id].nil?
          e_id  = $ABS.enemies[event.id].enemy_id
          hate  = $ABS.enemies[@parent.id].hate_group.include?(e_id)
        end
      end
      #
      # Check hit conditions
      c1 = event.character_name == ""
      c2 = ($ABS.enemies[event.id] != nil && $ABS.enemies[event.id].dead?)
      c3 = event.erased
      c4 = @parent.is_a?(Game_Event) && !hate    
      #
      # If hit condition not met, perform movement
      if (c1 || c2 || c3) && !faux
        force_movement
      elsif (c1 || c2 || c3 || c4) && faux
        force_movement
      else
        # Hit the 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)
    #
    # If using non-official update to 4.5
    faux = (Object.const_defined?(:DEFEND_DAMAGE_PERCENT))
    #
    # Exit if the stop flag is set
    return if @stop
    #
    if faux
      # Exit and set stop flag if neither an enemy nor player
      if $ABS.enemies[@parent.id].nil? && !@parent.is_a?(Game_Player)
        return @stop = true
      end
    end
    #
    # Hit the player if missile in range of the player
    hit_player if in_range_ballistic?(x, y, $game_player, 1)
    #
    # Cycle through all map events
    for event in $game_map.events.values
      #
      # Skip if not an enemy, or missile not in range to strike or the same as parent
      next if $ABS.enemies[event.id].nil?   
      next unless in_range_ballistic?(x, y, event, 1)    
      #
      # Acquire hit condition tests
      if faux
        # Adding unofficial friendly-fire option
        hate = true
        unless $ABS.enemies[@parent.id].nil?
          e_id = $ABS.enemies[event.id].enemy_id
          hate = $ABS.enemies[@parent.id].hate_group.include?(e_id)
        end
      end
      #
      # Check hit conditions
      c1 = event.character_name == ""
      c2 = ($ABS.enemies[event.id] != nil && $ABS.enemies[event.id].dead?)
      c3 = event.erased
      c4 = @parent.is_a?(Game_Event) && !hate    
      #
      # Move if hit condition not met, or perform hit
      if (c1 || c2 || c3) && !faux
        force_movement
      elsif (c1 || c2 || c3 || c4) && faux
        force_movement
      else
        hit_event(event.id)
      end
      #
    end
  end
end
Reply }


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,876 01-03-2015, 09:11 PM
Last Post: Djigit
   in FPLE touching events after battle causes rpg maker to crash ThePrinceofMars 1 5,475 11-27-2014, 09:11 PM
Last Post: MechanicalPen



Users browsing this thread: 1 Guest(s)