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.

really simple Quest Script

Hi, i really really need a quest script, really simple, it's like when ya talk to the quest "seller" it shows a list of quests available, and before he can play the 2nd he must complete the first and so on...

i know there are already scripts like that, but most use SDK, which i can't use cuz all my scripts are non SDK compatible:'( , or are incomplete.

Request done, Here is the Script, Credits goes to Leon For Helping me out...


Code:
#===================================
#  Leon's Mission Script v2.0
#----------------------------------------------------------------------
#  2006-09-22
#===================================
=begin
Description:
I did a drastic overhaul on this Mission/Quest script to make it much better and user friendly.

Features:
There is 2 new features:  
1.  If the user doesn't know of the mission, it doesn't appear in the list, nor does a slot for it.
2.  Completed missions are in green.
3.  Number of missions.  (X/Y)  X is completed missions, Y can be either known missions, 
     or your game's total missions.  Set Mission_Setup to 'true' if you want known missions,
     false for total.

Instructions:
Put it above main.

The instructions have changed alot more than the features.  Just go through
the short list below, and you'll know.  Just remember, go in order, and if you have 10
different missions in 1 spot, you must have the same number in each other segment
of the module, with the exception of the lines of text.  (Yes, i made that one all the easier.)

Changing the status of the missions is different than before as well.

$game_party.mission[mission_id] = x

Mission ID:  The ID of the mission, as defined in the module.  In this example, 
"Lost Cat" would be 0

X:
1 = they do not know the mission exists.  This is optional, unless they forget a mission.
2 = they know the mission, but it is incomplete
3 = the mission is complete.

Do NOT post my work in any other forums without my permission, and NEVER take credit
for my work. 
=end

#==================================
#  ** Mission_Menu
#==================================
module Mission_Menu
  #--------------------------------------------------------------------
  #  * Mission Name-  Write the mission number, and the name you want to appear.
  #  ~ mission_id => "mission name"
  #--------------------------------------------------------------------
  Mission_Name = {
  0 => "Lost Cat",
  1 => "Old Blade",
  2 => "Seize Sentries",
  3 => "Hidden Heirloom",
  4 => "A Gooey Mess.",
  5 => "Hidden Horror"
  }
  #--------------------------------------------------------------------
  #   * Mission_Sprite.  holds data on the name of the sprite, it's hue, name, locale, and 
  #   * reward all in one.
  #   ~ mission_id => ["sprite name", hue, name, location, Reward]
  #--------------------------------------------------------------------
  Mission_Sprite = {
  0 => ["113-Civilian13", 330, "Amy", "Logres", "Potion x 3"],
  1 => ["005-Fighter05", 0, "L'eric", "Logres", "Rusty Sword"],
  2 => ["002-Fighter02", 0, "Wallace", "Resistance H.Q.", "500 Gold"],
  3 => ["122-Civilian22", 30, "Old Woman", "Cyris Home", "Sound Effect"],
  4 => ["011-Lancer03", 0, "Soldier", "Cyris Barracks", "Kite Shield"],
  5 => ["006-Fighter06", 0, "Lady", "Cyris", "Lion's Head Earring"]
  }
  #--------------------------------------------------------------------
  #   * Defines the mission.  Remember, if it is too long for 1 line, you can drop it
  #   * down to line 2.
  #   ~ mission_id => "Line One"
  #--------------------------------------------------------------------
  Mission_L1 = {
  0 => "Amy has lost her cat and needs help",
  1 => "Somebody said they saw L'eric's blade",
  2 => "Head north toward enemy territory, and",
  3 => "Seek out the caverns south of Cyris.  There",
  4 => "A monster to the west of the town every",
  5 => "Somewhere in the Belin Caverns, there is a"
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Two"
  #--------------------------------------------------------------------
  Mission_L2 = {
  0 => "finding him.  He likes to play in the",
  1 => "just south of here by the river.  He ",
  2 => "capture two sentry towers.  Be careful ",
  3 => "you will find a blue chest.  Retrieve its",
  4 => "now and then terrorizes the caravans.",
  5 => "creature holding an item the lady in"
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Three"
  #--------------------------------------------------------------------
  Mission_L3 = {
  0 => " North East side of Tiberian Plains.",
  1 => "wants Will to confirm the story, and",
  2 => "and don't get caught.  Return to Wallace",
  3 => "contents and bring it back to the old",
  4 => "A soldier in the barracks has asked you",
  5 => "Cyris is looking for.  She said the monster"
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Four"
  #--------------------------------------------------------------------
  Mission_L4 = {
  1 => "if it is true, bring back the sword.",
  2 => "once this job is complete.",
  3 => "woman.",
  4 => "to exterminate it.",
  5 => "would be hiding."
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Five"
  #--------------------------------------------------------------------
  Mission_L5 = {
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Six"
  #--------------------------------------------------------------------
  Mission_L6 = {
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Seven"
  #--------------------------------------------------------------------
  Mission_L7 = {
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Eight"
  #--------------------------------------------------------------------
  Mission_L8 = {
  }
  #--------------------------------------------------------------------
  #   * Mission Set-up
  #--------------------------------------------------------------------
  Mission_Setup = true
end

#----------------------------------------------------------------------
#  * Game_Party
#----------------------------------------------------------------------
class Game_Party
  #--------------------------------------------------------------------
  #  * Attributes
  #--------------------------------------------------------------------
  attr_accessor    :mission
  #--------------------------------------------------------------------
  #  * Alias Listings
  #--------------------------------------------------------------------
  alias leon_gp_mission_initialize initialize
  #--------------------------------------------------------------------
  #  * Object initialization
  #--------------------------------------------------------------------
  #  Leon_Edit  add an array for each mission in @mission.
  #  [mission_id, 1]
  #--------------------------------------------------------------------
  def initialize
    leon_gp_mission_initialize
    @mission = {
    0 => 1,
    1 => 2,
    2 => 3,
    3 => 2
    }
  end
end
#--------------------------------------------------------------------
#  * Ends Game_Party
#--------------------------------------------------------------------

#----------------------------------------------------------------------
#  * Window_Missionhelp
#----------------------------------------------------------------------
class Window_Missionhelp < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize
    super(0, 0, 400, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------
  #  * Update
  #--------------------------------------------------------------------
  def update(help_text)
    self.contents.clear
    self.contents.draw_text(0, 0, 440, 32, help_text)
  end
  
end
#----------------------------------------------------------------------
#  * End Window_Missionhelp
#----------------------------------------------------------------------

#----------------------------------------------------------------------
#  Window_MissionNum
#----------------------------------------------------------------------
class Window_MissionNum < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize
    super(400, 0, 240, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh
    self.contents.clear
    mis = Mission_Menu
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 120, 32, "Missions:")
    self.contents.font.color = normal_color
    @mission_comp = []
    @mission_know = []
    #Calls Mission number of completed missions
    for i in 0...$game_party.mission.keys.size
      if $game_party.mission[$game_party.mission.keys[i]] == 3
        @mission_comp.push(i)
      end
    end
    #Calls Mission number of missions
    for j in 0...$game_party.mission.keys.size
      if $game_party.mission[$game_party.mission.keys[j]] > 1
        @mission_know.push(j)
      end
    end
    #if Mission_Setup is false...
    if mis::Mission_Setup == false
      if @mission_comp.size == $game_party.mission.size
        self.contents.font.color = Color.new(40, 250, 40, 255)
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + $game_party.mission.size.to_s, 2)
        self.contents.font.color = normal_color
      else
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + $game_party.mission.size.to_s, 2)
      end
      #if Mission_Setup is true...
    elsif mis::Mission_Setup == true
      if @mission_comp.size == @mission_know.size
        self.contents.font.color = Color.new(40, 250, 40, 255)
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + @mission_know.size.to_s, 2)
        self.contents.font.color = normal_color
      else
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + @mission_know.size.to_s, 2)
      end
    end
  end
end
#----------------------------------------------------------------------
#  * End Window_Missionnum
#----------------------------------------------------------------------


#----------------------------------------------------------------------
#  Window_Missionlist
#----------------------------------------------------------------------
class Window_Missionlist < Window_Selectable
  #--------------------------------------------------------------------
  #  * Attribute listings
  #--------------------------------------------------------------------
  attr_accessor    :mission
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize
    super(0, 60, 260, 420)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------
  #  * Mission
  #--------------------------------------------------------------------
  def mission
    return @data[self.index]
  end
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    mis = Mission_Menu
    @data = []
    for i in 0...$game_party.mission.keys.size
      if $game_party.mission[$game_party.mission.keys[i]] > 1
        @data.push($game_party.mission.keys[i])
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------
  #  * Draw_Item
  #--------------------------------------------------------------------
  def draw_item(index)
    mis = Mission_Menu
    mission_name = @data[index]
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    if $game_party.mission[mission_name] == 3
      self.contents.font.color = Color.new(40, 250, 40, 255)
      self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name])
    else
      self.contents.font.color = normal_color
      self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name])
    end
  end
  
end
#----------------------------------------------------------------------
#  * End Window_Missionlist
#----------------------------------------------------------------------

#----------------------------------------------------------------------
#  Window_Missioncomp
#----------------------------------------------------------------------
class  Window_Missioncomp < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize(mission)
    super(260, 365, 380, 115)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh(mission)
  end
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh(mission)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 52, 440, 32, "Status:")
    self.contents.draw_text(170, 52, 440, 32, "Reward:")
    self.contents.font.color = normal_color
    #person place status reward
    mis = Mission_Menu
    if mis::Mission_Sprite.has_key?(mission)
      if $game_party.mission[mission] > 1
        self.contents.draw_text(36, 6, 440, 32, 
        mis::Mission_Sprite[mission][2] + ", " + mis::Mission_Sprite[mission][3])
        case $game_party.mission[mission]
        when 1
          self.contents.draw_text(62, 52, 400, 32, "")
        when 2
          self.contents.draw_text(62, 52, 400, 32, "Incomplete")
          self.contents.draw_text(242, 52, 138, 32, "Unknown")
        when 3
          self.contents.font.color = Color.new(40, 250, 40, 255)
          self.contents.draw_text(62, 52, 400, 32, "Complete")
          self.contents.draw_text(242, 52, 138, 32, mis::Mission_Sprite[mission][4])
        end
        bitmap = RPG::Cache.character(mis::Mission_Sprite[mission][0], 
        mis::Mission_Sprite[mission][1])
        cw = bitmap.width / 4
        ch = bitmap.height / 4
        facing = 0
        src_rect = Rect.new(0, facing * ch, cw, ch)
        self.contents.blt(0, 0, bitmap, src_rect)
      end
    end
  end
  
  def clear
    self.contents.clear
  end
  
