I want a single objective to be shown in game. It should be permanently visible when quests are turned on (by switch or variable). I need to change a variable to edit the text when the quest is solved to proceed to the next quest. Can someone help me with this?
Show single objective in game
RGSS3 Script RequestsI'm assuming you're looking for something like, "Find your allies: 1 / 3", correct? How are you drawing the objective message in the upper left? Is it via the Map Name setting in your map's properties, is it a script, or are you using images?
If you're using the built-in Map Name setting, I have no idea how to change that, but if it's a custom script, then it should be as simple as using \v[x], where x is the number of the variable showing the quest's progress. So for example, let's say Variable 1 is 'AllyFound' and you need to find three allies. The quest marker would be written as, "Find your allies: \v[1] / 3", and then each time you find an ally, increase \v[1] by 1.
If it's images, you would make whatever progress images you need, place them in the game's Pictures folder, and set up a parallel processing event, to turn on whenever the related quest switch is activated, I believe like so:
Etc. for however many allies you need to find. I'm currently unable to check to see if this is entirely accurate, but I'm 90% certain it should be formatted like that.
If you're using the built-in Map Name setting, I have no idea how to change that, but if it's a custom script, then it should be as simple as using \v[x], where x is the number of the variable showing the quest's progress. So for example, let's say Variable 1 is 'AllyFound' and you need to find three allies. The quest marker would be written as, "Find your allies: \v[1] / 3", and then each time you find an ally, increase \v[1] by 1.
If it's images, you would make whatever progress images you need, place them in the game's Pictures folder, and set up a parallel processing event, to turn on whenever the related quest switch is activated, I believe like so:
Code:
Conditional Branch: If Variable 1 == 0:
Show Picture: 'Allies0'
Wait: 7 frames
Else
Conditional Branch: If Variable 1 == 1:
Show Picture: 'Allies1'
Wait: 7 frames
Else
...
Etc. for however many allies you need to find. I'm currently unable to check to see if this is entirely accurate, but I'm 90% certain it should be formatted like that.
@LucaBicono this Screenshot is just an example. I renamed the map name to show how it should look like. The quest display should look like the map name display with its black dim color background. I want it to be simple and fit the rest. I want to change the displayed quest objective via variable. In my game, as linear storyline, you will be jumped from quest to quest, so what I want to display is only one quest at a given time: a simple string combined with maybe the ability to show variable info and icons.
Ah, I think I see now, sorry for the confusion!
I'm unaware of any scripts that would help with that, but you could use images as I suggested in my previous reply. What I would do is set up a Common Event, set to Parallel Processing, and have it so that it runs so long as a switch is set to on. That way, if you want to remove the images during a cutscene for example, it would just be a matter of turning off the switch and then erasing the image.
The only problem I can see arising would be if you have any optional quests in your game. If it's all just story quests one after another, it should just be as simple as showing an image as it corresponds with the quest variable number. So for example:
And then, once the player finishes a story quest, add 1 to the variable to display the next quest.
However, if you're including optional quests, then I would suggest making a spreadsheet to help keep things organized. Let's say your game has 100 story quests and 10 optional quests. Dedicate numbers 1-100 of Variable 1 in your CE to story quests, and then numbers 101-110 of the variable to optional quests. From there, set up a 'backup variable', let's say Variable 2, which stores the story quest number before the player begins an optional quest, and then once the optional quest is completed, set Variable 1 back to Variable 2.
I hope this helps, sorry if I'm still not quite understanding what you mean.
I'm unaware of any scripts that would help with that, but you could use images as I suggested in my previous reply. What I would do is set up a Common Event, set to Parallel Processing, and have it so that it runs so long as a switch is set to on. That way, if you want to remove the images during a cutscene for example, it would just be a matter of turning off the switch and then erasing the image.
The only problem I can see arising would be if you have any optional quests in your game. If it's all just story quests one after another, it should just be as simple as showing an image as it corresponds with the quest variable number. So for example:
Code:
Conditional Branch: If Variable 1 == 1:
Show Picture: 'Quest1'
Wait: 7 frames
End
Conditional Branch: If Variable 1 == 2:
Show Picture: 'Quest2'
Wait: 7 frames
End
...
And then, once the player finishes a story quest, add 1 to the variable to display the next quest.
However, if you're including optional quests, then I would suggest making a spreadsheet to help keep things organized. Let's say your game has 100 story quests and 10 optional quests. Dedicate numbers 1-100 of Variable 1 in your CE to story quests, and then numbers 101-110 of the variable to optional quests. From there, set up a 'backup variable', let's say Variable 2, which stores the story quest number before the player begins an optional quest, and then once the optional quest is completed, set Variable 1 back to Variable 2.
I hope this helps, sorry if I'm still not quite understanding what you mean.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Map Objectives ║ Version: 1.00 ║
# ║ Author: Roninator2 ║ ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ ╠════════════════════╣
# ║ Display Objectives on map ║ 20 May 2023 ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions: ║
# ║ This script will show a window similar to the map ║
# ║ name window in which it will display the contents ║
# ║ of the variable specificed below as the 'objective' ║
# ║ to be completed in the game. ║
# ║ ║
# ║ Turn off with a switch ║
# ║ ║
# ║ Change the variable data with a script command ║
# ║ ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 2023-apr-28 - Initial publish ║
# ║ ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Free for all uses in RPG Maker VX Ace - except nudity ║
# ╚══════════════════════════════════════════════════════════╝
module R2_Map_Objective_Display
Switch = 5
Variable = 5
end
#==============================================================================
# ** Window_MapObjective
#==============================================================================
class Window_MapObjective < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(Graphics.width - window_width - 20, 0, window_width, fitting_height(1))
self.opacity = 0
self.contents_opacity = 0
@show_count = 0
@show_objective = false
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 240
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @show_count > 0 && @show_objective == true
update_fadein
@show_count -= 1
elsif @show_count <= 0 && @show_objective == false
update_fadeout
elsif @show_count > 0
@show_count -= 1
end
end
#--------------------------------------------------------------------------
# * Update Fadein
#--------------------------------------------------------------------------
def update_fadein
self.contents_opacity += 16
end
#--------------------------------------------------------------------------
# * Update Fadeout
#--------------------------------------------------------------------------
def update_fadeout
self.contents_opacity -= 16
end
#--------------------------------------------------------------------------
# * Open Window
#--------------------------------------------------------------------------
def open
return if @show_objective == true
@show_objective = true
refresh
@show_count = 150
self.contents_opacity = 0
self
end
#--------------------------------------------------------------------------
# * Close Window
#--------------------------------------------------------------------------
def close
return if @show_objective == false
@show_objective = false
@show_count = 0
self
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_background(contents.rect)
draw_text(contents.rect, $game_variables[R2_Map_Objective_Display::Variable], 1)
end
#--------------------------------------------------------------------------
# * Draw Background
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# * Get Background Color 1
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 192)
end
#--------------------------------------------------------------------------
# * Get Background Color 2
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 0)
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias r2_update_map_objective update
def update
r2_update_map_objective
@map_objective_window.open if $game_switches[R2_Map_Objective_Display::Switch] == true
@map_objective_window.close if $game_switches[R2_Map_Objective_Display::Switch] == false
end
#--------------------------------------------------------------------------
# * Create All Windows
#--------------------------------------------------------------------------
alias r2_create_all_window_objectives create_all_windows
def create_all_windows
r2_create_all_window_objectives
create_objective_window
end
#--------------------------------------------------------------------------
# * Create Map Name Window
#--------------------------------------------------------------------------
def create_objective_window
@map_objective_window = Window_MapObjective.new
end
end
I prefer my solution because it does not need to keep updating the window by hand after checking the switch over and over again. The way I achieved this goal was to let you manually call the script when needed and that's it!
Ruby:
# * OUTDATED CODE * #
# Scripter : Kyonides Arkanthes
# 2023-05-20
# This scriptlet lets you show the Current Quest Title on the map using a
# given Game Variable. The state of a certain Game Switch determines
# whether or not the window will be visible on screen.
# * Script Calls * #
# - Set New Title
# new_quest_title("Quest Name")
# - Repeat the Most Recent Title
# repeat_quest_title!
module SingleQuest
HIDE_WHEN_ZERO = true
SWITCH_ID = 1
VAR_ID = 1
WINDOW_X = 0
WINDOW_Y = 0
WINDOW_WIDTH = 240
WINDOW_HEIGHT = 56
class TitleWindow < Window_Base
include SingleQuest
def initialize
super(WINDOW_X, WINDOW_Y, Graphics.width - WINDOW_WIDTH, WINDOW_HEIGHT)
self.opacity = 0
self.contents_opacity = 0
@back_color1 = Color.new(0, 0, 0, 192)
@back_color2 = Color.new(0, 0, 0, 0)
@show_count = 0
refresh
end
def refresh
contents.clear
return if $game_variables[VAR_ID].empty?
rect = contents.rect
draw_background(rect)
draw_text(rect, $game_variables[VAR_ID])
end
def draw_background(rect)
temp_rect = rect.dup
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, @back_color2, @back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, @back_color1, @back_color2)
end
def update_fadein
self.contents_opacity += 16
end
def update_fadeout
self.contents_opacity -= 16
end
def update
super
self.visible = $game_switches[SWITCH_ID]
if self.visible && @show_count > 0
update_fadein
@show_count -= 1
elsif HIDE_WHEN_ZERO
update_fadeout
end
end
def open
refresh
@show_count = HIDE_WHEN_ZERO ? 150 : 0
self.contents_opacity = 0
self
end
def close
@show_count = 0
self
end
end
end
module SceneManager
extend self
attr_accessor :quest_window
end
class Game_Interpreter
def new_quest_title(title)
$game_variables[SingleQuest::VAR_ID] = title
repeat_quest_title!
end
def repeat_quest_title!
SceneManager.quest_window.open
end
end
class Scene_Map
alias :kyon_single_quest_scn_map_create_all_win :create_all_windows
def create_all_windows
$game_variables[SingleQuest::VAR_ID] = ""
kyon_single_quest_scn_map_create_all_win
make_single_quest_window
end
def make_single_quest_window
@quest_window = SingleQuest::TitleWindow.new
SceneManager.quest_window = @quest_window
end
attr_reader :quest_window
end
Thank you, you're the best. Let's combine those and we have it! 
@Roninator2 your script is like what I need, as it is on the right side of the screen, but it shrinks text automatically if I type in a bit longer sentence.
@kyonides your script would be the perfect fit, I love to do it via scriptcall, but the objective fades away quickly which should not be the case. It should be a static display.
Both scripts seem not to update dynamically. I first have to leave the scene, like go to Scene_menu until the variable text gets updated on screen. Can we make this instant change?

