Notes and Letter System

Hi guys,

can someone help me set up something like the notes system in Vampyr?

Spoiler: Screenshot
1717777247775.png

I want to display a cosmetic picture of the note / letter on the one side and the actual note text on the other side like seen in the screenshot.

It must not be as fancy as seen on the screenshot. Blurring the map instead of using a custom background would already be enough.

It would be fine for me to set up the text of each note via scriptcall.

Reading letters is a nice tool to add some lore to games that not really have a somewhat deep background story.

Would appreciate any help.
Just to put it out there, you could do this without any scripts. Just give the letter items a common event that uses Show Image to display that - the image file has the picture and the text on it.
Just to put it out there, you could do this without any scripts. Just give the letter items a common event that uses Show Image to display that - the image file has the picture and the text on it.
I need the text and picture separated like you see above as I'm going to use the same pic over and over again. And the background needs to be blurred for better reading what the text says. So I think a Scene_letter would be exactly what I need here. Just like in that oldschool horror games. 🙂

€: if this is possible with Events (blurred screen and display text centered on one side of the screen without using the textbox) feel free to show me how. I rarely draw own windows using scriptcalls in Events, so maybe it's possible like you say, but I don't know it for sure.

I made a mockup with GIMP of what I think looks good enough for the notes display. I would appreciate a lot if someone could provide me with a script for it. Please also let me know if you have suggestions for the layout. I'm not too set in my ways when it comes to the layout.

Spoiler: Mockup
Notes_Mockup.png

Spoiler: Pergament PNG
Brief2.png
If someone's up for the challenge, I'd highly appreciate it.
I do plan on giving it a try. Shouldn't be too hard
But it will probably need to be something like an encyclopedia thing where you select the item then the big window comes up to show the image and text.
I'm also working on something else at the moment and life is busy as well.

@Tw0Face
Here is a start. Let me know what has to change.
removed. script updated further down
@Roninator2
Thanks for your work so far. The window pops in with a little weird transition and the letter position is off, but could be fixed by simply altering the coordinates. I couldn't test how the letter's content displays, as the script errors out immediately when clicking on the letter, but the layout as far as I notice is nice. If a menu is mandatory for displaying the letters, maybe we could access it with a button?
weird transition
I don't notice it.
the letter position is off
you mean the image is not centered. I did nothing to make images center. I leave it to you to change the image size. if the image you are using is smaller than the window then you can adjust the image size so when it is shown it would look more to the middle
I couldn't test how the letter's content displays, as the script errors out immediately when clicking on the letter
Please provide errors. I do not get any issues
maybe we could access it with a button?
You want the access to be in the menu? which menu?
I don't notice it.
It pops in with what I think are two overlapping dummy windows fading in and then out (had to be fast to capture this).

Spoiler: Picture 1 Testing
Unbenannt1.png

Please provide errors. I do not get any issues
Maybe I set it up wrong then. This is what I get once I select the note.

Spoiler: Picture 2
Unbenannt2.png

This is how I set it up.

Spoiler: Picture 3
1718740630546.png
Maybe I set it up wrong then. This is what I get once I select the note.
That's because you removed the array brackets.
18 => ["This is a basic item"],


I'll try to work on making the windows not show for you. I forgot these are important things for you where as for me they don't matter and are minor issues.

Done. changed from close to hide
That's because you removed the array brackets.
18 => ["This is a basic item"],
I didn't make any changes to your script, I just copy-pasted it in the Script Editor :LZSblush: Maybe I miss something else? As I get the same error with your new script.

€: Dang, it was the array number. Got it, thanks. I should've looked more closely.

I'll try to work on making the windows not show for you. I forgot these are important things for you where as for me they don't matter and are minor issues.

Done. changed from close to hide
Thanks for the efforts, Ronny, now it opens quite nicely. I know I can be quite a perfectionist when it comes to those details, but I'm glad you always find a way to fit those things in.
€: Dang, it was the array number. Got it, thanks. I should've looked more closely.
Fixed it. If the item you have in the list is not in the hash then it will show nothing for the text
Fixed it. If the item you have in the list is not in the hash then it will show nothing for the text
Nice, thanks.

