LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

ACTIVATED
ACTIVATED
#1 [solved]XAS size for events Empty [solved]XAS size for events
Loading

shogun3

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
This could be a useful script, too bad it doesn't work with xas Sad
Credit goes to Toby Zarner.

It basically increases event sizes so that you can interact with all parts of a sprite rather than just one tile.


Code:

class Game_Character
 
  attr_accessor :size_x                  # event size x
  attr_accessor :size_y                  # event size y
  attr_accessor :tiles_left              # sizing - tiles to the left
  attr_accessor :tiles_right              # sizing - tiles to the right
 
  def initialize
    @id = 0
    @x = 0
    @y = 0
    @real_x = 0
    @real_y = 0
    @tile_id = 0
    @character_name = ""
    @character_hue = 0
    @opacity = 255
    @blend_type = 0
    @direction = 2
    @pattern = 0
    @move_route_forcing = false
    @through = false
    @animation_id = 0
    @transparent = false
    @original_direction = 2
    @original_pattern = 0
    @move_type = 0
    @move_speed = 4
    @move_frequency = 6
    @move_route = nil
    @move_route_index = 0
    @original_move_route = nil
    @original_move_route_index = 0
    @walk_anime = true
    @step_anime = false
    @direction_fix = false
    @always_on_top = false
    @anime_count = 0
    @stop_count = 0
    @jump_count = 0
    @jump_peak = 0
    @wait_count = 0
    @locked = false
    @prelock_direction = 0
    @size_x = 1
    @size_y = 1
    @tiles_left = 0
    @tiles_right = 0
  end
 
  #--------------------------------------------------------------------------
  # *** BEGIN Sized Events v1.0
  #--------------------------------------------------------------------------
  #  By Toby Zerner
  #  USAGE:
  #  In a parallel process event, call this script:
  #    $game_map.events[ID].size(SIZE_X, SIZE_Y)
  #  Replacing the words in capitals with the actual details.
  #--------------------------------------------------------------------------
  def size(x, y)
    # Set instance variables
    @size_x = x
    @size_y = y
    # Work out the number of tiles either side of the event
    tiles_x      = (@size_x - 1) / 2
    @tiles_left  = tiles_x.floor
    @tiles_right = tiles_x.ceil
  end
 
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #    x : x-coordinate
  #    y : y-coordinate
  #    d : direction (0,2,4,6,8)
  #        * 0 = Determines if all directions are impassable (for jumping)
  #--------------------------------------------------------------------------
  # EDITED FOR SIZED EVENTS
  #--------------------------------------------------------------------------
  def passable?(x, y, d)
    # Get new coordinates
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    # If coordinates are outside of map
    unless $game_map.valid?(new_x, new_y)
      # impassable
      return false
    end
    # If through is ON
    if @through
      # passable
      return true
    end

    # Check map passability settings
    # Loop through each x tile
    for i in 0...@size_x
      # Check x coordinates
      # If unable to leave first move tile in designated direction
      unless $game_map.passable?(x - @tiles_left + i, y, d, self) then return false end
      unless $game_map.passable?(new_x - @tiles_left + i, new_y, 10 - d) then return false end
      # Loop through each y tile
      for j in 0...@size_y
        # Check y coordinates
        # If unable to leave first move tile in designated direction
        unless $game_map.passable?(x, y - j, d, self) then return false end
          # If unable to enter move tile in designated direction
        unless $game_map.passable?(new_x, new_y - j, 10 - d) then return false end
        # Check x and y coordinates
        # If unable to leave first move tile in designated direction
        unless $game_map.passable?(x - @tiles_left + i, y - j, d, self) then return false end
        # If unable to enter move tile in designated direction
        unless $game_map.passable?(new_x - @tiles_left + i, new_y - j, 10 - d) then return false end
      end
    end
   
    # Loop through map events
    for event in $game_map.events.values
      # If self is in range of [event]'s sizing, we can't pass
      if event_collide?(self, event, new_x, new_y)
        return false
      end
    end
   
    # If player coordinates are consistent with move destination
    if event_collide?(self, $game_player, new_x, new_y) and self != $game_player
      return false
    end

    # passable
    return true
  end
 
  #--------------------------------------------------------------------------
  # * Check if two events collide (event sizing)
  #  event1 : the first event
  #  event2 : the second event
  #  new_x  : the new x coordinate of event 1
  #  new_y  : the new y coordinate of event 1
  #--------------------------------------------------------------------------
  def event_collide?(event1, event2, new_x, new_y)
    if event1.id == event2.id then return false end
    collision = false
    # Check if there is a collision on the y axis
    # Loop through each individual tile on both events and compare them
    for i in (new_y - (event1.size_y - 1))..new_y
      for j in (event2.y - (event2.size_y - 1))..event2.y
        # If event 1's tile is the same as event 2's tile, we have a collision
        if i == j
          unless event1.through or event2.through
            # Make sure there is a graphic - if not, no collision
            if event1.character_name != "" and event2.character_name != ""
              # There was a collision
              collision = true
            end
          end
        end
      end
    end
    # If there was a collision on the y axis...
    if collision == true
      # Check the x axis
      # Loop through each individual tile on both events and compare them
      for i in (new_x - event1.tiles_left)..(new_x + event1.tiles_right)
        for j in (event2.x - event2.tiles_left)..(event2.x + event2.tiles_right)
          # If event 1's tile is the same as event 2's tile, we have a collision
          if i == j
            unless event1.through or event2.through
              # Make sure there is a graphic - if not, no collision
              if event1.character_name != "" and event2.character_name != ""
                # There was a collision
                return true
              end
            end
          end
        end
      end
    end
    # No collision
    return false
  end
 
