Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - diagostimo

41
Quote from: diagostimo on September 20, 2012, 09:49:35 pm
which gets me thinking, how about having an array of tile id's, then a condition checking the target x and y and tile id, if the array contains that tile id then draw the grass graphic above the character sprites z at that location and the previous location just for clipping messures?

what i meant there was drawing a new sprite in spriteset map that has a higher z value than the characters sprite, and draw in at target x and y  of the character if that tile id is included in said array, also drawing it at the previous tile if that was also included, iv had a little mess around but i have not been able to get it to set at the coordinates yet, a bit unsure on how to go about it :/

edit:
i think i have found the most correct way to go about it, i messed around with manipulating the tile priorities and came up with so:

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
# * class Game_Map                                                
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
class Game_Map
 TERRAIN_ID = 1
 attr_accessor :priorities
 attr_reader :grass
 alias setup_grass setup
 def setup(map_id)
   setup_grass(map_id)
   @grass = []
   (0...$game_map.width).each {|x|
     (0...$game_map.height).each {|y|
       [2, 1, 0].each {|i|
           id = $game_map.data[x, y, i]
           @grass << id if $game_map.terrain_tags[id] == TERRAIN_ID
   }}}
 end
end
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
# * class Game_Player                                              
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-#
class Game_Player < Game_Character
 def horizontal?
   if @direction == 2 or @direction == 8
     return true
   else
     return false
   end
 end
 alias update_grass update
 def update
   ($game_map.grass).each {|i|
     if $game_player.moving? && $game_player.horizontal? && $game_map.priorities[i] != 0
       $game_map.priorities[i] = 0
     elsif $game_player.moving? == false && $game_map.priorities[i] != 1
       $game_map.priorities[i] = 1
     end
   }
   update_grass
 end
end

set all overlapping tiles to have the terrain tag as defined in the script, and draw all your overlapping tiles on the map like lukas pointed out, dont bother setting any priorities as the script automaticly changes them
42
Quote from: StarSkipp on September 20, 2012, 09:40:17 pm
Quote from: KK20 on September 20, 2012, 11:52:36 am
^^ Originally thought of doing that but it won't work. First off, how do you manage to not make the grassy patch "cut off" the character's head? Also, it wouldn't look good when the character walks up or down.


You could always do it by player touch :)

but that would require it all to be evented, an event on every single grass terrain, witch is pretty tedious and over compensating when it comes to one piece of graphic

edit:
which gets me thinking, how about having an array of tile id's, then a condition checking the target x and y and tile id, if the array contains that tile id then draw the grass graphic above the character sprites z at that location and the previous location just for clipping messures?
43
iv had a little fiddle and this is what i came up with:

#==============================================================================
# ** Sprite_Character
#==============================================================================
class Sprite_Character < RPG::Sprite
  #terrain tag
  TERRAIN_TAG = 1
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     viewport  : viewport
  #     character : character (Game_Character)
  #--------------------------------------------------------------------------
  def initialize(viewport, character = nil)
    super(viewport)
    @terrain_sprite = false
    @character = character
    update
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias update_terrain update
  def update
    update_terrain
    if $game_player.terrain_tag == TERRAIN_TAG && @terrain_sprite == false
      RPG::Cache.clear
      @terrain_sprite = true
      img = 'terrain_img'
      src_bitmap = RPG::Cache.character(img, 0)
      self.bitmap.blt(0, 0, src_bitmap, Rect.new(0,0,src_bitmap.width,src_bitmap.height))
    elsif $game_player.terrain_tag != TERRAIN_TAG && @terrain_sprite == true
      @terrain_sprite = false
      RPG::Cache.clear
      self.bitmap = RPG::Cache.character(@character.character_name,
          @character.character_hue)
    end
  end
end

