Veiw Range Script
#18
sorry, I didn't know you weren't as script-savy as I am (actually I was just too lazy after work and hoped you would just magically know what to do)

Try replacing vr_in_range? with this:
Code:
#--------------------------------------------------------------------------
  # * In Range?
  #     element     : either player or other event
  #     object      : event looking for element
  #     range       : range in tiles
  #     pass_block  : if terrain tiles can block view
  #--------------------------------------------------------------------------

  def vr_in_range?(element, object, range, pass_block = false)
    # Obtain Range
    dx = (element.x - object.x).abs
    dy = (element.y - object.y).abs
    # Obtain values to loop and counter value
    x = xa
    y = ya
    n = 1 + dx + dy
    x_inc = (xb > xa) ? 1 : -1
    y_inc = (yb > ya) ? 1 : -1
    error = dx - dy;
    dx = dx*2 #do this to
    dy = dy*2 #get rid of fractions
    #check range
    r = dx + dy
    if r <= (range * range)
      # If tiles can block view
      if pass_block
        n.downto(0){ |i|
          if !$game_map.passable?(x, y, element.direction)
              return false
          end

          if (error > 0)
              x = x + x_inc
              error = error - dy
          else
              y = y + y_inc
              error = error + dx
          end
        }                  
      end
      # Return system-determined flag      
      return true
    else
      # Return default flag
      return false
    end
  end
Reply }


Messages In This Thread
Veiw Range Script - by Near Fantastica - 03-02-2008, 07:54 AM
RE: Veiw Range Script - by DerVVulfman - 03-06-2012, 08:51 AM
RE: Veiw Range Script - by LilyKnight - 03-07-2012, 06:38 PM
RE: Veiw Range Script - by DerVVulfman - 03-31-2012, 04:08 AM
RE: Veiw Range Script - by penguwin - 07-12-2013, 08:28 AM
RE: Veiw Range Script - by DerVVulfman - 07-13-2013, 04:16 AM
RE: Veiw Range Script - by deus69xxx - 08-12-2013, 11:53 PM
RE: Veiw Range Script - by MechanicalPen - 08-13-2013, 12:48 AM
RE: Veiw Range Script - by deus69xxx - 08-13-2013, 01:34 AM
RE: Veiw Range Script - by MechanicalPen - 08-13-2013, 01:53 AM
RE: Veiw Range Script - by deus69xxx - 08-13-2013, 07:01 AM
RE: Veiw Range Script - by MechanicalPen - 08-13-2013, 06:03 PM
RE: Veiw Range Script - by deus69xxx - 08-13-2013, 10:39 PM
RE: Veiw Range Script - by MechanicalPen - 08-13-2013, 10:55 PM
RE: Veiw Range Script - by deus69xxx - 08-14-2013, 03:29 AM
RE: Veiw Range Script - by MechanicalPen - 08-14-2013, 05:08 AM
RE: Veiw Range Script - by deus69xxx - 08-14-2013, 05:47 AM
RE: Veiw Range Script - by MechanicalPen - 08-14-2013, 06:16 PM
RE: Veiw Range Script - by deus69xxx - 08-16-2013, 02:05 AM
RE: Veiw Range Script - by MechanicalPen - 08-16-2013, 06:37 PM
RE: Veiw Range Script - by deus69xxx - 08-16-2013, 09:37 PM
RE: Veiw Range Script - by MechanicalPen - 08-16-2013, 10:15 PM
RE: Veiw Range Script - by deus69xxx - 08-17-2013, 07:19 AM
RE: Veiw Range Script - by MechanicalPen - 08-17-2013, 06:21 PM
RE: Veiw Range Script - by deus69xxx - 08-17-2013, 11:56 PM
Veiw Range Script - by DerVVulfman - 10-23-2009, 03:42 AM
Veiw Range Script - by samsonite789 - 11-02-2009, 07:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Text Scroll Script - Enhanced DerVVulfman 23 34,319 02-18-2021, 04:16 AM
Last Post: DerVVulfman
   Cursor Script Selwyn 7 15,358 09-28-2019, 02:13 PM
Last Post: DerVVulfman
   ACBS FIX SCRIPT #2: Advanced Cry Correction DerVVulfman 1 4,774 08-09-2019, 03:42 PM
Last Post: aeliath
   ACBS FIX SCRIPT #1: Victory Cries Patch DerVVulfman 1 4,710 08-08-2019, 02:53 PM
Last Post: aeliath
   Spritesheet Generator Conversion Script DerVVulfman 0 4,254 11-21-2018, 04:48 AM
Last Post: DerVVulfman
   Neo Mode 7 Script by MGCaladtogel MGC 59 125,421 09-29-2017, 03:48 AM
Last Post: DerVVulfman
   Longer Script Calls LiTTleDRAgo 0 4,965 05-17-2017, 12:36 AM
Last Post: LiTTleDRAgo
   SLOLS: Snake Look-alike on Load Script Zeriab 3 11,267 05-14-2017, 06:25 PM
Last Post: LiTTleDRAgo
   Character Select Script Selwyn 3 10,735 03-07-2017, 04:14 AM
Last Post: JayRay
   ELSA (Event Layering Script Advance) JayRay 0 6,017 02-25-2015, 04:15 AM
Last Post: JayRay



Users browsing this thread: 2 Guest(s)