end

class Game_Player
 
  #--------------------------------------------------------------------------
  # * Same Position Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_here(triggers)
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      # EDITED FOR SIZED EVENTS
      # If player's coordinates collide with the event and its sizing
      if @x >= event.x - event.tiles_left and @x <= event.x + event.tiles_right and
        @y >= event.y - (event.size_y - 1) and @y <= event.y and
        triggers.include?(event.trigger)
        # If starting determinant is same position event (other than jumping)
        if not event.jumping? and event.over_trigger?
          event.start
          result = true
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Front Envent Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_there(triggers)
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # Calculate front event coordinates
    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      # EDITED FOR SIZED EVENTS
      # If player's new coordinates collide with the event and its sizing
      if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
        new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
        triggers.include?(event.trigger)
        # If starting determinant is front event (other than jumping)
        if not event.jumping? and not event.over_trigger?
          event.start
          result = true
        end
      end
    end
    # If fitting event is not found
    if result == false
      # If front tile is a counter
      if $game_map.counter?(new_x, new_y)
        # Calculate 1 tile inside coordinates
        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
        # All event loops
        for event in $game_map.events.values
          # If event coordinates and triggers are consistent
          # EDITED FOR SIZED EVENTS
          # If player's new coordinates collide with the event and its sizing
          if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
            new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
            triggers.include?(event.trigger)
            # If starting determinant is front event (other than jumping)
            if not event.jumping? and not event.over_trigger?
              event.start
              result = true
            end
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Touch Event Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # All event loops
    for event in $game_map.events.values
      # EDITED FOR SIZED EVENTS
      # If passed coordinates collide with the event and its sizing
      if x >= event.x - event.tiles_left and x <= event.x + event.tiles_right and
        y >= event.y - (event.size_y - 1) and y <= event.y and [1,2].include?(event.trigger)
        event.start
        result = true
      end
    end
    return result
  end
 
end
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#2 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
I believe that XAS has a feature in it that does this. i think its in the BATTLER config.

[edit]

it does, but this is different then what i thought, the one in XAS is just hit detection for the tools. Also when you imported this into your project did you try to place it in different locations in the Scripts data base? (above and bellow XAS for example)
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#3 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

shogun3

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
mr_wiggles wrote:I believe that XAS has a feature in it that does this. i think its in the BATTLER config.

[edit]

it does, but this is different then what i thought, the one in XAS is just hit detection for the tools. Also when you imported this into your project did you try to place it in different locations in the Scripts data base? (above and bellow XAS for example)

It actually works if put below the xas system, but it doesn't work with hackel's ally system, it gives me this error:

Script 'ally system' line 459: NoMethodError occurred.

undefined method '-' for nil:NilClass

def ki(sa,sb,sc,sd,se,ra,rb,rc,rd,re,hp,ha,freq,healper,skilltime,keinn)