@Roninator2 your script is like what I need, as it is on the right side of the screen, but it shrinks text automatically if I type in a bit longer sentence.
@kyonides your script would be the perfect fit, I love to do it via scriptcall, but the objective fades away quickly which should not be the case. It should be a static display.
Both scripts seem not to update dynamically. I first have to leave the scene, like go to Scene_menu until the variable text gets updated on screen. Can we make this instant change?
There's the HIDE_WHEN_ZERO constant to make it fade out IF it's true. Replace it's value with false or nil and it will remain on screen.
I tried that, but when I set it to nil or false, the display won't show up at all.
Don't worry, I got a fix here.
Ruby:
# * Single Quest Title ACE * #
# Scripter : Kyonides Arkanthes
# 2023-05-21
# This scriptlet lets you show the Current Quest Title on the map using a
# given Game Variable. The state of a certain Game Switch determines
# whether or not the window will be visible on screen.
# * Script Calls * #
# - Set New Title
# new_quest_title("Quest Name")
# - Repeat the Most Recent Title
# repeat_quest_title!
module SingleQuest
HIDE_WHEN_ZERO = nil
SWITCH_ID = 1
VAR_ID = 1
WINDOW_X = 0
WINDOW_Y = 0
WINDOW_WIDTH = 240
WINDOW_HEIGHT = 56
class TitleWindow < Window_Base
include SingleQuest
def initialize
super(WINDOW_X, WINDOW_Y, window_width, WINDOW_HEIGHT)
$game_variables[VAR_ID] = "" if $game_variables[VAR_ID] == 0
self.opacity = 0
self.contents_opacity = 0
@back_color1 = Color.new(0, 0, 0, 192)
@back_color2 = Color.new(0, 0, 0, 0)
@show_count = 0
refresh
end
def window_width
Graphics.width - WINDOW_WIDTH
end
def refresh
contents.clear
return if $game_variables[VAR_ID].empty?
rect = contents.rect
draw_background(rect)
draw_text(rect, $game_variables[VAR_ID])
end
def draw_background(rect)
temp_rect = rect.dup
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, @back_color2, @back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, @back_color1, @back_color2)
end
def update_fadein
self.contents_opacity += 16
end
def update_fadeout
self.contents_opacity -= 16
end
def update
super
self.visible = $game_switches[SWITCH_ID]
if self.visible && @show_count > 0
update_fadein
@show_count -= 1
elsif HIDE_WHEN_ZERO
update_fadeout
end
end
def open
refresh
@show_count = 150
self.contents_opacity = 0
self
end
def close
@show_count = 0
self
end
end
end
module SceneManager
extend self
attr_accessor :quest_window
end
class Game_Interpreter
def new_quest_title(title)
$game_variables[SingleQuest::VAR_ID] = title
repeat_quest_title!
end
def repeat_quest_title!
SceneManager.quest_window.open
end
end
class Scene_Map
alias :kyon_single_quest_scn_map_create_all_win :create_all_windows
def create_all_windows
kyon_single_quest_scn_map_create_all_win
make_single_quest_window
end
def make_single_quest_window
@quest_window = SingleQuest::TitleWindow.new
SceneManager.quest_window = @quest_window
@quest_window.open
end
attr_reader :quest_window
end
I think I fixed your concerns.
Ruby:
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Map Objectives ║ Version: 1.01 ║
# ║ Author: Roninator2 ║ ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ ╠════════════════════╣
# ║ Display Objectives on map ║ 20 May 2023 ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Instructions: ║
# ║ This script will show a window similar to the map ║
# ║ name window in which it will display the contents ║
# ║ of the variable specificed below as the 'objective' ║
# ║ to be completed in the game. ║
# ║ ║
# ║ Change the variable data with a script command ║
# ║ Use script commands to open and close window ║
# ║ open_objective_display ║
# ║ close_objective_display ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 2023-Apr-28 - Initial publish ║
# ║ 2023-May-21 - Updated to reflect when variable changes ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Free for all uses in RPG Maker VX Ace - except nudity ║
# ╚══════════════════════════════════════════════════════════╝
module R2_Map_Objective_Display
Variable = 5
end
#==============================================================================
# ** Window_MapObjective
#==============================================================================
class Window_MapObjective < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@width = 240
super(Graphics.width - window_width - 20, 0, window_width, fitting_height(1))
self.opacity = 0
self.contents_opacity = 0
@show_count = 0
@show_objective = false
@current_objective = nil
refresh
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return @width
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @show_count > 0 && @show_objective == true
update_fadein
@show_count -= 1
elsif @show_count <= 0 && @show_objective == false
update_fadeout
elsif @show_count > 0
@show_count -= 1
end
refresh if @current_objective != $game_variables[R2_Map_Objective_Display::Variable]
end
#--------------------------------------------------------------------------
# * Update Fadein
#--------------------------------------------------------------------------
def update_fadein
self.contents_opacity += 16
end
#--------------------------------------------------------------------------
# * Update Fadeout
#--------------------------------------------------------------------------
def update_fadeout
self.contents_opacity -= 16
end
#--------------------------------------------------------------------------
# * Open Window
#--------------------------------------------------------------------------
def open
return if @show_objective == true
@show_objective = true
refresh
@show_count = 150
self.contents_opacity = 0
self
end
#--------------------------------------------------------------------------
# * Close Window
#--------------------------------------------------------------------------
def close
return if @show_objective == false
@show_objective = false
@show_count = 0
self
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
text = $game_variables[R2_Map_Objective_Display::Variable].to_s
check_width(text)
create_contents
draw_background(contents.rect)
draw_text(contents.rect, text, 1)
@current_objective = $game_variables[R2_Map_Objective_Display::Variable]
end
#--------------------------------------------------------------------------
# * Draw Background
#--------------------------------------------------------------------------
def check_width(text)
length = text.size
@width = length * (Font.default_size / 2) + 20
self.width = @width
self.x = Graphics.width - @width
end
#--------------------------------------------------------------------------
# * Draw Background
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
temp_rect.width /= 2
contents.gradient_fill_rect(temp_rect, back_color2, back_color1)
temp_rect.x = temp_rect.width
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# * Get Background Color 1
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 192)
end
#--------------------------------------------------------------------------
# * Get Background Color 2
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 0)
end
end
#==============================================================================
# ** Game Interpreter
#==============================================================================
class Game_Interpreter
def open_objective_display
if SceneManager.scene_is?(Scene_Map)
SceneManager.scene.open_display_objective
end
end
def close_objective_display
if SceneManager.scene_is?(Scene_Map)
SceneManager.scene.close_display_objective
end
end
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# * Open Objective
#--------------------------------------------------------------------------
def open_display_objective
@map_objective_window.open
end
#--------------------------------------------------------------------------
# * Close Objective
#--------------------------------------------------------------------------
def close_display_objective
@map_objective_window.close
end
#--------------------------------------------------------------------------
# * Create All Windows
#--------------------------------------------------------------------------
alias r2_create_all_window_objectives create_all_windows
def create_all_windows
r2_create_all_window_objectives
create_objective_window
end
#--------------------------------------------------------------------------
# * Create Map Name Window
#--------------------------------------------------------------------------
def create_objective_window
@map_objective_window = Window_MapObjective.new
end
end
Original thread: https://forums.rpgmakerweb.com/threads/show-single-objective-in-game.157675/