end
#--------------------------------------------------------------------
#  * Ends Window_Missioncomp
#--------------------------------------------------------------------

  
#----------------------------------------------------------------------
#  Window_Missiondesc
#----------------------------------------------------------------------
class Window_Missiondesc < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize(mission)
    super(260, 60, 380, 305)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh(mission)
    self.contents.clear
    mis = Mission_Menu
    self.contents.draw_text(0, 0, 348, 32, mis::Mission_L1[mission].to_s)
    self.contents.draw_text(0, 32, 348, 32, mis::Mission_L2[mission].to_s)
    self.contents.draw_text(0, 64, 348, 32, mis::Mission_L3[mission].to_s)
    self.contents.draw_text(0, 96, 348, 32, mis::Mission_L4[mission].to_s)
    self.contents.draw_text(0, 128, 348, 32, mis::Mission_L5[mission].to_s)
    self.contents.draw_text(0, 160, 348, 32, mis::Mission_L6[mission].to_s)
    self.contents.draw_text(0, 192, 348, 32, mis::Mission_L7[mission].to_s)
    self.contents.draw_text(0, 224, 348, 32, mis::Mission_L8[mission].to_s)
    end
end
#--------------------------------------------------------------------
#  * Ends Window_Missiondesc
#--------------------------------------------------------------------


