• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Resource icon

Resource Gen 8-Style Item Find Description 2.0

hostman

Trainer
Member
Joined
Aug 24, 2023
Posts
70
I copy and paste into plugins, but it doesn't work, I keep collecting the objects the same, do you know why?
 

komeiji514

Elite Trainer
Member
Joined
Oct 28, 2023
Posts
267
Working in v20.1 after changing
@sprites["itemicon"] = ItemIconSprite.new(42, Graphics.height - 48, -1, @viewport)
to
@sprites["itemicon"] = ItemIconSprite.new(42, Graphics.height - 48, nil, @viewport)

Thank you TechSkylander1518 for this solution!
It's also compatible with v21.1 as far as I have tested.
 

rafahbit

Trainer
Member
Joined
Oct 21, 2020
Posts
53
In my game in version 21.1 the plugin didn't work, so I tweaked what I could and managed to make it work correctly for items and berries.


Item Find:
Expand Collapse Copy
#-------------------------------------------------------------------------------
# Item Find
# v2.0
# By Boonzeet
#-------------------------------------------------------------------------------
# A script to show a helpful message with item name, icon and description
# when an item is found for the first time.
#-------------------------------------------------------------------------------

WINDOWSKIN_NAME = "" # set for custom windowskin

#-------------------------------------------------------------------------------
# Save data registry
#-------------------------------------------------------------------------------
SaveData.register(:item_log) do
  save_value { $item_log }
  load_value { |value|  $item_log = value }
  new_game_value { ItemLog.new }
end

#-------------------------------------------------------------------------------
# Base Class
#-------------------------------------------------------------------------------

class PokemonItemFind_Scene
  def pbStartScene
    @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
    @viewport.z = 99999
    @sprites = {}
    skin = WINDOWSKIN_NAME == "" ? MessageConfig.pbGetSystemFrame : "Graphics/Windowskins/" + WINDOWSKIN_NAME

    @sprites["background"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, Graphics.width, 0, @viewport)
    @sprites["background"].z = @viewport.z - 1
    @sprites["background"].visible = false
    @sprites["background"].setSkin(skin)

    colors = getDefaultTextColors(@sprites["background"].windowskin)

    @sprites["itemicon"] = ItemIconSprite.new(42, Graphics.height - 48, nil, @viewport)
    @sprites["itemicon"].visible = false
    @sprites["itemicon"].z = @viewport.z + 2

    @sprites["descwindow"] = Window_UnformattedTextPokemon.newWithSize("", 64, 0, Graphics.width - 64, 64, @viewport)
    @sprites["descwindow"].windowskin = nil
    @sprites["descwindow"].z = @viewport.z
    @sprites["descwindow"].visible = false
    @sprites["descwindow"].baseColor = colors[0]
    @sprites["descwindow"].shadowColor = colors[1]

    @sprites["titlewindow"] = Window_UnformattedTextPokemon.newWithSize("", 0, 0, 128, 16, @viewport)
    @sprites["titlewindow"].visible = false
    @sprites["titlewindow"].z = @viewport.z + 1
    @sprites["titlewindow"].windowskin = nil
    @sprites["titlewindow"].baseColor = colors[0]
    @sprites["titlewindow"].shadowColor = colors[1]
  end

  def pbShow(item)
    item_object = GameData::Item.get(item)
    name = item_object.name
    description = item_object.description

    descwindow = @sprites["descwindow"]
    descwindow.resizeToFit(description, Graphics.width - 64)
    descwindow.text = description
    descwindow.y = Graphics.height - descwindow.height
    descwindow.visible = true

    titlewindow = @sprites["titlewindow"]
    titlewindow.resizeToFit(name, Graphics.height)
    titlewindow.text = name
    titlewindow.y = Graphics.height - descwindow.height - 32
    titlewindow.visible = true

    background = @sprites["background"]
    background.height = descwindow.height + 32
    background.y = Graphics.height - background.height
    background.visible = true

    itemicon = @sprites["itemicon"]
    itemicon.item = item_object.id
    itemicon.y = Graphics.height - (descwindow.height / 2).floor
    itemicon.visible = true

    loop do
      background.update
      itemicon.update
      descwindow.update
      titlewindow.update
      Graphics.update
      Input.update
      pbUpdateSceneMap
      if Input.trigger?(Input::B) || Input.trigger?(Input::C)
        pbEndScene
        break
      end
    end
  end

  def pbEndScene
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
  end
end

#-------------------------------------------------------------------------------
# Item Log class
#-------------------------------------------------------------------------------
# The store of found items
#-------------------------------------------------------------------------------
class ItemLog
  def initialize
    @found_items = []
  end

  def register(item)
    unless @found_items.include?(item)
      @found_items.push(item)
      scene = PokemonItemFind_Scene.new
      scene.pbStartScene
      scene.pbShow(item)
    end
  end
end

#-------------------------------------------------------------------------------
# Overrides of pbItemBall and pbReceiveItem
#-------------------------------------------------------------------------------
# Picking up an item found on the ground
#-------------------------------------------------------------------------------

alias pbItemBall_itemfind pbItemBall
def pbItemBall(item, quantity = 1)
  result = pbItemBall_itemfind(item, quantity)
  $item_log.register(item) if result
  return result
end

alias pbReceiveItem_itemfind pbReceiveItem
def pbReceiveItem(item, quantity = 1)
  result = pbReceiveItem_itemfind(item, quantity)
  $item_log.register(item) if result
  return result
end

#-------------------------------------------------------------------------------
# Override of pbPickBerry
#-------------------------------------------------------------------------------

alias pbPickBerry_itemfind pbPickBerry
def pbPickBerry(berry, qty = 1)
  result = pbPickBerry_itemfind(berry, qty)
  $item_log.register(berry) if $bag && $bag.has?(berry)
  return result
end

Even though this plugin seems simple, it helps you know what the item does whenever you receive it and without having to look for a bag, so I think it's very good
 
Back
Top