if self.battler.is_a?(Game_Actor) #and self.battler != $game_party.actors[0]
id = self.battler.id
if $data_actors[id].id == $game_party.actors[0].id
#$game_map.remove_token(self)
end
check_enemys
unless @wait == 0
@wait -= 1 *line 459
else
@timer += 1
speed(4.2)
if hp != 0
@hpcost = $data_skills[hp].sp_cost
end
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#4 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
you could try to add @wait = 0 if @wait == nil before that line.
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#5 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

shogun3

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
thank you, it does work with that edit although the ally doesn't do anything now Crying or Very sad
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#6 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

mr_wiggles

mr_wiggles
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Hackle might be able to help with this since i haven't looked at how @wait is set.
EVENTALIST
Show Signature
EVENTALIST
Administrator
Administrator
#7 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
k now that was too easy, tell me if it works for you shogun3

Code:
#--------------------------------------------------------------------------
# Sized Events v2.0 By Toby Zerner edited by g@MeF@Ce for XAS 3.91
#--------------------------------------------------------------------------
#  USAGE:
#  In a parallel process event, call this script:
#    $game_map.events[ID].size(SIZE_X, SIZE_Y)
#  Replacing the words in capitals with the actual details
#--------------------------------------------------------------------------

class Game_Character
 
  attr_accessor :size_x                  # event size x
  attr_accessor :size_y                  # event size y
  attr_accessor :tiles_left              # sizing - tiles to the left
  attr_accessor :tiles_right              # sizing - tiles to the right
 
  alias sized_events initialize #edit +++
 
  def initialize
    @id = 0
    @x = 0
    @y = 0
    @real_x = 0
    @real_y = 0
    @tile_id = 0
    @character_name = ""
    @character_hue = 0
    @opacity = 255
    @blend_type = 0
    @direction = 2
    @pattern = 0
    @move_route_forcing = false
    @through = false
    @animation_id = 0
    @transparent = false
    @original_direction = 2
    @original_pattern = 0
    @move_type = 0
    @move_speed = 4
    @move_frequency = 6
    @move_route = nil
    @move_route_index = 0
    @original_move_route = nil
    @original_move_route_index = 0
    @walk_anime = true
    @step_anime = false
    @direction_fix = false
    @always_on_top = false
    @anime_count = 0
    @stop_count = 0
    @jump_count = 0
    @jump_peak = 0
    @wait_count = 0
    @locked = false
    @prelock_direction = 0
    @size_x = 1
    @size_y = 1
    @tiles_left = 0
    @tiles_right = 0
    sized_events #edit +++
  end
 
  #--------------------------------------------------------------------------
  #
  #--------------------------------------------------------------------------
  def size(x, y)
    # Set instance variables
    @size_x = x
    @size_y = y
    # Work out the number of tiles either side of the event
    tiles_x      = (@size_x - 1) / 2
    @tiles_left  = tiles_x.floor
    @tiles_right = tiles_x.ceil
  end
 
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #    x : x-coordinate
  #    y : y-coordinate
  #    d : direction (0,2,4,6,8)
  #        * 0 = Determines if all directions are impassable (for jumping)
  #--------------------------------------------------------------------------
  # EDITED FOR SIZED EVENTS
  #--------------------------------------------------------------------------
  def passable?(x, y, d)
    # Get new coordinates
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    # If coordinates are outside of map
    unless $game_map.valid?(new_x, new_y)
      # impassable
      return false
    end
    # If through is ON
    if @through
      # passable
      return true
    end

    # Check map passability settings
    # Loop through each x tile
    for i in 0...@size_x
      # Check x coordinates
      # If unable to leave first move tile in designated direction
      unless $game_map.passable?(x - @tiles_left + i, y, d, self) then return false end
      unless $game_map.passable?(new_x - @tiles_left + i, new_y, 10 - d) then return false end
      # Loop through each y tile
      for j in 0...@size_y
        # Check y coordinates
        # If unable to leave first move tile in designated direction
        unless $game_map.passable?(x, y - j, d, self) then return false end
          # If unable to enter move tile in designated direction
        unless $game_map.passable?(new_x, new_y - j, 10 - d) then return false end
        # Check x and y coordinates
        # If unable to leave first move tile in designated direction
        unless $game_map.passable?(x - @tiles_left + i, y - j, d, self) then return false end
        # If unable to enter move tile in designated direction
        unless $game_map.passable?(new_x - @tiles_left + i, new_y - j, 10 - d) then return false end
      end
    end
 
    # Loop through map events
    for event in $game_map.events.values
      # If self is in range of [event]'s sizing, we can't pass
      if event_collide?(self, event, new_x, new_y)
        return false
      end
    end
 
    # If player coordinates are consistent with move destination
    if event_collide?(self, $game_player, new_x, new_y) and self != $game_player
      return false
    end

    # passable
    return true
  end
 
  #--------------------------------------------------------------------------
  # * Check if two events collide (event sizing)
  #  event1 : the first event
  #  event2 : the second event
  #  new_x  : the new x coordinate of event 1
  #  new_y  : the new y coordinate of event 1
  #--------------------------------------------------------------------------
  def event_collide?(event1, event2, new_x, new_y)
    if event1.id == event2.id then return false end
    collision = false
    # Check if there is a collision on the y axis
    # Loop through each individual tile on both events and compare them
    for i in (new_y - (event1.size_y - 1))..new_y
      for j in (event2.y - (event2.size_y - 1))..event2.y
        # If event 1's tile is the same as event 2's tile, we have a collision
        if i == j
          unless event1.through or event2.through
            # Make sure there is a graphic - if not, no collision
            if event1.character_name != "" and event2.character_name != ""
              # There was a collision
              collision = true
            end
          end
        end
      end
    end
    # If there was a collision on the y axis...
    if collision == true
      # Check the x axis
      # Loop through each individual tile on both events and compare them
      for i in (new_x - event1.tiles_left)..(new_x + event1.tiles_right)
        for j in (event2.x - event2.tiles_left)..(event2.x + event2.tiles_right)
          # If event 1's tile is the same as event 2's tile, we have a collision
          if i == j
            unless event1.through or event2.through
              # Make sure there is a graphic - if not, no collision
              if event1.character_name != "" and event2.character_name != ""
                # There was a collision
                return true
              end
            end
          end
        end
      end
    end
    # No collision
    return false
  end
 