#====================================
#  Scene_MissionMenu
#====================================
class Scene_MissionMenu
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------
  #  * Main
  #--------------------------------------------------------------------
  def main
    
    @missionhelp_window = Window_Missionhelp.new
    @missionlist_window = Window_Missionlist.new
    @missionnum_window = Window_MissionNum.new
    @missioncomp_window = Window_Missioncomp.new(@missionlist_window.mission)
    @missiondesc_window = Window_Missiondesc.new(@missionlist_window.mission)
    @mission = @missionlist_window.mission
    
    @missiondesc_window.refresh(@missionlist_window.mission)
    @missioncomp_window.refresh(@missionlist_window.mission)
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @missionhelp_window.dispose
    @missiondesc_window.dispose
    @missioncomp_window.dispose
    @missionlist_window.dispose
    @missionnum_window.dispose
  end
  #--------------------------------------------------------------------
  #  * Update
  #--------------------------------------------------------------------
  def update
    mis = Mission_Menu
    @missionlist_window.update
    @missionnum_window.update
    @missionhelp_window.update("Select a mission to see details.")
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or Input.repeat?(Input::DOWN) or Input.repeat?(Input::UP)
    @missiondesc_window.refresh(@missionlist_window.mission)
    @missioncomp_window.refresh(@missionlist_window.mission)
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
  end
    