perhaps doing it by terrain tag is not the best way, as there could be multiple grass graphics that are required, perhaps by tile id, and containing all the tile id's inside an array to see if it needs to change depending on the tile?
44
i think that drawing another character sprite ontop of the player would be the best bet, and just get it to change frames with the character so that it clips corectly
45
ye i though as much :/ its probably the most minor thing, meanwhile i await arc   :naughty:
46
hey, the title pretty much says it all, basicly i have reduced the size of my games window to 358 X 320 , and changed the viewports to 352 X 288 this is for a pokemon game, basicly i found the viewports way to large for the tilesets and depth perception of pokemon games, so the question arises can i stop the rgss player from full screening or edit the values it fullscreens to? right now if i full screen i get a horrible black border as my viewport is dramaticly decreased, then if i return from the fullscreen the rgss player returns to its default size of 640 X 480, im guessing some of the core scripts of the rgss player would have to be edited right? if so is there a way, and how would i go about doing this?
47
Script Requests / Re: Script to delete saves on RMXP
September 13, 2012, 07:16:43 am
also on a note if you do plan on doing this you should really consider how the default saving works, if you did implement this there would be nothing stopping me(a user) from copying my saves into another directory and pasting them back in when the script deletes them upon death
48
im thinking creating an addition to the window class to erase a section of the windowskin, i have had a little mess around myself but i have no idea what the real Window class methods are like, i did however achieve it using a custom window class like so:
the custom class(by Selwyn):

#===========================================================
# ? Bitmap
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # ? erase
  #--------------------------------------------------------------------------
  def erase(*args)
    if args.size == 1
      rect = args[0]
    elsif args.size == 4
      rect = Rect.new(*args)
    end
    fill_rect(rect, Color.new(0, 0, 0, 0))
  end
end

#==============================================================================
# ? SG
#------------------------------------------------------------------------------
# ?Selwyn's Graphics module
#==============================================================================


#==============================================================================
# ? SG::Skin
#==============================================================================

class Skin
  #--------------------------------------------------------------------------
  # ? instances settings
  #--------------------------------------------------------------------------
  attr_reader   :margin
  attr_accessor :bitmap
  #--------------------------------------------------------------------------
  # ? initialize
  #--------------------------------------------------------------------------
  def initialize
    @bitmap = nil
    @values = {}
    @values['bg'] = Rect.new(0, 0, 128, 128)
    @values['pause0'] = Rect.new(160, 64, 16, 16)
    @values['pause1'] = Rect.new(176, 64, 16, 16)
    @values['pause2'] = Rect.new(160, 80, 16, 16)
    @values['pause3'] = Rect.new(176, 80, 16, 16)
    @values['arrow_up'] = Rect.new(152, 16, 16, 8)
    @values['arrow_down'] = Rect.new(152, 40, 16, 8)
    @values['arrow_left'] = Rect.new(144, 24, 8, 16)
    @values['arrow_right'] = Rect.new(168, 24, 8, 16)
    self.margin = 16
  end
  #--------------------------------------------------------------------------
  # ? width
  #--------------------------------------------------------------------------
  def margin=(width)
    @margin = width
    set_values
  end
  #--------------------------------------------------------------------------
  # ? set_values
  #--------------------------------------------------------------------------
  def set_values
    w = @margin
    @values['ul_corner'] = Rect.new(128, 0, w, w)
    @values['ur_corner'] = Rect.new(192-w, 0, w, w)
    @values['dl_corner'] = Rect.new(128, 64-w, w, w)
    @values['dr_corner'] = Rect.new(192-w, 64-w, w, w)
    @values['up'] = Rect.new(128+w, 0, 64-2*w, w)
    @values['down'] = Rect.new(128+w, 64-w, 64-2*w, w)
    @values['left'] = Rect.new(128, w, w, 64-2*w)
    @values['right'] = Rect.new(192-w, w, w, 64-2*w)
  end
  #--------------------------------------------------------------------------
  # ? []
  #--------------------------------------------------------------------------
  def [](value)
    return @values[value]
  end
end


#==============================================================================
# ? SG::Cursor_Rect
#==============================================================================

class Cursor_Rect < ::Sprite
  #--------------------------------------------------------------------------
  # ? instances settings
  #--------------------------------------------------------------------------
  attr_reader   :height, :width, :skin, :margin
  #--------------------------------------------------------------------------
  # ? initialize
  #--------------------------------------------------------------------------
  def initialize(viewport)
    super(viewport)
    @width = 0
    @height = 0
    @skin = nil
    @margin = 0
    @rect = {}
    @rect['cursor_up'] = Rect.new(129, 64, 30, 1)
    @rect['cursor_down'] = Rect.new(129, 95, 30, 1)
    @rect['cursor_left'] = Rect.new(128, 65, 1, 30)
    @rect['cursor_right'] = Rect.new(159, 65, 1, 30)
    @rect['upleft'] = Rect.new(128, 64, 1, 1)
    @rect['upright'] = Rect.new(159, 64, 1, 1)
    @rect['downleft'] = Rect.new(128, 95, 1, 1)
    @rect['downright'] = Rect.new(159, 95, 1, 1)
    @rect['bg'] = Rect.new(129, 65, 30, 30)
  end
  #--------------------------------------------------------------------------
  # ? margin=
  #--------------------------------------------------------------------------
  def margin=(margin)
    @margin = margin
    set(x, y, width, height)
  end
  #--------------------------------------------------------------------------
  # ? skin=
  #--------------------------------------------------------------------------
  def skin=(skin)
    @skin = skin
    draw_rect
  end
  #--------------------------------------------------------------------------
  # ? width=
  #--------------------------------------------------------------------------
  def width=(width)
    return if @width == width
    @width = width
    if @width == 0 and self.bitmap != nil
      self.bitmap.dispose
      self.bitmap = nil
    end
    draw_rect
  end
  #--------------------------------------------------------------------------
  # ? height=
  #--------------------------------------------------------------------------
  def height=(height)
    return if @height == height
    @height = height
    if @height == 0 and self.bitmap != nil
      self.bitmap.dispose
      self.bitmap = nil
    end
    draw_rect
  end
  #--------------------------------------------------------------------------
  # ? set
  #--------------------------------------------------------------------------
  def set(x, y, width, height)
    self.x = x + @margin
    self.y = y + @margin
    if @width != width or @height != height
      @width = width
      @height = height
      if width > 0 and height > 0
        draw_rect
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? empty
  #--------------------------------------------------------------------------
  def empty
    self.x = 0
    self.y = 0
    self.width = 0
    self.height = 0
  end
  #--------------------------------------------------------------------------
  # ? draw_rect
  #--------------------------------------------------------------------------
  def draw_rect
    return if @skin == nil
    if @width > 0 and @height > 0
      self.bitmap = Bitmap.new(@width, @height)
      rect = Rect.new(1, 1, @width - 2, @height - 2)
      self.bitmap.stretch_blt(rect, @skin, @rect['bg'])
      self.bitmap.blt(0, 0, @skin, @rect['upleft'])
      self.bitmap.blt(@width-1, 0, @skin, @rect['upright'])
      self.bitmap.blt(0, @height-1, @skin, @rect['downright'])
      self.bitmap.blt(@width-1, @height-1, @skin, @rect['downleft'])
      rect = Rect.new(1, 0, @width - 2, 1)
      self.bitmap.stretch_blt(rect, @skin, @rect['cursor_up'])
      rect = Rect.new(0, 1, 1, @height - 2)
      self.bitmap.stretch_blt(rect, @skin, @rect['cursor_left'])
      rect = Rect.new(1, @height-1, @width - 2, 1)
      self.bitmap.stretch_blt(rect, @skin, @rect['cursor_down'])
      rect = Rect.new(@width - 1, 1, 1, @height - 2)
      self.bitmap.stretch_blt(rect, @skin, @rect['cursor_right'])
    end
  end
end

#==============================================================================
# ? SG::Window
#------------------------------------------------------------------------------
# ?
#==============================================================================

class Window
  #--------------------------------------------------------------------------
  # ? set instances variables
  #--------------------------------------------------------------------------
  attr_reader(:x, :y, :z, :width, :height, :ox, :oy, :opacity, :back_opacity,
              :stretch, :contents_opacity, :visible, :pause)
  attr_accessor :active
  #--------------------------------------------------------------------------
  # ? initialize
  #--------------------------------------------------------------------------
  def initialize()
    @skin = Skin.new
    @viewport = Viewport.new(0, 0, 0, 0)
    @cr_vport = Viewport.new(0, 0, 0, 0)
    @width = 0
    @height = 0
    @ox = 0
    @oy = 0
    @opacity = 255
    @back_opacity = 255
    @contents_opacity = 255
    @frame   = Sprite.new()
    @bg      = Sprite.new()
    @window  = Sprite.new(@viewport)
    @pause_s = Sprite.new()
    @arrows = []
    for i in 0...4
      @arrows.push(Sprite.new(@cr_vport))
      @arrows[i].bitmap = Bitmap.new(16, 16)
      @arrows[i].visible = false
    end
    @cursor_rect = Cursor_Rect.new(@cr_vport)
    @cursor_rect.margin = @skin.margin
    @cursor_fade = true
    @pause_s.visible = false
    @pause = false
    @active = true
    @stretch = true
    @visible = true
    self.x = 0
    self.y = 0
    self.z = 100
    self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
  end
  #--------------------------------------------------------------------------
  # ? contents=
  #--------------------------------------------------------------------------
  def contents=(bmp)
    @window.bitmap = bmp
    if bmp != nil
      if bmp.width > @viewport.rect.width
         bmp.height > @viewport.rect.height
        draw_arrows
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? contents
  #--------------------------------------------------------------------------
  def contents
    return @window.bitmap
  end
  #--------------------------------------------------------------------------
  # ? dispose
  #--------------------------------------------------------------------------
  def dispose
    @bg.dispose
    @frame.dispose
    @window.dispose
    @cursor_rect.dispose
    @viewport.dispose
    @pause_s.dispose
    @cr_vport.dispose
    for arrow in @arrows
      arrow.dispose
    end
  end
  #--------------------------------------------------------------------------
  # ? update
  #--------------------------------------------------------------------------
  def update
    @window.update
    @cursor_rect.update
    @viewport.update
    @cr_vport.update
    @pause_s.src_rect = @skin["pause#{(Graphics.frame_count / 8) % 4}"]
    @pause_s.update
    update_visible
    update_arrows
    if @cursor_fade
      @cursor_rect.opacity -= 10
      @cursor_fade = false if @cursor_rect.opacity <= 100
    else
      @cursor_rect.opacity += 10
      @cursor_fade = true if @cursor_rect.opacity >= 255
    end
  end
  #--------------------------------------------------------------------------
  # ? update_visible
  #--------------------------------------------------------------------------
  def update_visible
    @frame.visible = @visible
    @bg.visible = @visible
    @window.visible = @visible
    @cursor_rect.visible = @visible
    if @pause
      @pause_s.visible = @visible
    else
      @pause_s.visible = false
    end
  end
  #--------------------------------------------------------------------------
  # ? pause=
  #--------------------------------------------------------------------------
  def pause=(pause)
    @pause = pause
    update_visible
  end
  #--------------------------------------------------------------------------
  # ? update_arrows
  #--------------------------------------------------------------------------
  def update_arrows
    if @window.bitmap == nil or @visible == false
      for arrow in @arrows
        arrow.visible = false
      end
    else
      @arrows[0].visible = @oy > 0
      @arrows[1].visible = @ox > 0
      @arrows[2].visible = (@window.bitmap.width - @ox) > @viewport.rect.width
      @arrows[3].visible = (@window.bitmap.height - @oy) > @viewport.rect.height
    end
  end
  #--------------------------------------------------------------------------
  # ? visible=
  #--------------------------------------------------------------------------
  def visible=(visible)
    @visible = visible
    update_visible
    update_arrows
  end
  #--------------------------------------------------------------------------
  # ? x=
  #--------------------------------------------------------------------------
  def x=(x)
    @x = x
    @bg.x = x + 2
    @frame.x = x
    @viewport.rect.x = x + @skin.margin
    @cr_vport.rect.x = x
    @pause_s.x = x + (@width / 2) - 8
    set_arrows
  end
  #--------------------------------------------------------------------------
  # ? y=
  #--------------------------------------------------------------------------
  def y=(y)
    @y = y
    @bg.y = y + 2
    @frame.y = y
    @viewport.rect.y = y + @skin.margin
    @cr_vport.rect.y = y
    @pause_s.y = y + @height - @skin.margin
    set_arrows
  end
  #--------------------------------------------------------------------------
  # ? z=
  #--------------------------------------------------------------------------
  def z=(z)
    @z = z
    @bg.z = z
    @frame.z = z + 1
    @cr_vport.z = z + 2
    @viewport.z = z + 3
    @pause_s.z = z + 4
  end
  #--------------------------------------------------------------------------
  # ? ox=
  #--------------------------------------------------------------------------
  def ox=(ox)
    return if @ox == ox
    @ox = ox
    @viewport.ox = ox
    update_arrows
  end
  #--------------------------------------------------------------------------
  # ? oy=
  #--------------------------------------------------------------------------
  def oy=(oy)
    return if @oy == oy
    @oy = oy
    @viewport.oy = oy
    update_arrows
  end
  #--------------------------------------------------------------------------
  # ? width=
  #--------------------------------------------------------------------------
  def width=(width)
    @width = width
    @viewport.rect.width = width - @skin.margin * 2
    @cr_vport.rect.width = width
    if @width > 0 and @height > 0
      @frame.bitmap = Bitmap.new(@width, @height)
      @bg.bitmap = Bitmap.new(@width - 4, @height - 4)
      draw_window
    end
    self.x = @x
    self.y = @y
  end
  #--------------------------------------------------------------------------
  # ? height=
  #--------------------------------------------------------------------------
  def height=(height)
    @height = height
    @viewport.rect.height = height - @skin.margin * 2
    @cr_vport.rect.height = height
    if @height > 0 and @width > 0
      @frame.bitmap = Bitmap.new(@width, @height)
      @bg.bitmap = Bitmap.new(@width - 4, @height - 4)
      draw_window
    end
    self.x = @x
    self.y = @y
  end
  #--------------------------------------------------------------------------
  # ? opacity=
  #--------------------------------------------------------------------------
  def opacity=(opacity)
    value = [[opacity, 255].min, 0].max
    @opacity = value
    @contents_opacity = value
    @back_opacity = value
    @frame.opacity = value
    @bg.opacity = value
    @window.opacity = value
  end
  #--------------------------------------------------------------------------
  # ? back_opacity=
  #--------------------------------------------------------------------------
  def back_opacity=(opacity)
    value = [[opacity, 255].min, 0].max
    @back_opacity = value
    @bg.opacity = value
  end
  #--------------------------------------------------------------------------
  # ? contents_opacity=
  #--------------------------------------------------------------------------
  def contents_opacity=(opacity)
    value = [[opacity, 255].min, 0].max
    @contents_opacity = value
    @window.opacity = value
  end
  #--------------------------------------------------------------------------
  # ? cursor_rect
  #--------------------------------------------------------------------------
  def cursor_rect
    return @cursor_rect
  end
  #--------------------------------------------------------------------------
  # ? cursor_rect=
  #--------------------------------------------------------------------------
  def cursor_rect=(rect)
    @cursor_rect.x = rect.x
    @cursor_rect.y = rect.y
    if @cursor_rect.width != rect.width or @cursor_rect.height != rect.height
      @cursor_rect.set(@cursor_rect.x, @cursor_rect.y, rect.width, rect.height)
    end
  end
  #--------------------------------------------------------------------------
  # ? windowskin
  #--------------------------------------------------------------------------
  def windowskin
    return @skin.bitmap
  end
  #--------------------------------------------------------------------------
  # ? windowskin=
  #--------------------------------------------------------------------------
  def windowskin=(windowskin)
    return if windowskin == nil
    if @skin.bitmap != windowskin
      @pause_s.bitmap = windowskin
      @pause_s.src_rect = @skin['pause0']
      @skin.bitmap = windowskin
      @cursor_rect.skin = windowskin
      draw_window
      draw_arrows
    end
  end
  #--------------------------------------------------------------------------
  # ? margin=
  #--------------------------------------------------------------------------
  def margin=(margin)
    if @skin.margin != margin
      @skin.margin = margin
      self.x = @x
      self.y = @y
      temp = @height
      self.height = 0
      self.width = @width
      self.height = temp
      @cursor_rect.margin = margin
      set_arrows
    end
  end
  #--------------------------------------------------------------------------
  # ? stretch=
  #--------------------------------------------------------------------------
  def stretch=(bool)
    if @stretch != bool
      @stretch = bool
      draw_window
    end
  end
  #--------------------------------------------------------------------------
  # ? set_arrows
  #--------------------------------------------------------------------------
  def set_arrows
    @arrows[0].x = @width / 2 - 8
    @arrows[0].y = 8
    @arrows[1].x = 8
    @arrows[1].y = @height / 2 - 8
    @arrows[2].x = @width - 16
    @arrows[2].y = @height / 2 - 8
    @arrows[3].x = @width / 2 - 8
    @arrows[3].y = @height - 16
  end
  #--------------------------------------------------------------------------
  # ? draw_arrows
  #--------------------------------------------------------------------------
  def draw_arrows
    return if @skin.bitmap == nil
    @arrows[0].bitmap.blt(0, 0, @skin.bitmap, @skin['arrow_up'])
    @arrows[1].bitmap.blt(0, 0, @skin.bitmap, @skin['arrow_left'])
    @arrows[2].bitmap.blt(0, 0, @skin.bitmap, @skin['arrow_right'])
    @arrows[3].bitmap.blt(0, 0, @skin.bitmap, @skin['arrow_down'])
    update_arrows
  end
  #--------------------------------------------------------------------------
  # ? draw_window
  #--------------------------------------------------------------------------
  def draw_window
    return if @skin.bitmap == nil
    return if @width == 0 or @height == 0
    m = @skin.margin
    if @frame.bitmap.nil?
      @frame.bitmap = Bitmap.new(@width, @height)
      @bg.bitmap = Bitmap.new(@width - 4, @height - 4)
    end
    @frame.bitmap.clear
    @bg.bitmap.clear
    if @stretch
      dest_rect = Rect.new(0, 0, @width-4, @height-4)
      @bg.bitmap.stretch_blt(dest_rect, @skin.bitmap, @skin['bg'])
    else
      bgw = Integer((@width-4) / 128) + 1
      bgh = Integer((@height-4) / 128) + 1
      for x in 0..bgw
        for y in 0..bgh
          @bg.bitmap.blt(x * 128, y * 128, @skin.bitmap, @skin['bg'])
        end
      end
    end
    bx = Integer((@width - m*2) / @skin['up'].width) + 1
    by = Integer((@height - m*2) / @skin['left'].height) + 1
    for x in 0..bx
      w = @skin['up'].width
      @frame.bitmap.blt(x * w + m, 0, @skin.bitmap, @skin['up'])
      @frame.bitmap.blt(x * w + m, @height - m, @skin.bitmap, @skin['down'])
    end
    for y in 0..by
      h = @skin['left'].height
      @frame.bitmap.blt(0, y * h + m, @skin.bitmap, @skin['left'])
      @frame.bitmap.blt(@width - m, y * h + m, @skin.bitmap, @skin['right'])
    end
    @frame.bitmap.erase(@width - m, 0, m, m)
    @frame.bitmap.erase(0, @height - m, m, m)
    @frame.bitmap.erase(@width - m, @height - m, m, m)
    @frame.bitmap.blt(0, 0, @skin.bitmap, @skin['ul_corner'])
    @frame.bitmap.blt(@width - m, 0, @skin.bitmap, @skin['ur_corner'])
    @frame.bitmap.blt(0, @height - m, @skin.bitmap, @skin['dl_corner'])
    @frame.bitmap.blt(@width - m, @height - m, @skin.bitmap, @skin['dr_corner'])
  end
end

then i did this in a scene to delete parts of the windowskin:

class Window
  def erase(x, y, width, height)
    @frame.bitmap.erase(x, y, width, height)
    @bg.bitmap.erase(x, y, width, height)
  end
end
class Test < Window_Base
  def initialize
    super(0, 0, 400, 400)
  end
end
class Test_Scene
  def main
    @test = Test.new
    @test.erase(0, 0, 100, 100)
    Graphics.transition
    loop { Graphics.update; Input.update; break if $scene != self }
    @test.dispose
  end
end

so the idea is to delete the windowskin where the image will overlap, then you wont see the over lap when turning the transparency down, i did try to find a recreation of the real window class but i had no luck :(
49
cool, thanks for the help :D
50
Quote from: KK20 on August 31, 2012, 09:23:13 pm
Personally, I would have modified def passable? in either Game_Character or Game_Player.

what i did modify it in Game_Player  :^_^': also wow, i have no idea how it works but that code snipet is really good, that poops all over my array :P well i sorta get how it works, it checking the sprite coordinates right?
51
i did actually do that before doing this by getting it to void $game_player.update if the pushing flag was true, on that note what method do you think is better and faster? i implemented this so there wouldnt be a freeze in movement and the player could move to other tiles and move other objects while the object is moving

edit:

for i in 0...array.size
  array.delete(array[i]) if array[i][0] == event.id &&
    $game_map.events[event.id].moving? == false
end

that actually worked, the problem was i was putting it inside the "if array.include?([event.id, new_x, new_y])" condition, so it wasnt deleting it until i went to those coordinates, i should probably add it to an update function  :roll:
52
hey there, i have been making a script to manage pushing movable object, the main part of it is changing the events previous x and y as unpassable until the event has finished moving, this is so that the event cant be spammed and so the graphics doesnt overlap the player while its moving to the next tile, heres my script:

class Interpreter
  #--------------------------------------------------------------------------
  # * push_object(event to push)
  #--------------------------------------------------------------------------
  def push_object(event_id)
    #set event to push
    event = $game_map.events[event_id]
    # store x and y
    old_x, old_y = event.x, event.y
    #push the info into array
    $game_system.movable_object.push([event_id, old_x, old_y])
    p $game_system.movable_object
    #p $game_system.movable_object
    #event move down if player direction is 2 and event can enter the tile
    event.move_down if $game_player.direction == 2 &&
      $game_map.passable?(event.x, event.y + 1, 8)
    #event move left if player direction is 4 and event can enter the tile
    event.move_left if $game_player.direction == 4 &&
      $game_map.passable?(event.x - 1, event.y, 6)
    #event move right if player direction is 6 and event can enter the tile
    event.move_right if $game_player.direction == 6 &&
      $game_map.passable?(event.x + 1, event.y, 4)
    #event move up if player direction is 8 and event can enter the tile
    event.move_up if $game_player.direction == 8 &&
      $game_map.passable?(event.x, event.y - 1, 2)
    return unless event.moving?
    #play the push sound if the event is moving
    $game_system.se_play(RPG::AudioFile.new("bump"))
  end
end
#
#
#
class Game_System
  attr_accessor :movable_object
  alias init_push initialize
  def initialize
    init_push
    @movable_object = []
  end
end
#
#
#
class Game_Player
  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)



    array = $game_system.movable_object
    p array
    for event in $game_map.events.values
      #p array
      if array.include?([event.id, new_x, new_y])
        return false if event.moving?
        array.delete([event.id, new_x, new_y) if $game_map.events[event.id].moving? == false
      end
    end



    # If coordinates are outside of map
    unless $game_map.valid?(new_x, new_y)
      # Impassable
      return false
    end
    # If debug mode is ON and ctrl key was pressed
    if $DEBUG and Input.press?(Input::CTRL)
      # Passable
      return true
    end
    super
  end
end

this code works fine, my main question is about how im deleting the array, at the moment its only deleting the array if i am entering the tile that was locked, i think the best way would be to delete any array if the asociated event is not moving, i did try it like this:

for i in 0...array.size
          array.delete(array[i]) if array[i][0] == event.id &&
            $game_map.events[event.id].moving? == false
        end

but that didnt work :(
53
what i meant really was tht is there a way to cut out having to enter the volume, say i only wanted to manipulate the name and pitch, so i would efectively get this: RPG::AudioFile.new("sound",pitch) cutting out volume and getting it to return the default in RPG::AudioFile, like i said just if i wanted to be anal about it  :P

54
hey there guys, it is confusing me on how i exactly use a script call to play a sound from inside a script, for example i can play a sound using the following :

$game_system.se_play($data_system.cancel_se)

and that will play the cancel sound in the database, but what if i want to use that function to play a sound i want it to play?
looking at interpreter to see how an event does it is useless as i get this:
$game_system.se_play(@parameters[0])
and i have no idea on the structure of that parameter, i can play a sound like so:
Audio.se_play("Audio/SE/" + "sound", VOL, PITCH)
but what i really want to do is know how to use the $game_system.se_play function
edit:
ok looking through the help file i found i need to use: RPG::AudioFile
i applyed it like this: RPG::AudioFile.new("sound")
so i have managed to set the sound with the method i wanted, but say i wanted to be really anal and set the sound name and pitch but leave  the volume as default how would i apply it? e.g: RPG::AudioFile.new("sound", DEFAULT, 150)
55
RMXP Script Database / Re: [XP] RMX-OS
August 23, 2012, 08:48:30 am
hey, i think i have seen this question asked before, but i cant remember the reply and cant see it on a quick scroll through the posts, i was wondering if and how hard it would be to implement global events? i dont want all events to be global just specified ones, like special game events occuring etc. if it is possible to achieve could you point me in the right direction? i want to get my head around this system so i can script for it alot more :D
56
Script Requests / Re: [XP] Events/Enemies Chase Script
August 08, 2012, 08:23:55 pm
everything that was $monster_dist_thresh should now be $game_system.monster_dist_thresh, in the demo it was only the conditional branches that checked this, have you changed the structure much? post a screenshot of what your events look like at the moment, you also dont need to set $game_system.monster_dist_thresh to 6 at the start of the game as the initialize method does that for you
57
General Discussion / Re: my real time animated menu
August 08, 2012, 07:59:24 pm
i dont plan on making my windows the size of the screen like seen in the item one, mostly they will be around the size of the stat details one you saw, to save size i will probably only have the icons of items etc in the selection window, then have a small detail window below giving description on the currently selected item, i agree the sliding windows are a little time consuming, i might try fading them in depending on the curently selected menu, but i will get there :D
58
Script Requests / Re: [XP] Events/Enemies Chase Script
August 08, 2012, 07:53:09 pm
i tested what foreverzer0 added with the original demo that aqua posted and it worked fine, theres definatly something breaking it in your project
59
General Discussion / Re: my real time animated menu
August 07, 2012, 06:28:46 am
thanks :) ill defiantly be adding short-cuts to quickly navigate to them with it been a real time menu and what not :) also the actual menu will be bigger, but yes i will defo have to make sure the windows aren't to big, like the current equipped menu is way to big as it obstructs the character, i think i may make a ragdol image of the equipped items, then i can make a small info window linking to the currently selected equipment
60
General Discussion / my real time animated menu
August 06, 2012, 03:29:29 am
hi there guys, i have been currently been developing a real time one player menu for my rmx-os project, so i was wondering what people thought of it, its nowhere near complete, i plan on making the windows images and having the menu selections as images etc, but i was mainly wondering what people thought of the structure of it :) alas here it is:
http://youtu.be/2w9iBqaDLZY