For the displaying text of a note, with the current layout, can we go fullscreen here? This would allow me to have more space to enter content there.
Nice, thanks.

For the displaying text of a note, with the current layout, can we go fullscreen here? This would allow me to have more space to enter content there.
So don't show the image on the second window. just a page of text?
no problem.
Removed script updated further down
@Roninator2
For some reason, the text shows only "This is a basic item" and not the actual text. Guess this should be displayed as the name instead? What am I doing wrong?
@Roninator2
For some reason, the text shows only "This is a basic item" and not the actual text. Guess this should be displayed as the name instead? What am I doing wrong?
1718832115375.png
Okay, it was again my mistake. Sorry for bothering you. :LZSblush:

Currently, I'm trying to insert an icon to the close text, so I get the below result. Mind to teach me how I can do this?

Ruby:
\\I[icon_index] Press to exit

The rest is 100% perfect and I can't thank you enough for making this possible to me.
We have to change the draw_text into a draw_text_ex
Line 329 or near there in the def refresh method
change the
draw_text(0, contents.height - 24, contents.width, 24, R2_NAL::RETURN_TEXT)
into
draw_text_ex(0, contents.height - 24, R2_NAL::RETURN_TEXT)

Then the \\I[icon] will work

This is because draw_text_ex processes the escape characters and draw_text does not.
Thanks @Roninator2 :LZSjoy:

Can I have the window in which the text of the letter is displayed semi-transparent, so that the window below hides when clicking the letter item and then then letter text is displayed, on a semi-transparent window and not opaque as it is now?

Unbenannt4.png


This is the version of the script I use now. I made some adjustments to the letter image and added some sound effects, which turns out nicely.

Spoiler: Notes and Letters
Ruby:
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: Notes and Letters                      ║  Version: 1.00     ║
# ║ Author: Roninator2                            ║                    ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function:                                     ║   Date Created     ║
# ║                                               ╠════════════════════╣
# ║   Display a scene for notes and clues         ║    17 Jun 2024     ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: nil                                                      ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description:                                                 ║
# ║      A new scene to show information from notes and letters        ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions:                                                      ║
# ║   Use note tag in note box to make the item a Note or Letter       ║
# ║       <nal>                                                        ║
# ║  Use note tag to specify the image that will be shown for the item ║
# ║       <nal image: Image>                                           ║
# ║  Call scene with SceneManager.call(Scene_NAL)                      ║
# ║                                                                    ║
# ║  Images go in the pictures folder                                  ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates:                                                           ║
# ║ 1.00 - 17 Jun 2024 - Script finished                               ║
# ║ 1.01 - 19 Jun 2024 - Make text full screen                         ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks:                                                ║
# ║   Roninator2                                                       ║
# ║                                                                    ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use:                                                      ║
# ║  Follow the original Authors terms of use where applicable         ║
# ║    - When not made by me (Roninator2)                              ║
# ║  Free for all uses in RPG Maker except nudity                      ║
# ║  Anyone using this script in their project before these terms      ║
# ║  were changed are allowed to use this script even if it conflicts  ║
# ║  with these new terms. New terms effective 03 Apr 2024             ║
# ║  No part of this code can be used with AI programs or tools        ║
# ║  Credit must be given                                              ║
# ╚════════════════════════════════════════════════════════════════════╝

module R2_NAL
  # title text
  TITLE = "Scene to view all Notes and Letters"
  # regex to match in item note box
  NAL = /<nal>/i
  NAL_IMAGE = /<nal image: (\w+(?:[, ]*\w*)*)>/i
  # set font settings
  NAL_FONT = "VL Gothic"
  NAL_FONT_SIZE = 24
  NAL_FONT_BOLD = false
  NAL_FONT_ITALIC = false
  # text to show for returning
  RETURN_TEXT = "\\I[1941] Cancel"
 
  NAL_TEXT = { # place the item text here
              10 => ["Put your text here. new lines",
                      "go like this in the quotes"], # comma at the end
  # carefull how much is placed in the line. too much and it will get cut off
              12 => ["This is a basic item"],
          # add more as needed

} # do not touch
end