end
#--------------------------------------------------------------------
#  * Ends Scene_Missionmenu
#--------------------------------------------------------------------

Compatibility:
well not sure but it's not for SDK for sure
 
yeah i've tried that script before but doesn't work, and i don't need the skills stuff (combat skills, gathering skills, negotiation skills) the quest requirement is to finish the one before it only. (like the shop begins with 5 quest and each quest branches to other quests till it finishes all five series and then other quest series is available and so on)

Forgot to add something... Quests cannot be failed they just remain unaccomplished till the player decides to finish them...
 

Leon

Member

Here, try this. It is a script I wrote back in September of 2006. It works, and I hope it is what you are looking for:

[REMOVED. SCROLL TO NEXT POST TO GET CODE]
 
That script doesn't work well when you scroll between the quests they sometimes show other quests or keep showing the first one and i don't know why the first one on your script is zero i can't make a quest there
 

Leon

Member

I apologize, that was the older version, here is the newer one (old one deleted.) It runs mostly the same way, but changed the command. Read the heading of the script to know how to use it:

[REMOVED, CHECK LAST POST]
 
sry if i kinda get annoying but i'm not good at all in scripting, can ya give an example of how i make a quest completed... and how to add quests, i read the instruction but got a little confused,

i know i need to call the script but still kinda confused on what is the usage of the arrey [x,y] for,

and i get an error when pressing escape, tried it on a new project and same problem:

"Script 'mission' line 486: name error occured
uninitialized constant Scene_MissionMenu::Scene_Menu2"

anyways THX for the help
 

Leon

Member

Hey, apparently, this isn't the latest version either. Give me approx. 2 hours after this post, at the max, to get the script fixed. I wrote this about 8-9 months ago, and know more now than I did then. I apologize for the bad script, and will have the problem rectified ASAP.
 
ok i've tried it out and it's a lot more easier, only one question if i call a script and right
$game_party.mission[0] = 0

the first mission shouldn't be visible (at least i think so) but the mission name is visible, the only thing that disappear are the location, reward and the spirte graphic and name, am i doing something wrong?
 

Leon

Member

No, to make it disappear, you use $game_party.mission[0] = 1.
I only made it far easier to use. The one bug I didn't fix is making the nubmers 0, 1, 2 instead of 1, 2, 3
 
It's the same leon i used that piece of script and the quest description and name still shows the only thing tht doesn't show is the sprite of the character,the reward and the location

try it on a new project to see
 

Leon

Member

All right, I forgot 1 line of coding, and i seriously apologize. I have had too much on my mind lately. I have it completed... again... here. Thank you for finding that bug, and I apologize for the many different problems. here is your script... again, but fixed:

Code:
#===================================
#  Leon's Mission Script v2.0
#----------------------------------------------------------------------
#  2006-09-22
#===================================
=begin
Description:
I did a drastic overhaul on this Mission/Quest script to make it much better and user friendly.

Features:
There is 2 new features:  
1.  If the user doesn't know of the mission, it doesn't appear in the list, nor does a slot for it.
2.  Completed missions are in green.
3.  Number of missions.  (X/Y)  X is completed missions, Y can be either known missions, 
     or your game's total missions.  Set Mission_Setup to 'true' if you want known missions,
     false for total.

Instructions:
Put it above main.

The instructions have changed alot more than the features.  Just go through
the short list below, and you'll know.  Just remember, go in order, and if you have 10
different missions in 1 spot, you must have the same number in each other segment
of the module, with the exception of the lines of text.  (Yes, i made that one all the easier.)

Changing the status of the missions is different than before as well.

$game_party.mission[mission_id] = x

Mission ID:  The ID of the mission, as defined in the module.  In this example, 
"Lost Cat" would be 0

X:
1 = they do not know the mission exists.  This is optional, unless they forget a mission.
2 = they know the mission, but it is incomplete
3 = the mission is complete.

Do NOT post my work in any other forums without my permission, and NEVER take credit
for my work. 
=end

