Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

How to draw a tile icon in a window. It didn't work.

Alright guys.
You said to be specific so how much more specific can I get?
I followed this custom window tutorial exactly as it told me to http://www.rpgrevolution.com/tutorial/creating-a-custom-window_23.html

This is the detailed explanation of my issue.

I created a new class above name.
Contains this code:
Code:
class Window_ItemGet < Window_Base

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

attr_accessor :type # 3

attr_accessor :id

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

def initialize(type, id)

super(220, 180, 220, 96) # 1

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

self.back_opacity = 255

self.contents.font.name = "Arial"

self.contents.font.size = 18

@type = type

@id = id

refresh # 2

end

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

def refresh

self.contents.clear

self.contents.font.color = normal_color

self.contents.draw_text(4, 0, 180, 32, "Acquired")

if @type == 1

self.draw_item_name($data_items[@id], 4, 32)

end

if @type == 2

self.draw_item_name($data_weapons[@id], 4, 32)

end

if @type == 3

self.draw_item_name($data_armors[@id], 4, 32)

end

end 

 

 

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

 

 

 

def update

super

end

end

At the beggining of the Scene_Map class I added this line underneath the class definition command:

Code:
attr_accessor :item_acquired # 5

 

Underneath line 15 in Scene_Map which contains this command " @message_window = Window_Message.new"

I added this code:
Code:
 @acquire_window = Window_ItemGet.new(1, 0) # 1

    @acquire_window.visible = false # 2

    @itemdelay = -1 # 3

    @item_acquired = [0, 0] # 4

Then I changed the update method of Scene_Map to this, just as it said in the tutorial::

Code:
def update

    # Loop

    loop do

      # Update map, interpreter, and player order

      # (this update order is important for when conditions are fulfilled 

      # to run any event, and the player isn't provided the opportunity to

      # move in an instant)

      $game_map.update

      $game_system.map_interpreter.update

      $game_player.update

      # Update system (timer), screen

      $game_system.update

      $game_screen.update

      # Abort loop if player isn't place moving

      unless $game_temp.player_transferring

        break

      end

      # Run place move

      transfer_player

      # Abort loop if transition processing

      if $game_temp.transition_processing

      

        break

      end

    end

    

    @spriteset.update #This is the added part

if @itemdelay > 0 

@itemdelay -= 1 # 2

end

if @itemdelay == 0 # 3

@itemdelay = -1

@acquire_window.visible = false

@item_acquired[0] = 0

@item_acquired[1] = 0 #This is the end of the added part. It continues with the default code for Scene_map

#Nothing was deleted. Only pasted in underneath the above code.

end

And then I have an event that's action button triggered with a sprite (Doesn't matter which one)
and I use the script command. The following code is in the script command:

Code:
 

$scene.item_aquired[0]=2

$scene.item_aquired[1]=1

 

Here is a screen shot of the error message.
It loads, it goes to the game environment. As soon as I speak with the sprite and activate the script event, it crashes. Apparently either I did something wrong or the person who wrote this tutorial to begin with forgot to define a method...
It kinda sucks when your trying to learn something and those who write tutorials don't create
executable examples. Any help is appreciated. ^^ I'm just trying to learn.
Error.jpg
 
Is there any way to display more than one item in that same window?
Any ideas...
also how would I put one of those graphics into just a normal text window.
I know I'd have to make an instance of message_Window or something..
but... any suggestions?
 
Thing is I'd rather learn to do this from scratch than use somone else's system.
Also, those aren't for commercial use and I plan on making a game that I can sell.
Thank you for your time.. but I really want to learn how to do this stuff from complete scratch.
Could somone just explain it here? Or point me to a tutorial? So far I haven't found one that explains this...

Rgss is difficult because you can't just use one command line to do something...
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top