# ╔════════════════════════════════════════════════════════════════════╗
# ║                      End of editable region                        ║
# ╚════════════════════════════════════════════════════════════════════╝

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
 
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_nal load_database; end
  def self.load_database
    load_database_nal
    load_notetags_nal
  end
 
  #--------------------------------------------------------------------------
  # load_notetags_nal
  #--------------------------------------------------------------------------
  def self.load_notetags_nal
    for obj in $data_items
      next if obj.nil?
      obj.load_notetags_nal
    end
  end
 
end

#==============================================================================
# ■ RPG::Item
#==============================================================================

class RPG::Item
 
  attr_accessor :nal
  attr_accessor :nal_image

  #--------------------------------------------------------------------------
  # load_notetags_nal
  #--------------------------------------------------------------------------
  def load_notetags_nal
    @nal = false
    self.note.split(/[\r\n]+/).each { |line|
      case line
      when R2_NAL::NAL
        @nal = true
      when R2_NAL::NAL_IMAGE
        @nal_image = $1.to_s
      end
    }
  end
 
end

#==============================================================================
# ■ Window NAL Item
#==============================================================================

class Window_NAL_Title < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, Graphics.width, fitting_height(1))
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_text(0,0,Graphics.width, 24, R2_NAL::TITLE, 1)
  end
end

#==============================================================================
# ■ Window Note List
#==============================================================================

class Window_Note_List < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    @data = []
    refresh
    select(0)
  end
  #--------------------------------------------------------------------------
  # * Get Digit Count
  #--------------------------------------------------------------------------
  def col_max
    return 1
  end
  #--------------------------------------------------------------------------
  # * Get Number of Items
  #--------------------------------------------------------------------------
  def item_max
    @data ? @data.size : 1
  end
  #--------------------------------------------------------------------------
  # * Get Item
  #--------------------------------------------------------------------------
  def item
    @data && index >= 0 ? @data[index] : nil
  end
  #--------------------------------------------------------------------------
  # * Include in Item List?
  #--------------------------------------------------------------------------
  def include?(item)
    item.is_a?(RPG::Item) && item.nal != false
  end
  #--------------------------------------------------------------------------
  # * Create Item List
  #--------------------------------------------------------------------------
  def make_item_list
    @data = $game_party.all_items.select {|item| include?(item) }
    @data.push(nil) if include?(nil)
  end
  #--------------------------------------------------------------------------
  # * Restore Previous Selection Position
  #--------------------------------------------------------------------------
  def select_last
    select(@data.index($game_party.last_item.object) || 0)
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x, rect.y)
    end
  end
  #--------------------------------------------------------------------------
  # * Image Window
  #--------------------------------------------------------------------------
  def image_window=(window)
    @image_window = window
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    super
    @image_window.set_item(item) if @image_window
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    make_item_list
    create_contents
    draw_all_items
  end
end

#==============================================================================
# ■ Window NAL Image
#==============================================================================

class Window_NAL_Image < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_image(image)
    if image != @image
      @image = image
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Clear
  #--------------------------------------------------------------------------
  def clear
    set_image(nil)
  end
  #--------------------------------------------------------------------------
  # * Set Item
  #     item : Skills and items etc.
  #--------------------------------------------------------------------------
  def set_item(item)
    set_image(item ? item.nal_image ? item.nal_image : nil : nil)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    bitmap = Cache.picture("#{@image}")
    rect = Rect.new(0,0,self.width+200,self.height)
    contents.blt(-110, -32, bitmap, rect)
    bitmap.dispose
  end
end

#==============================================================================
# ■ Window NAL Text
#==============================================================================