#==================================
#  ** Mission_Menu
#==================================
module Mission_Menu
  #--------------------------------------------------------------------
  #  * Mission Name-  Write the mission number, and the name you want to appear.
  #  ~ mission_id => "mission name"
  #--------------------------------------------------------------------
  Mission_Name = {
  0 => "Lost Cat",
  1 => "Old Blade",
  2 => "Seize Sentries",
  3 => "Hidden Heirloom",
  4 => "A Gooey Mess.",
  5 => "Hidden Horror"
  }
  #--------------------------------------------------------------------
  #   * Mission_Sprite.  holds data on the name of the sprite, it's hue, name, locale, and 
  #   * reward all in one.
  #   ~ mission_id => ["sprite name", hue, name, location, Reward]
  #--------------------------------------------------------------------
  Mission_Sprite = {
  0 => ["113-Civilian13", 330, "Amy", "Logres", "Potion x 3"],
  1 => ["005-Fighter05", 0, "L'eric", "Logres", "Rusty Sword"],
  2 => ["002-Fighter02", 0, "Wallace", "Resistance H.Q.", "500 Gold"],
  3 => ["122-Civilian22", 30, "Old Woman", "Cyris Home", "Sound Effect"],
  4 => ["011-Lancer03", 0, "Soldier", "Cyris Barracks", "Kite Shield"],
  5 => ["006-Fighter06", 0, "Lady", "Cyris", "Lion's Head Earring"]
  }
  #--------------------------------------------------------------------
  #   * Defines the mission.  Remember, if it is too long for 1 line, you can drop it
  #   * down to line 2.
  #   ~ mission_id => "Line One"
  #--------------------------------------------------------------------
  Mission_L1 = {
  0 => "Amy has lost her cat and needs help",
  1 => "Somebody said they saw L'eric's blade",
  2 => "Head north toward enemy territory, and",
  3 => "Seek out the caverns south of Cyris.  There",
  4 => "A monster to the west of the town every",
  5 => "Somewhere in the Belin Caverns, there is a"
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Two"
  #--------------------------------------------------------------------
  Mission_L2 = {
  0 => "finding him.  He likes to play in the",
  1 => "just south of here by the river.  He ",
  2 => "capture two sentry towers.  Be careful ",
  3 => "you will find a blue chest.  Retrieve its",
  4 => "now and then terrorizes the caravans.",
  5 => "creature holding an item the lady in"
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Three"
  #--------------------------------------------------------------------
  Mission_L3 = {
  0 => " North East side of Tiberian Plains.",
  1 => "wants Will to confirm the story, and",
  2 => "and don't get caught.  Return to Wallace",
  3 => "contents and bring it back to the old",
  4 => "A soldier in the barracks has asked you",
  5 => "Cyris is looking for.  She said the monster"
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Four"
  #--------------------------------------------------------------------
  Mission_L4 = {
  1 => "if it is true, bring back the sword.",
  2 => "once this job is complete.",
  3 => "woman.",
  4 => "to exterminate it.",
  5 => "would be hiding."
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Five"
  #--------------------------------------------------------------------
  Mission_L5 = {
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Six"
  #--------------------------------------------------------------------
  Mission_L6 = {
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Seven"
  #--------------------------------------------------------------------
  Mission_L7 = {
  }
  #--------------------------------------------------------------------
  #   * Same as the above one.
  #   ~ mission_id => "Line Eight"
  #--------------------------------------------------------------------
  Mission_L8 = {
  }
  #--------------------------------------------------------------------
  #   * Mission Set-up
  #--------------------------------------------------------------------
  Mission_Setup = true
end

#----------------------------------------------------------------------
#  * Game_Party
#----------------------------------------------------------------------
class Game_Party
  #--------------------------------------------------------------------
  #  * Attributes
  #--------------------------------------------------------------------
  attr_accessor    :mission
  #--------------------------------------------------------------------
  #  * Alias Listings
  #--------------------------------------------------------------------
  alias leon_gp_mission_initialize initialize
  #--------------------------------------------------------------------
  #  * Object initialization
  #--------------------------------------------------------------------
  #  Leon_Edit  add an array for each mission in @mission.
  #  [mission_id, 1]
  #--------------------------------------------------------------------
  def initialize
    leon_gp_mission_initialize
    @mission = {
    0 => 1,
    1 => 2,
    2 => 3,
    3 => 2
    }
  end
end
#--------------------------------------------------------------------
#  * Ends Game_Party
#--------------------------------------------------------------------

#----------------------------------------------------------------------
#  * Window_Missionhelp
#----------------------------------------------------------------------
class Window_Missionhelp < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize
    super(0, 0, 400, 60)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------
  #  * Update
  #--------------------------------------------------------------------
  def update(help_text)
    self.contents.clear
    self.contents.draw_text(0, 0, 440, 32, help_text)
  end
  
end
#----------------------------------------------------------------------
#  * End Window_Missionhelp
#----------------------------------------------------------------------

#----------------------------------------------------------------------
#  Window_MissionNum
#----------------------------------------------------------------------
class Window_MissionNum < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize
    super(400, 0, 240, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh
    self.contents.clear
    mis = Mission_Menu
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, 120, 32, "Missions:")
    self.contents.font.color = normal_color
    @mission_comp = []
    @mission_know = []
    #Calls Mission number of completed missions
    for i in 0...$game_party.mission.keys.size
      if $game_party.mission[$game_party.mission.keys[i]] == 3
        @mission_comp.push(i)
      end
    end
    #Calls Mission number of missions
    for j in 0...$game_party.mission.keys.size
      if $game_party.mission[$game_party.mission.keys[j]] > 1
        @mission_know.push(j)
      end
    end
    #if Mission_Setup is false...
    if mis::Mission_Setup == false
      if @mission_comp.size == $game_party.mission.size
        self.contents.font.color = Color.new(40, 250, 40, 255)
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + $game_party.mission.size.to_s, 2)
        self.contents.font.color = normal_color
      else
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + $game_party.mission.size.to_s, 2)
      end
      #if Mission_Setup is true...
    elsif mis::Mission_Setup == true
      if @mission_comp.size == @mission_know.size
        self.contents.font.color = Color.new(40, 250, 40, 255)
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + @mission_know.size.to_s, 2)
        self.contents.font.color = normal_color
      else
        self.contents.draw_text(0, 0, 208, 32, @mission_comp.size.to_s + 
        "/" + @mission_know.size.to_s, 2)
      end
    end
  end
end
#----------------------------------------------------------------------
#  * End Window_Missionnum
#----------------------------------------------------------------------


#----------------------------------------------------------------------
#  Window_Missionlist
#----------------------------------------------------------------------
class Window_Missionlist < Window_Selectable
  #--------------------------------------------------------------------
  #  * Attribute listings
  #--------------------------------------------------------------------
  attr_accessor    :mission
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize
    super(0, 60, 260, 420)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.index = 0
    refresh
  end
  #--------------------------------------------------------------------
  #  * Mission
  #--------------------------------------------------------------------
  def mission
    return @data[self.index]
  end
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh
    if self.contents != nil
      self.contents.dispose
      self.contents = nil
    end
    mis = Mission_Menu
    @data = []
    for i in 0...$game_party.mission.keys.size
      if $game_party.mission[$game_party.mission.keys[i]] > 1
        @data.push($game_party.mission.keys[i])
      end
    end
    @item_max = @data.size
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 32)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------
  #  * Draw_Item
  #--------------------------------------------------------------------
  def draw_item(index)
    mis = Mission_Menu
    mission_name = @data[index]
    x = 4
    y = index * 32
    rect = Rect.new(x, y, self.width - 32, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    if $game_party.mission[mission_name] == 3
      self.contents.font.color = Color.new(40, 250, 40, 255)
      self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name])
    else
      self.contents.font.color = normal_color
      self.contents.draw_text(x, y, 228, 32, mis::Mission_Name[mission_name])
    end
  end
  
end
#----------------------------------------------------------------------
#  * End Window_Missionlist
#----------------------------------------------------------------------

#----------------------------------------------------------------------
#  Window_Missioncomp
#----------------------------------------------------------------------
class  Window_Missioncomp < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize(mission)
    super(260, 365, 380, 115)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh(mission)
  end
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh(mission)
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 52, 440, 32, "Status:")
    self.contents.draw_text(170, 52, 440, 32, "Reward:")
    self.contents.font.color = normal_color
    #person place status reward
    mis = Mission_Menu
    if mis::Mission_Sprite.has_key?(mission)
      if $game_party.mission[mission] > 1
        self.contents.draw_text(36, 6, 440, 32, 
        mis::Mission_Sprite[mission][2] + ", " + mis::Mission_Sprite[mission][3])
        case $game_party.mission[mission]
        when 1
          self.contents.draw_text(62, 52, 400, 32, "")
        when 2
          self.contents.draw_text(62, 52, 400, 32, "Incomplete")
          self.contents.draw_text(242, 52, 138, 32, "Unknown")
        when 3
          self.contents.font.color = Color.new(40, 250, 40, 255)
          self.contents.draw_text(62, 52, 400, 32, "Complete")
          self.contents.draw_text(242, 52, 138, 32, mis::Mission_Sprite[mission][4])
        end
        bitmap = RPG::Cache.character(mis::Mission_Sprite[mission][0], 
        mis::Mission_Sprite[mission][1])
        cw = bitmap.width / 4
        ch = bitmap.height / 4
        facing = 0
        src_rect = Rect.new(0, facing * ch, cw, ch)
        self.contents.blt(0, 0, bitmap, src_rect)
      end
    end
  end
  
  def clear
    self.contents.clear
  end
  