end

#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
class Game_Player
 
  #--------------------------------------------------------------------------
  # * Same Position Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_here(triggers)
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      # EDITED FOR SIZED EVENTS
      # If player's coordinates collide with the event and its sizing
      if @x >= event.x - event.tiles_left and @x <= event.x + event.tiles_right and
        @y >= event.y - (event.size_y - 1) and @y <= event.y and
        triggers.include?(event.trigger)
        # If starting determinant is same position event (other than jumping)
        if not event.jumping? and event.over_trigger?
          event.start
          result = true
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Front Envent Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_there(triggers)
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # Calculate front event coordinates
    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      # EDITED FOR SIZED EVENTS
      # If player's new coordinates collide with the event and its sizing
      if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
        new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
        triggers.include?(event.trigger)
        # If starting determinant is front event (other than jumping)
        if not event.jumping? and not event.over_trigger?
          event.start
          result = true
        end
      end
    end
    # If fitting event is not found
    if result == false
      # If front tile is a counter
      if $game_map.counter?(new_x, new_y)
        # Calculate 1 tile inside coordinates
        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
        # All event loops
        for event in $game_map.events.values
          # If event coordinates and triggers are consistent
          # EDITED FOR SIZED EVENTS
          # If player's new coordinates collide with the event and its sizing
          if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
            new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
            triggers.include?(event.trigger)
            # If starting determinant is front event (other than jumping)
            if not event.jumping? and not event.over_trigger?
              event.start
              result = true
            end
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Touch Event Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_touch(x, y)
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # All event loops
    for event in $game_map.events.values
      # EDITED FOR SIZED EVENTS
      # If passed coordinates collide with the event and its sizing
      if x >= event.x - event.tiles_left and x <= event.x + event.tiles_right and
        y >= event.y - (event.size_y - 1) and y <= event.y and [1,2].include?(event.trigger)
        event.start
        result = true
      end
    end
    return result
  end
 
end

new version below
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#8 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

shogun3

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
thank u I will try it later!!!
ACTIVATED
Show Signature
ACTIVATED
Administrator
Administrator
#9 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

G@MeF@Ce

G@MeF@Ce
Administrator
Administrator
Administrator
profile
n/p - and since it is XAS...

you will have to use both sizing the event and
the body square for collision


EDIT: ok more edits!

this time use an autorun event to switch over...

this way the game wont crash when enemy is defeated
(a parallel process event will keep looking for the event
after it has been defeated)

