Save-Point
Show Choices with hidden option - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+------ Forum: Code Snippets & Others/Misc (https://www.save-point.org/forum-100.html)
+------ Thread: Show Choices with hidden option (/thread-6609.html)



Show Choices with hidden option - xackery - 05-07-2009

Show Choices with hidden option
by xackery
May 7 2009

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


I wanted to make choices that by default are hidden, but are unlocked later when you gain e.g. a thief job.
Instead of writing a lengthy two-way condition to check if the unlock occurred, I wrote a check inside Interpreter 3.

This is how it works:

Change Interpreter 3 from:
Code:
#--------------------------------------------------------------------------
  # * Show Choices
  #--------------------------------------------------------------------------
  def command_102
    # If text has been set to message_text
    if $game_temp.message_text != nil
      # End
      return false
    end
    # Set message end waiting flag and callback
    @message_waiting = true
    $game_temp.message_proc = Proc.new { @message_waiting = false }
    # Choices setup
    $game_temp.message_text = ""
    $game_temp.choice_start = 0
    setup_choices(@parameters)
    # Continue
    return true
  end

To...
Code:
#--------------------------------------------------------------------------
  # * Show Choices
  #--------------------------------------------------------------------------
  def command_102
    # If text has been set to message_text
    if $game_temp.message_text != nil
      # End
      return false
    end
    # Set message end waiting flag and callback
    @message_waiting = true
    $game_temp.message_proc = Proc.new { @message_waiting = false }
    # Choices setup
    $game_temp.message_text = ""
    $game_temp.choice_start = 0
    #Xack Filter Choices:
    @tmpparam = []
    for text in @parameters[0]  
      if text.index("\\c[2]Steal") == 0 and $game_switches[16] == false
        #Xack Don't include option of Steal if thief switch(16) is not on
      else
        @tmpparam.push(text)
      end
    end
    @parameters[0] = @tmpparam
    setup_choices(@parameters)
    # Continue
    return true
  end


Now any time you create a choice called "\c[2]Steal" (no quotes) it will skip it as an option if variable 16 is not turned on.

Downside: This ONLY works on the last option of a choice menu, Example:
@>Show Choices: Talk, \c[2]Steal, Dance
If you do my above code, it would display Talk and Dance, but when you click Dance, it'd trigger the \c[2]Steal code.

The recommended way to use this modification is:
@>Show Choices: Talk, Dance, \c[2]Steal
The menu would work normally, only showing the last option when you unlock the Thief class.

If you see any other downsides, or know of a better method let me know!
Thanks for your time.