end
#--------------------------------------------------------------------
#  * Ends Window_Missioncomp
#--------------------------------------------------------------------

  
#----------------------------------------------------------------------
#  Window_Missiondesc
#----------------------------------------------------------------------
class Window_Missiondesc < Window_Base
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize(mission)
    super(260, 60, 380, 305)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------
  #  * Refresh
  #--------------------------------------------------------------------
  def refresh(mission)
    self.contents.clear
    mis = Mission_Menu
    self.contents.draw_text(0, 0, 348, 32, mis::Mission_L1[mission].to_s)
    self.contents.draw_text(0, 32, 348, 32, mis::Mission_L2[mission].to_s)
    self.contents.draw_text(0, 64, 348, 32, mis::Mission_L3[mission].to_s)
    self.contents.draw_text(0, 96, 348, 32, mis::Mission_L4[mission].to_s)
    self.contents.draw_text(0, 128, 348, 32, mis::Mission_L5[mission].to_s)
    self.contents.draw_text(0, 160, 348, 32, mis::Mission_L6[mission].to_s)
    self.contents.draw_text(0, 192, 348, 32, mis::Mission_L7[mission].to_s)
    self.contents.draw_text(0, 224, 348, 32, mis::Mission_L8[mission].to_s)
    end
end
#--------------------------------------------------------------------
#  * Ends Window_Missiondesc
#--------------------------------------------------------------------