set the body square to 1 for any of your sized events,
the script will to the rest, oh and pick up and throw works too...

Code:
#--------------------------------------------------------------------------
# Sized Events v2.1 By Toby Zerner edited by g@MeF@Ce for XAS 3.91
#--------------------------------------------------------------------------
#  USAGE:
#  In a parallel process event, call this script:
#    $game_map.events[ID].size(SIZE_X, SIZE_Y)
#  Replacing the words in capitals with the actual details
#--------------------------------------------------------------------------

class Game_Character
 
  attr_accessor :size_x                  # event size x
  attr_accessor :size_y                  # event size y
  attr_accessor :tiles_left              # sizing - tiles to the left
  attr_accessor :tiles_right              # sizing - tiles to the right
 
  alias sized_events initialize #edit +++
  def initialize
    @id = 0
    @x = 0
    @y = 0
    @real_x = 0
    @real_y = 0
    @tile_id = 0
    @character_name = ""
    @character_hue = 0
    @opacity = 255
    @blend_type = 0
    @direction = 2
    @pattern = 0
    @move_route_forcing = false
    @through = false
    @animation_id = 0
    @transparent = false
    @original_direction = 2
    @original_pattern = 0
    @move_type = 0
    @move_speed = 4
    @move_frequency = 6
    @move_route = nil
    @move_route_index = 0
    @original_move_route = nil
    @original_move_route_index = 0
    @walk_anime = true
    @step_anime = false
    @direction_fix = false
    @always_on_top = false
    @anime_count = 0
    @stop_count = 0
    @jump_count = 0
    @jump_peak = 0
    @wait_count = 0
    @locked = false
    @prelock_direction = 0
    @size_x = 1
    @size_y = 1
    @tiles_left = 0
    @tiles_right = 0
    sized_events #edit +++
  end
 
  #--------------------------------------------------------------------------
  #
  #--------------------------------------------------------------------------
  def size(x, y)
    # Set instance variables
    @size_x = x
    @size_y = y
    # Work out the number of tiles either side of the event
    tiles_x      = (@size_x - 1) / 2
    @tiles_left  = tiles_x.floor
    @tiles_right = tiles_x.ceil
    return
  end
 
  #--------------------------------------------------------------------------
  # * Determine if Passable
  #    x : x-coordinate
  #    y : y-coordinate
  #    d : direction (0,2,4,6,8)
  #        * 0 = Determines if all directions are impassable (for jumping)
  #--------------------------------------------------------------------------
  # EDITED FOR SIZED EVENTS
  #--------------------------------------------------------------------------
  def passable?(x, y, d)
    # Get new coordinates
    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
    # If coordinates are outside of map
    unless $game_map.valid?(new_x, new_y)
      # impassable
      return false
    end
    # If through is ON
    if @through
      # passable
      return true
    end

    # Check map passability settings
    # Loop through each x tile
    for i in 0...@size_x
      # Check x coordinates
      # If unable to leave first move tile in designated direction
      unless $game_map.passable?(x - @tiles_left + i, y, d, self) then return false end
      unless $game_map.passable?(new_x - @tiles_left + i, new_y, 10 - d) then return false end
      # Loop through each y tile
      for j in 0...@size_y
        # Check y coordinates
        # If unable to leave first move tile in designated direction
        unless $game_map.passable?(x, y - j, d, self) then return false end
          # If unable to enter move tile in designated direction
        unless $game_map.passable?(new_x, new_y - j, 10 - d) then return false end
        # Check x and y coordinates
        # If unable to leave first move tile in designated direction
        unless $game_map.passable?(x - @tiles_left + i, y - j, d, self) then return false end
        # If unable to enter move tile in designated direction
        unless $game_map.passable?(new_x - @tiles_left + i, new_y - j, 10 - d) then return false end
      end
    end
 
    # Loop through map events
    for event in $game_map.events.values
      # If self is in range of [event]'s sizing, we can't pass
      if event_collide?(self, event, new_x, new_y)
        return false
      end
    end
 
    # If player coordinates are consistent with move destination
    if event_collide?(self, $game_player, new_x, new_y) and self != $game_player
      return false
    end

    # passable
    return true
  end
 
  #--------------------------------------------------------------------------
  # * Check if two events collide (event sizing)
  #  event1 : the first event
  #  event2 : the second event
  #  new_x  : the new x coordinate of event 1
  #  new_y  : the new y coordinate of event 1
  #--------------------------------------------------------------------------
  def event_collide?(event1, event2, new_x, new_y)
    if event1.id == event2.id then return false end
    collision = false
    # Check if there is a collision on the y axis
    # Loop through each individual tile on both events and compare them
    for i in (new_y - (event1.size_y - 1))..new_y
      for j in (event2.y - (event2.size_y - 1))..event2.y
        # If event 1's tile is the same as event 2's tile, we have a collision
        if i == j
          unless event1.through or event2.through
            # Make sure there is a graphic - if not, no collision
            if event1.character_name != "" and event2.character_name != ""
              # There was a collision
              collision = true
            end
          end
        end
      end
    end
    # If there was a collision on the y axis...
    if collision == true
      # Check the x axis
      # Loop through each individual tile on both events and compare them
      for i in (new_x - event1.tiles_left)..(new_x + event1.tiles_right)
        for j in (event2.x - event2.tiles_left)..(event2.x + event2.tiles_right)
          # If event 1's tile is the same as event 2's tile, we have a collision
          if i == j
            unless event1.through or event2.through
              # Make sure there is a graphic - if not, no collision
              if event1.character_name != "" and event2.character_name != ""
                # There was a collision
                return true
              end
            end
          end
        end
      end
    end
    # No collision
    return false
  end
 