class Window_NAL_Text < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height)
    super(x, y, width, height)
    self.opacity = 0
    deactivate
    hide
    self.opacity = 255
    self.back_opacity = 255
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  def set_text(text)
    if text != @text
      @text = text
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Clear
  #--------------------------------------------------------------------------
  def clear
    set_text("")
  end
  #--------------------------------------------------------------------------
  # * Set Item
  #     item : Skills and items etc.
  #--------------------------------------------------------------------------
  def set_item(item)
    RPG::SE.new("Book2", 80, 0).play # Sound-Effekt beim Brief öffnen
    set_text(item ? R2_NAL::NAL_TEXT[item.id] ? R2_NAL::NAL_TEXT[item.id] : "" : "")
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    y = 0
    @text.each do |txt|
      draw_text_ex(4, y, txt)
      y += line_height
    end
    #draw_text(0, contents.height - 24, contents.width, 24, R2_NAL::RETURN_TEXT)
    draw_text_ex(0, contents.height - 24, R2_NAL::RETURN_TEXT)
  end
  #--------------------------------------------------------------------------
  # * Reset Font Settings
  #--------------------------------------------------------------------------
  def reset_font_settings
    change_color(normal_color)
    contents.font.name = R2_NAL::NAL_FONT
    contents.font.size = R2_NAL::NAL_FONT_SIZE
    contents.font.bold = R2_NAL::NAL_FONT_BOLD
    contents.font.italic = R2_NAL::NAL_FONT_ITALIC
  end
end

#==============================================================================
# ■ Scene NAL
#==============================================================================

class Scene_NAL < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    create_text_window
    create_title_window
    create_image_window
    create_list_window
  end
  #--------------------------------------------------------------------------
  # * Create Text Window
  #--------------------------------------------------------------------------
  def create_text_window
    ww = Graphics.width
    wh = Graphics.height
    @text_window = Window_NAL_Text.new(0, 0, ww, wh)
    @text_window.z = 200
  end
  #--------------------------------------------------------------------------
  # * Create Title Window
  #--------------------------------------------------------------------------
  def create_title_window
    @title_window = Window_NAL_Title.new
  end
  #--------------------------------------------------------------------------
  # * Create Image Window
  #--------------------------------------------------------------------------
  def create_image_window
    wx = 200
    wy = @title_window.height
    ww = Graphics.width - wx
    wh = Graphics.height - wy
    @image_window = Window_NAL_Image.new(wx, wy, ww, wh)
  end
  #--------------------------------------------------------------------------
  # * Create List Window
  #--------------------------------------------------------------------------
  def create_list_window
    wx = 0
    wy = @title_window.height
    ww = 200
    wh = Graphics.height - wy
    @list_window = Window_Note_List.new(wx, wy, ww, wh)
    @list_window.set_handler(:ok,     method(:on_item_ok))
    @list_window.set_handler(:cancel, method(:on_item_cancel))
    @list_window.activate
    @list_window.image_window = @image_window
  end
  #--------------------------------------------------------------------------
  # * Item [OK]
  #--------------------------------------------------------------------------
  def on_item_ok
    @list_window.deactivate
    @text_window.activate
    @text_window.show
    @text_window.set_item(@list_window.item)
  end
  #--------------------------------------------------------------------------
  # * Item [Cancel]
  #--------------------------------------------------------------------------
  def on_item_cancel
    return_scene
  end
  #--------------------------------------------------------------------------
  # * Text Cancel
  #--------------------------------------------------------------------------
  def on_text_cancel
    @text_window.deactivate
    @text_window.hide
    @list_window.activate
    Sound.play_cancel # Cancel-Soundeffekt beim Beenden
    return
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    on_text_cancel if Input.press?(:B) && @text_window.active
  end
end
Can I have the window in which the text of the letter is displayed semi-transparent, so that the window below hides when clicking the letter item and then then letter text is displayed, on a semi-transparent window and not opaque as it is now?
That's one line I added.
I made a mistake with the latest version as I notice the [] are not set like I had above that. Not sure what happened there.
So if you want the text window to be semi transparent then the windows below will be visible. and if you want the windows below to not be visible then that's why I set the opacity to full..
but ok...

Removed, script updated next page
I tried draw_text_ex for the TITLE as well btw. to display the amount of found letters as a variable. Tried the same as you but draw_text_ex(0,0, 24, R2_NAL::TITLE, 1) failed. What do I need to add here?

Original thread: https://forums.rpgmakerweb.com/threads/notes-and-letter-system.169333/