#====================================
#  Scene_MissionMenu
#====================================
class Scene_MissionMenu
  #--------------------------------------------------------------------
  #  * Object Initialization
  #--------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------
  #  * Main
  #--------------------------------------------------------------------
  def main
    
    @missionhelp_window = Window_Missionhelp.new
    @missionlist_window = Window_Missionlist.new
    @missionnum_window = Window_MissionNum.new
    @missioncomp_window = Window_Missioncomp.new(@missionlist_window.mission)
    @missiondesc_window = Window_Missiondesc.new(@missionlist_window.mission)
    @mission = @missionlist_window.mission
    
    @missiondesc_window.refresh(@missionlist_window.mission)
    @missioncomp_window.refresh(@missionlist_window.mission)
    
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @missionhelp_window.dispose
    @missiondesc_window.dispose
    @missioncomp_window.dispose
    @missionlist_window.dispose
    @missionnum_window.dispose
  end
  #--------------------------------------------------------------------
  #  * Update
  #--------------------------------------------------------------------
  def update
    mis = Mission_Menu
    @missionlist_window.update
    @missionnum_window.update
    @missionhelp_window.update("Select a mission to see details.")
    if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or Input.repeat?(Input::DOWN) or Input.repeat?(Input::UP)
    @missiondesc_window.refresh(@missionlist_window.mission)
    @missioncomp_window.refresh(@missionlist_window.mission)
    end
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
    end
  end
    
end
#--------------------------------------------------------------------
#  * Ends Scene_Missionmenu
#--------------------------------------------------------------------[/spoiler]
 
Ok this works perfectly, now only one last answer, is there a simple way to let all missions by default not visible... either by event or script and thx alot this script is great...

EDIT: I figured it out :P sry I'm Lazy, everything ok now... hey want me to post the script in the first post?
 

Leon

Member

It should be by default to begin with. If it doesn't exist in the script where it says:
@mission = {

}
Then it shouldn't exist in the game until you use:
$game_party.mission 
 

Leon

Member

sorry, but I did this request becuase I had the script already built. I have been busy with a project that is consuming my life a little. If I get the chance, I might. Right now, I am just too busy. 1 man, 20+ hour game... bad combo.
 

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