end

#--------------------------------------------------------------------------
#
#--------------------------------------------------------------------------
class Game_Player

alias sized_event_checks_here check_event_trigger_here #edit +++
 
  #--------------------------------------------------------------------------
  # * Same Position Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_here(triggers)
    sized_event_checks_here(triggers) #edit +++
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      # EDITED FOR SIZED EVENTS
      # If player's coordinates collide with the event and its sizing
      if @x >= event.x - event.tiles_left and @x <= event.x + event.tiles_right and
        @y >= event.y - (event.size_y - 1) and @y <= event.y and
        triggers.include?(event.trigger)
        # If starting determinant is same position event (other than jumping)
        if not event.jumping? and event.over_trigger?
          event.start
          result = true
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Front Envent Starting Determinant
  #--------------------------------------------------------------------------
  alias sized_event_check_there check_event_trigger_there #edit +++
  def check_event_trigger_there(triggers)
    sized_event_check_there(triggers) #edit +++
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # Calculate front event coordinates
    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      # EDITED FOR SIZED EVENTS
      # If player's new coordinates collide with the event and its sizing
      if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
        new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
        triggers.include?(event.trigger)
        # If starting determinant is front event (other than jumping)
        if not event.jumping? and not event.over_trigger?
          event.start
          result = true
        end
      end
    end
    # If fitting event is not found
    if result == false
      # If front tile is a counter
      if $game_map.counter?(new_x, new_y)
        # Calculate 1 tile inside coordinates
        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
        # All event loops
        for event in $game_map.events.values
          # If event coordinates and triggers are consistent
          # EDITED FOR SIZED EVENTS
          # If player's new coordinates collide with the event and its sizing
          if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
            new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
            triggers.include?(event.trigger)
            # If starting determinant is front event (other than jumping)
            if not event.jumping? and not event.over_trigger?
              event.start
              result = true
            end
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Touch Event Starting Determinant
  #--------------------------------------------------------------------------
  alias sized_event_check_touch check_event_trigger_touch # edit +++
  def check_event_trigger_touch(x, y)
    sized_event_check_touch(x,y) #edit +++
    result = false
    # If event is running
    if $game_system.map_interpreter.running?
      return result
    end
    # All event loops
    for event in $game_map.events.values
      # EDITED FOR SIZED EVENTS
      # If passed coordinates collide with the event and its sizing
      if x >= event.x - event.tiles_left and x <= event.x + event.tiles_right and
        y >= event.y - (event.size_y - 1) and y <= event.y and [1,2].include?(event.trigger)
        event.start
        result = true
      end
    end
    return result
  end
end

Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr https://www.youtube.com/user/MrGameface101?feature=watch
ACTIVATED
ACTIVATED
#10 [solved]XAS size for events Empty Re: [solved]XAS size for events
Loading

shogun3

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
Amazing thank you!!!!!!!!!!!
Now Kenshiro can throw huge rocks at enemies hahaha
ACTIVATED
Show Signature
ACTIVATED

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled