Jump to content
New account registrations are disabed. This website is now an archive. Read more here.

Question

hey guys, iv been getting into scripting and thought id start with a custom window, im having trouble with my script though, so i have a map scene here, which draws a map, and has an index to grid the map up, the problem is my index cursor is being drawn behind the map image, the only way i can see it is if i reduce the opacity of the maps image, which makes my map look really dull as it is merging it with the color scheme of my windowskin, so i need to change the self.z of either the index's cursor, or the image, heres my script as it stands:

 

 

#==============================================================================

# ** Window_Map

#------------------------------------------------------------------------------

class Window_MapMenu < Window_Base

#--------------------------------------------------------------------------

# * Object Initialization

#--------------------------------------------------------------------------

def initialize

super(0, 0, 640, 480)

self.contents = Bitmap.new(width - 32, height - 32)

refresh

end

#-------------------------------------------------------------------------

# * def index

#-------------------------------------------------------------------------

def index=(index)

@index = index

# Update cursor rectangle

update_cursor_rect

end

#--------------------------------------------------------------------------

# * Cursor Rectangle Update

#--------------------------------------------------------------------------

def update_cursor_rect

x = 32 + @index % 17 * 32

y = 0 + @index / 17 % 14 * 32

self.cursor_rect.set(x, y, 32, 32)

 

end

#--------------------------------------------------------------------------

# * Refresh

#--------------------------------------------------------------------------

def refresh

@bitmap = RPG::Cache.picture("kantomap.png")

self.contents.blt(32, 0, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 160)

end

 

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

super

# if enter is being pressed

if Input.trigger?(Input::C)

if @index == 172

# Play decision SE

$game_system.se_play($data_system.decision_se)

# Switch to item screen

$scene = Scene_PalletTown.new

end

end

# If right directional button is pushed

if Input.repeat?(Input::RIGHT)

# If directional button pressed down is not a repeat, or

# cursor is not positioned on the right edge

if Input.trigger?(Input::RIGHT) or

@index % 17 < 16

# Move cursor to right

$game_system.se_play($data_system.cursor_se)

if @index % 17 < 16

@index += 1

end

end

end

# If left directional button is pushed

if Input.repeat?(Input::LEFT)

# If directional button pressed down is not a repeat, or

# cursor is not positioned on the left edge

if Input.trigger?(Input::LEFT) or

@index % 17 > 0

# Move cursor to left

$game_system.se_play($data_system.cursor_se)

if @index % 17 > 0

@index -= 1

end

end

end

# If down directional button is pushed

if Input.repeat?(Input::DOWN)

# Move cursor down

if @index / 17 < 13

@index += 17

$game_system.se_play($data_system.cursor_se)

end

end

# If up directional button is pushed

if Input.repeat?(Input::UP)

# Move cursor up

if @index / 17 > 0

@index -= 17

$game_system.se_play($data_system.cursor_se)

end

end

update_cursor_rect

end

end

#---------------------------------------------------------------------------

# * Scene Map_Menu

#---------------------------------------------------------------------------

class Scene_MapMenu

def initialize(index = 0)

@index = index

end

#-------------------------------------------------------------------------

# * MAIN

#-------------------------------------------------------------------------

def main

@mapmenu_window = Window_MapMenu.new

@mapmenu_window.index = @index

# Execute transition

Graphics.transition

# Main loop

loop do

# Update game screen

Graphics.update

# Update input information

Input.update

# Frame update

update

# Abort loop if screen is changed

if $scene != self

break

end

end

# Prepare for transition

Graphics.freeze

# Dispose of windows

@mapmenu_window.dispose

end

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

# Update windows

@mapmenu_window.update

# If B button was pressed

if Input.trigger?(Input::B)

# Play cancel SE

$game_system.se_play($data_system.cancel_se)

# Switch to Menu screen

$scene = Scene_Item.new

return

end

end

end

#---------------------------------------------------------------------------

# * class Window_PalletTown

#---------------------------------------------------------------------------

class Window_PalletTown < Window_Base

#-------------------------------------------------------------------------

# * Object Initialization

#-------------------------------------------------------------------------

def initialize

super(0, 0, 416, 352)

self.contents = Bitmap.new(width - 32, height - 32)

refresh

end

#-------------------------------------------------------------------------

# * refresh

#-------------------------------------------------------------------------

def refresh

@bitmap = RPG::Cache.picture("pallettown.png")

self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height), 255)

end

end

 

#---------------------------------------------------------------------------

# * Scene_PalletTown

#---------------------------------------------------------------------------

class Scene_PalletTown

#-------------------------------------------------------------------------

# * Main

#-------------------------------------------------------------------------

def main

@pallettown_window = Window_PalletTown.new

# Execute transition

Graphics.transition

# Main loop

loop do

# Update game screen

Graphics.update

# Update input information

Input.update

# Frame update

update

# Abort loop if screen is changed

if $scene != self

break

end

end

# Prepare for transition

Graphics.freeze

# Dispose of windows

@pallettown_window.dispose

end

#--------------------------------------------------------------------------

# * Frame Update

#--------------------------------------------------------------------------

def update

# Update windows

@pallettown_window.update

# if mapmenu is active call update_map

# If B button was pressed

if Input.trigger?(Input::B)

# Play cancel SE

$game_system.se_play($data_system.cancel_se)

# Switch to map screen

$scene = Scene_MapMenu.new(172)

return

end

end

end

 

 

 

if anyone knows how i can solve this i would be very grateful, iv tried multiple solutions but to no avail :(

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

its a map script for pokemon, the scene pallet town will open a window with a zoomed image of the town, much like in the actual pokemon games, obvo they will be a scene for all the index's with a town or route, regards to my question, i have solved it on another forum smile.png

here, if anyone stumbles upon this looking for a resolution :http://forum.chaos-project.com/index.php/topic,11398.new/boardseen.html#new

Edited by diagostimo

Share this post


Link to post
Share on other sites
  • 0

I recently just got in a fist fight trying to figure out Z, but it was for the way Events were being set with screen_z, and I havent learned how to do the Windows aspects in RGSS yet, so I am no help.

 

BTW, if you have code, you could probably hide it in CODE and SPOILER tags for easier readability, and so we can get access to formatted text... I'll try looking at this...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...