My First RGSS2 Script: Quest Board

● ARCHIVED · READ-ONLY
Started by Drakath 5 posts View original ↗
  1. Introduction

    While I was working on my first project I wanted to make my own Quest System. So I started off with adding a Quest Board first. Instead of making some message windows I wanted to script my own thing. I started to watch GubiD's tutorials on YouTube. And I've read some Ruby scripting tutorials on else places. And started to work a few hours ago. This is what I came up with. I wanted to share my result because this is the first thing I've scripted. I hope you tell me how it is going.

    (And by the way I hope this is the correct forum to post this.)

    Features So Far

    -Shows quests and its descriptions.

    -Can disable, enable quests with a script call.

    //This is done with the following call:



    Code:
    [I]DrakathQBQ::QUESTS[index][2][/I]
    The "index" here is quest id.

    Screenshot





    Updates

    -Added disabling and enabling quests with a script call. //21.07.2012

    -Changed how things were being handled. //21.07.2012

    So What?

    Those screenshots show everything. I just made some windows added some scene to show those windows. I'm going to improve things as I learn much more about RGSS2 scripting.

    Gimme the Script!

    OK, OK calm down. Here is the script.

    1.2(new)

    Spoiler
    Code:
    #############################################
    #Set your quest variables here.             #
    #Quest ID => [Quest Name, Details, enabled?]#
    #############################################
    module DrakathQBQ  
      QUESTS ={
      0 => ["Giadron Hunt", "Go and hunt a Giadron!", true],
      1 => ["Hythron Hunt", "Hunt a Hynthron", false],
      2 => ["Hunt for you", "Hunty hunty", true]
      }
    
    end
    
    
    
    ##################################
    #This one is quest detail window.#
    ##################################
    class DrakathQBDetail < Window_Base
      def initialize
        super(32,32,480,352)
        self.opacity = 255
        refresh
      end
      def refresh
        create_contents
    
        self.contents.draw_text(0,0,456,40,DrakathQBQ::QUESTS[$qlist_id][0])
        self.contents.draw_text(0,40,456,WLH,DrakathQBQ::QUESTS[$qlist_id][1])
      end
    end
    
    ##########################
    #Here is our board scene.#
    ##########################
    class DrakathQBScene < Scene_Base
    
      def start
      my_size = DrakathQBQ::QUESTS.size - 1
      s ={}
      @quest_data ={}
        for i in 0..my_size
          @quest_data = DrakathQBQ::QUESTS
          s[i]=DrakathQBQ::QUESTS[i][0]
        end
      @questb_window = Window_Command.new(480, s, 32, 32, 1, 11)
      draw_quest_item 
      end
    
      def draw_quest_item
        my_size = DrakathQBQ::QUESTS.size - 1
         for i in 0..2
          unless @quest_data[i][2] == true
            @questb_window.draw_item(i, false)
    
          end
        end  
      @questb_window.active = true
      @questb_window.index = 0
      end
    
      def update
      @questb_window.update
        if Input.trigger?(Input::
          $scene = Scene_Map.new
        end
        if Input.trigger?(Input::C)
          unless @quest_data[@questb_window.index][2] == false
            $qlist_id = @questb_window.index
            Sound.play_decision
            $scene = DrakathQBDetailScene.new
          else 
            Sound.play_buzzer
          end
        end
      end
    
      def terminate
      @questb_window.dispose  
      end
    end
    ###############################
    #This one is our detail scene.#
    ###############################
    class DrakathQBDetailScene < Scene_Base
    
      def start
        @my_window123 = DrakathQBDetail.new
      end
    
      def update
        @my_window123.update
          if Input.trigger?(Input::
            $scene = DrakathQBScene.new
          end
      end
    
      def terminate
        @my_window123.dispose
      end
    end
    1.0(old)

    Spoiler
    Code:
    ################################
    #Set your quest variables here. #
    ################################
    module DrakathQBQ
    QUESTS ={}
    QUESTS[0] = "Giadron Hunt"
    QUESTS[1] = "Hythron Hunt"
    QUESTS[2] = "Glydra Slay"
    QUESTS[3] = "Rare Lily Collect"
    QUESTS[4] = "Draugr Killer"
    QUEST_DATA ={ }
    QUEST_DATA[0] ="Go and hunt a Giadron!"
    QUEST_DATA[1] ="Go and hunt a Hythron!"
    QUEST_DATA[2] ="Go and slay 5 Glydras!"
    QUEST_DATA[3] ="Go collect a Rare Lily!"
    QUEST_DATA[4] ="Go and kill a Draugr"
    end
    #######################
    #This is board window. #
    #######################
    class DrakathQBWindow < Window_Selectable
    
    def initialize
    super(32, 32, 480, 352)
    self.opacity = 255
    refresh
    end
    
    def refresh #This makes content to be drawn.
    @item_max = DrakathQBQ::QUESTS.size
    create_contents
    for i in 0..@item_max
    draw_quest_enable(i)
    end
    end
    
    def draw_quest_enable(index) #And this actually draws content.
    rect = item_rect(index)
    self.contents.draw_text(rect, DrakathQBQ::QUESTS[index])
    end
    
    end
    ##################################
    #This one is quest detail window. #
    ##################################
    class DrakathQBDetail < Window_Base
    def initialize
    super(32,32,480,252)
    self.opacity = 255
    refresh
    end
    def refresh
    create_contents
    self.contents.draw_text(0,0,456,40,DrakathQBQ::QUESTS[$qlist_id])
    self.contents.draw_text(0,40,456,WLH,DrakathQBQ::QUEST_DATA[$qlist_id])
    end
    end
    
    ##########################
    #Here is our board scene. #
    ##########################
    class DrakathQBScene < Scene_Base
    
    def start
    @my_window134 = DrakathQBWindow.new
    @my_window134.active = true
    @my_window134.index = 0
    end
    
    def update
    @my_window134.update
    if Input.trigger?(Input::
    $scene = Scene_Map.new
    end
    if Input.trigger?(Input::C)
    $qlist_id = @my_window134.index
    Sound.play_decision
    $scene = DrakathQBDetailScene.new
    end
    end
    
    def terminate
    @my_window134.dispose
    end
    end
    ###############################
    #This one is our detail scene. #
    ###############################
    class DrakathQBDetailScene < Scene_Base
    
    def start
    @my_window123 = DrakathQBDetail.new
    end
    
    def update
    @my_window123.update
    if Input.trigger?(Input::
    $scene = DrakathQBScene.new
    end
    end
    
    def terminate
    @my_window123.dispose
    end
    end
    I Also Want To Say

    I could not see written and detailed RGSS2 scripting tutorials around. GubiD's tutorials are great to learn but I watched 3 parts of a cooking script tutorial (Each 18 mins.) to learn how to use command choises. If you know any written tutorial can you lead me to them?

    Sorry if the above question should not been asked here. Tell it to me and ignore it if that's the case.

    OOPPPSSS I WAS ALMOST ABOUT TO FORGOT!!!

    It might not be something much but DO NOT CLAIM THIS AS YOUR OWN WORK!
  2. It seems to be coming along rather well. What are you trying to accomplish?
  3. First thing I'm trying to acomplish is getting used to RGSS2 and Ruby. I just started scripting and wanted to see where I can get to.

    And about my quest system, first I want to have a quest board which you can look available quests and accept quests. And quests would change from time to time. (I'm going to use a time system which was on this forum I guess.) I have not made up my mind yet, but I wanted to start doing something. After I make up my mind I will edit the main post to add a "To Do List"
  4. Love the idea! Can others use your scripts in commercial usage games? If not I understand. Great work though! ^_^
  5. Umm this script is nothing much as it is and I can't promise it to be such a great script when it is completed. But if you want to use it, especially in a commerical game, don't forget to credit me. :)

    By the way, "my sripts"? I've just started scripting with this one script, but I hope I will have, as you said, scripts later. :p

    EDIT: I updated the script and edited the main post. You can see changes in the main post.