CrowMakerVX

Nffm2.0

Jan 8th, 2013
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 37.59 KB | None | 0 0
  1. ################################################################################
  2. #                      NoFightFriendMenu 1.0a
  3. #                           By: Ixfuru
  4. #                        December 16, 2012
  5. ################################################################################
  6. #
  7. # The purpose of this script is to allow you to have a project without fighting.
  8. # This by no means is the SOLE purpose of the script, but it has that capability,
  9. # as you don't have to display any status scenes, weapons, skills, any of that
  10. # if you don't want.  It's all up to you.
  11. #
  12. # This script creates several new systems.  A menu system, A friendship system,
  13. # and a journal system.  It offers two new scenes and various new accessible
  14. # windows.  The menu system is set up so that you can a)keep both the menu
  15. # designed for this script, b)do away with the old one, or c)keep only the
  16. # old one.
  17. #
  18. # It is best that you only access the new scenes from the smaller, centered
  19. # menu that now appears when you press the menu button.  And the great thing is
  20. # you control it through a single switch.  
  21. #
  22. # There are tons of customization options and some special script call commands
  23. # that can be used to implement the friendship features.  Please read through
  24. # the instructions carefully, one section at a time and set the script up so
  25. # that it best suits your needs.
  26. #
  27. ###############################################################################            
  28. #
  29. #
  30. # If you use this script for non-commercial use, it's okay, as long as credit to
  31. # me, IXFURU, is given.  For commercial projects, You'll have to contact me via
  32. # one of the forums by PM or in THE FINISH LINE user forum found here:
  33. #
  34. #                http://www.rpgmakervx.net/index.php?showforum=94
  35. #
  36. # If you have problems with the script, contact me on the topic thread where this
  37. # script was posted.  You may not redistribute without my consent.
  38. #
  39. ################################################################################
  40. ################################################################################
  41. #===============================================================================
  42. ################################################################################
  43. #
  44. # This script was requested by Tigergirl7707, here:
  45. #  
  46. #             http://www.rpgmakervx.net/index.php?showtopic=57208
  47. #
  48. #
  49. ################################################################################
  50. #                             SECTION 1
  51. ################################################################################
  52. #
  53. #                          SPECIAL COMMANDS
  54. #
  55. # The following series of commands can be used in the script command of an event
  56. # to perform procedures on individuals regarded as party friends.  Use the id
  57. # given in the FRIENDS hash of the customization section to replace 'friend_id'
  58. # anywhere in these script calls.
  59. #
  60. # To add a friend to the parties friends, use:
  61. #
  62. #  $game_party.make_new_friend(friend_id)
  63. #
  64. # To remove a friend from the friends list use:
  65. #
  66. #   $game_party.defriend(friend_id)
  67. #
  68. # You can alter the friend's rating by using this script call.  In this call,
  69. # use the 'how' as an integer from 0 to 3.  This integer will state exactly how
  70. # to modify the rating.  if how is 1, it will add.  2 is subtract, 3 is multiply
  71. # and 4 is divide.   Just change the 'amount' to the value of how much you wish
  72. # to change the rating by.
  73. #
  74. #   $game_friends[friend_id].alter_rating(how, amount)
  75. #  
  76. # You can check if a specific person is in the party by using the following.  
  77. # This is good if you want to run a conditional branch to see if the individual
  78. # is your friend:
  79. #
  80. #   $game_party.check_for_friend(friend_id)
  81. #
  82. # You can get a total number of friends by using the following.  So if you
  83. # wanted to save the number in a variable, you could say $game_variables[x] =:
  84. #
  85. #    $game_party.total_friends
  86. #
  87. # To change an actor's portrait on the bio scene, call this.  Replace x with the
  88. # actor whose portrait you wish to change.  Then replace image with the image in
  89. # the Graphics\Pictures folder that you want to be the new portrait.
  90. #
  91. #
  92. # To alter a friend's storyline, you can use the following.  Just make sure you
  93. # replace the 'new_storyline' with double-quoted text:
  94. #      
  95. #    $game_friends[friend_id].change_storyline(new_storyline)
  96. #
  97. ################################################################################          
  98. ################################################################################
  99. #
  100. #                    CUSTOMIZATION SECTION START
  101. #
  102. ################################################################################
  103.  
  104. module NFFM
  105.  
  106.   ##############################################################################
  107.   #                             SECTION 2
  108.   ##############################################################################
  109.  
  110.   NFFM_SWITCH = 1 #This is the switch you want to grant access to the new menu
  111.                   # When it is ON, you will taken to the new menu, when OFF,
  112.                   # it will go to the old menu.  So to avoid going to the old
  113.                   # menu completely, just turn the switch you place here ON and
  114.                   # leave it ON.
  115.    
  116.   #-----------------------------------------------------------------------------
  117.   # Set up the friendtowns here.  Anywhere you can find a friend
  118.   # in the game, you'll need a string of where you found them here.  The formula
  119.   # is as follows:
  120.   #               town_id => town_name
  121.  
  122.   FRIENDTOWNS = {#<<<<Don't delete this!!!
  123.  
  124.   1 => "Smalltown",
  125.   2 => "Linkville",
  126.  
  127.   }#<<<<Don't delete this!!!
  128.  
  129.  
  130.   #-----------------------------------------------------------------------------
  131.  
  132.   # The following hash will store info about the friends you meet, for use in the
  133.   # friends page.  To complete it, you'll need to use this formula:
  134.   #
  135.   # id => [name, start_value, town, face_name, face_index, char_name, char_index, info],
  136.   #
  137.   # id:  This needs to be any number from 0 up.  Each id needs to be a unique
  138.   #      value.  The system will call this number to identify which friend's
  139.   #      information to display.
  140.   # name: This is the name of the friend you have met.  Doesn't matter what you
  141.   #       place here, as long as it is in string ("") form.
  142.   # start_value: The system will create a meter from which you will be able to
  143.   #            to tell how good of friends you are with this individual.  The
  144.   #            value you place here must be 0 or greater and will be the value
  145.   #             at which the individual starts at.  In other words, how good
  146.   #           of a friend is this person from the outset of the game.
  147.   # town: This value MUST BE greater than 0.  It will reference the FRIENDTOWN
  148.   #        hash above by key.  So the value you place here tells the system
  149.   #        that this particular friend is from the town with that id.
  150.   # face_name: This references which face to align with which individual friend.
  151.   #           In the scene, this face will be displayed along with that friend's
  152.   #            information.   This is actually a filename for the image you
  153.   #           want to display.
  154.   # face_index: This gives reference to which face you want to display from the
  155.   #            face file you selected in face_name.  There are 8 faces on a
  156.   #            face file sheet.  You can choose between 0-7 to pinpoint which
  157.   #            face of the given file you want.
  158.   # char_name:, char_index: These are the same as the face_name, face_index. The
  159.   #            only difference is that they give reference to the character,
  160.   #            or sprite sheet instead of the faces.
  161.   # info:   This can be a long string, ("") form, which will display a brief
  162.   #            summary as to who this person is.  
  163.  
  164.   FRIENDS = {#<<<Don't delete this!
  165.  
  166.   0 => ["Marty", 50, 1, "People1", 4, "People1", 4, "Marty is a quiet man from Smalltown. He has thrived on his toolshop, where he produces ladders, shovels and such."],
  167.   1 => ["Ariel", 40, 1, "People1", 1, "People1", 1, "Ariel is Marty's daughter."],
  168.   2 => ["Father Bronze", 80, 2, "People2", 0, "People2", 0, "Father Bronze works at the Chapel.  He is a good man, who gives to the poor."],
  169.  
  170.   }#<<<Don't delete this!
  171.  
  172.   #------------------------------------------------------------------------------
  173.  
  174.   STORYLINES = {#<<<<Don't delete this!!!
  175.  
  176.   0 => "Marty really wants me to retrieve his lost sword from the sewers.  Maybe I'll try to do that.",
  177.   1 => "Ariel is looking for some help in getting her cat  Pickles out of a tree just outside of town.",
  178.   2 => "Father Bronze just wants me to be a good kid, and stay out of trouble.",
  179.  
  180.   }#<<<<<Don't delete this!!!
  181.  
  182.   ##############################################################################
  183.   #                                SECTION 3
  184.   ##############################################################################
  185.  
  186.   COMMAND_FRIENDSHIP = "Relationships" #The text displayed as an option in the menu to
  187.                                    #open friendship scene
  188.   BIO_TITLE = "'s Biography" #The title window will display this text, placing
  189.                               #the actor's name just before it.
  190.   COMMANDS_COLOR = 28 #Text color of commands in menu
  191.   BIO_TITLE_COLOR = 14 #Text color of Bio Title
  192.   BIO_NAME_COLOR = 18 #Text color of name appearing over portrait
  193.   FRIEND_TITLE_COLOR = 6 #Text color of Friends Title
  194.   MENU_SKIN = "Liberty1" # You can alter this to the name of the windowskin you want to use
  195.                   # for the menu window.  If you leave it blank (""), it will refer
  196.                   # to the default windowskin. If you use a custom windowskin here,
  197.                   # you'll have to ensure that the skin is found in your systems
  198.                   # folder.
  199.   BIO_SKIN = "Liberty1"
  200.   FRIEND_SKIN = "Liberty1"
  201.   FULL_FRIEND_METER = 100 #Value at which a friend meter is considered full.
  202.   FRIENDCOUNT_STRING = "Total Friends" #This is the text beside how many friends
  203.                                         #you've made in both bio and friend scenes
  204.   OPENING_SE = "Ice1" #Sound effect when new pages are opened
  205.   CANCEL_SE = "Fire2" #Sound effect when pages are closed
  206.   STORYLINE_TEXT = "Storylines" #Command in small Storylines window, takes you to
  207.                            #Where you can read how the friend fits into the game.
  208.   USE_STORYLINES = true #Enables use of the Storyline Scene.
  209.   USE_FRIEND_PORTRAITS = true #Enables you to use friend portraits, instead of faces
  210.   METER_TEXT = "FRIEND METER" #Text to be displayed around the friend's rating meter
  211.   HOME_TEXT = "HOMETOWN" #Text to be shown near where the friend lives.
  212.   STORYLINE_SKIN = "Liberty1"
  213.   METER_COLOR1 = 30
  214.   METER_COLOR2 = 31
  215.   METERBACK_COLOR = 8
  216.  
  217.   #************************************NFFM2************************************
  218.   BIO_FONTSIZE = 20  # Size of the Fonts in the paragraph of Bio section
  219.   QUICK_MENU_WIDTH = 160  #Width of the quickmenu (Default 160)
  220.   QUICK_MENU_HEIGHT = 245 #Width of the quickmenu  (Default 245, accomodates all commands)
  221.   QUICK_MENU_X = 200   #x position of menu  (Default 200)
  222.   QUICK_MENU_Y = 90     #y position of menu (Default 90)
  223.   USE_HOMES = true     #Can use the option to display hometowns  true = show hometowns
  224.   FRIEND_FONTSIZE = 20 #Size of the Fonts in the paragraph of Friend scene
  225.   #*****************************************************************************
  226.  
  227.   #-----------------------------------------------------------------------------
  228.   ##############################################################################
  229.   #                             SECTION 4
  230.   ##############################################################################
  231.  
  232.   # Below is a hash which will hold the image of an actor to be displayed in the
  233.   # bio scene.  If only one member will 'lead' your party, then you should only
  234.   # have to insert an image for that actor. Here is the formula for how to
  235.   # set it up:
  236.   #                actor_id => image_filename
  237.   #
  238.   # Replace 'actor_id' with the id of the actor in the database.  Replace
  239.   # 'image_filname' with the name of the image you want which MUST be in kept
  240.   # in your pictures folder.
  241.  
  242.   BIO_IMAGES = {#<<<<Don't delete this!
  243.  
  244.   1 => "People1_0",
  245.  
  246.   }#Don't delete this!
  247.   #
  248.   #-----------------------------------------------------------------------------
  249.  
  250.   # Next, this is where you'll state the portraits used for FRIENDS.  Set it up
  251.   # just like you did in the BIO_IMAGES hash, except replace actor_id with the
  252.   # id of the friend.
  253.   #
  254.   FRIEND_PORTRAITS = {#<<<Don't delete this!!!
  255.  
  256.   0 => "People1_3",
  257.   1 => "People1_1",
  258.   2 => "People2_0",
  259.  
  260.   }#<<<<Don't delete this!!!
  261.  
  262.   #-----------------------------------------------------------------------------
  263.   #
  264.   # Set the following hash up with this formula:
  265.   #                 actor_id => bio
  266.   #
  267.   # This will be responsible for retrieving the displayable text of the actor
  268.   # who is currently leading your party.  For every actor who may lead, you'll
  269.   # need an actor_id in the party to match it.
  270.  
  271.   ACTOR_BIOS = {#<<<<Don't delete this!
  272.  
  273.   1 => "Barney is a strange young man.  All he does is wander the streets looking for friends.  He says he wants to help people.  Yet some feel it is Barney who requires assistance."
  274.  
  275.   }#<<<<Don't delete this!
  276.  
  277.   #-----------------------------------------------------------------------------
  278.   ##############################################################################
  279.   #                              SECTION 5
  280.   ##############################################################################
  281.   # The following group of constants decides whether or not you wish to use any
  282.   # of the default menu scenes, if true, they will be used.  If false, they won't.
  283.   USE_SAVE = true
  284.   USE_STATUS = true
  285.   USE_EQUIPMENT = true
  286.   USE_INVENTORY = true
  287.   USE_SKILL = true
  288.   USE_END = true
  289.  
  290.   ##############################################################################
  291.   #
  292.   #                       END OF CUSTOMIZATION
  293.   #
  294.   ##############################################################################
  295. end
  296.  
  297.  
  298.   #=============================================================================
  299.   #                         FRIEND
  300.   #=============================================================================
  301.  
  302. class Friend
  303.    
  304.   include NFFM
  305.    
  306.   attr_accessor :id
  307.   attr_accessor :name
  308.   attr_accessor :rating
  309.   attr_accessor :home
  310.   attr_accessor :face_name
  311.   attr_accessor :face_index
  312.   attr_accessor :char_name
  313.   attr_accessor :char_index
  314.   attr_accessor :info
  315.   attr_accessor :storyline
  316.  
  317.   def initialize(friend_id)
  318.     @id = friend_id
  319.     @rating = FRIENDS[@id][1]
  320.     @name = FRIENDS[@id][0]
  321.     @home = FRIENDS[@id][2]
  322.     @face_name = FRIENDS[@id][3]
  323.     @face_index = FRIENDS[@id][4]
  324.     @char_name = FRIENDS[@id][5]
  325.     @char_index = FRIENDS[@id][6]
  326.     @info = FRIENDS[@id][7]
  327.     @storyline = STORYLINES[@id]
  328.   end
  329.  
  330.   def alter_rating(how = 0, amount = 1)
  331.     if how == 0
  332.       @rating += amount
  333.     elsif how == 1
  334.       @rating -= amount
  335.     elsif how == 2
  336.       @rating *= amount
  337.     elsif how == 3
  338.       @rating /= amount
  339.     end
  340.     if @rating < 0
  341.       @rating = 0
  342.     elsif @rating > FULL_FRIEND_METER
  343.       @rating = FULL_FRIEND_METER
  344.     end
  345.   end
  346.  
  347.   def change_storyline(story)
  348.     @storyline = story
  349.   end
  350.  
  351.  
  352. end
  353.  
  354. #===============================================================================
  355. #                         GAME_FRIENDS
  356. #===============================================================================
  357. class Game_Friends
  358.  
  359.   include NFFM
  360.  
  361.   def initialize
  362.     @data = []
  363.   end
  364.  
  365.    def [](friend_id)
  366.     if @data[friend_id] == nil and FRIENDS[friend_id] != nil
  367.       @data[friend_id] = Friend.new(friend_id)
  368.     end
  369.     return @data[friend_id]
  370.   end
  371.  
  372. end
  373.  
  374.  
  375. #===============================================================================
  376. #                             GAME TEMP
  377. #===============================================================================
  378. class Game_Temp
  379.  
  380.   include NFFM
  381.  
  382.   attr_accessor :quicku
  383.   attr_accessor :from_friend
  384.   attr_accessor :storybase
  385.  
  386.   alias nffm_gt_initialize initialize unless $@
  387.   def initialize
  388.     nffm_gt_initialize
  389.     @quicku = false
  390.     @from_friend = false
  391.     @storybase = 0
  392.   end
  393.  
  394. end
  395.  
  396. #===============================================================================
  397. #                               GAME PARTY
  398. #===============================================================================
  399. class Game_Party < Game_Unit
  400.  
  401.   include NFFM
  402.  
  403.   attr_accessor :friends
  404.   attr_accessor :total_friends
  405.   attr_accessor :friendtowns
  406.  
  407.   alias nffm_gp_initialize initialize unless $@
  408.   def initialize
  409.     nffm_gp_initialize
  410.     @friends = []
  411.     @friendtowns = []
  412.     @total_friends = 0
  413.   end
  414.  
  415.   def make_new_friend(friend_id)
  416.     if @friends.include?(friend_id)
  417.     else
  418.       @friends.push(friend_id)
  419.       get_total_friends
  420.     end
  421.   end
  422.  
  423.   def check_for_friend(friend_id)
  424.     if @friends.include?(friend_id)
  425.       return true
  426.     else
  427.       return false
  428.     end
  429.   end
  430.  
  431.   def defriend(friend_id)
  432.     if @friends.include?(friend_id)
  433.       @friends.delete(friend_id)
  434.       get_total_friends
  435.     end
  436.   end
  437.  
  438.   def get_total_friends
  439.     @total_friends = @friends.size
  440.   end
  441.  
  442. end
  443.  
  444. #===============================================================================
  445. #                      Game Actor
  446. #===============================================================================
  447. class Game_Actor
  448.  
  449.   include NFFM
  450.  
  451.   attr_accessor :portrait
  452.  
  453.   alias nffm_ga_initialize initialize unless $@
  454.   def initialize(actor_id)
  455.     nffm_ga_initialize(actor_id)
  456.     @portrait = BIO_IMAGES[actor_id]
  457.   end
  458.  
  459.   def change_portrait(image)
  460.     @portrait = image
  461.   end
  462.  
  463.   def return_default_portrait
  464.     @portrait = BIO_IMAGES[@id]
  465.   end
  466.  
  467. end
  468.  
  469.  
  470. #===============================================================================
  471. #                           Window Base
  472. #===============================================================================
  473. class Window_Base < Window
  474.  
  475.   include NFFM
  476.  
  477.   attr_accessor :meters
  478.   attr_accessor :portrait
  479.  
  480.   def draw_friendship_gauge(friend_id, x, y, width = 120)
  481.     friend = $game_friends[friend_id]
  482.     gw = width * friend.rating / FULL_FRIEND_METER
  483.     gc1 = text_color(METER_COLOR1)
  484.     gc2 = text_color(METER_COLOR2)
  485.     self.contents.fill_rect(x, y + WLH - 8, width, 6, text_color(METERBACK_COLOR))
  486.     self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
  487.   end
  488.  
  489.   def update_portrait
  490.     if @portrait != nil
  491.       @portrait.update
  492.     end
  493.   end
  494.  
  495.   def draw_friend_home(friend_id, x, y)
  496.     hometown = $game_friends[friend_id].home
  497.     self.contents.draw_text(x, y, self.width, WLH, FRIENDTOWNS[hometown])
  498.   end
  499.  
  500.   def draw_friend_name(friend_id, x, y)
  501.     name = $game_friends[friend_id].name
  502.     self.contents.draw_text(x, y, self.width, WLH, name)
  503.   end
  504.  
  505.   def draw_friend_portrait(friend_id, x, y)
  506.     porport = Viewport.new(x,  y, 272, 288)
  507.     portsprite = Sprite.new(porport)
  508.     portsprite.bitmap = Cache.picture(FRIEND_PORTRAITS[friend_id])
  509.     portsprite.z = 101
  510.     @portrait = portsprite
  511.   end
  512.  
  513.   def clear_portrait
  514.     if @portrait != nil
  515.       @portrait.dispose
  516.     end
  517.   end
  518.  
  519. end
  520.  
  521. #===============================================================================
  522. #                            Scene Title
  523. #===============================================================================
  524. class Scene_Title < Scene_Base
  525.  
  526.   alias nffm_st_create_game_objects create_game_objects unless $@
  527.   def create_game_objects
  528.     nffm_st_create_game_objects
  529.     $game_friends = Game_Friends.new
  530.   end
  531.  
  532. end
  533.  
  534. #===============================================================================
  535. #                             Scene Map
  536. #===============================================================================
  537.  
  538. class Scene_Map < Scene_Base
  539.  
  540.   include NFFM
  541.  
  542.   alias nffm_sm_start start unless $@
  543.   def start
  544.     nffm_sm_start
  545.     $game_temp.quicku = false
  546.   end
  547.  
  548.   alias nffm_sm_update update unless $@
  549.   def update
  550.     if $game_temp.from_friend
  551.       open_quicku
  552.     elsif $game_temp.quicku
  553.       super
  554.       update_quicku
  555.     else
  556.       nffm_sm_update
  557.     end
  558.   end
  559.  
  560.   alias nffm_sm_update_call_menu update_call_menu unless $@
  561.   def update_call_menu
  562.     if Input.trigger?(Input::B)
  563.       if $game_switches[NFFM_SWITCH]
  564.         return if $game_map.interpreter.running?
  565.         return if $game_system.menu_disabled
  566.         RPG::SE.new(OPENING_SE, 100, 80).play
  567.         open_quicku
  568.       else
  569.         nffm_sm_update_call_menu
  570.       end
  571.     end
  572.   end
  573.  
  574.   def open_quicku
  575.     @win_quicku = Window_QuickMenu.new(200, 90)
  576.     @win_quicku.active = true
  577.     $game_temp.quicku = true
  578.     $game_temp.from_friend = false
  579.   end
  580.  
  581.  
  582.   def update_quicku
  583.     @win_quicku.update
  584.     if Input.trigger?(Input::C)
  585.       case @win_quicku.index
  586.       when 0
  587.         RPG::SE.new(OPENING_SE, 80, 80).play
  588.         $scene = Scene_Bio.new(0)
  589.       when 1
  590.         if $game_party.total_friends > 0
  591.           RPG::SE.new(OPENING_SE, 80, 80).play
  592.           $scene = Scene_Friendships.new
  593.         else
  594.           Sound.play_buzzer
  595.         end
  596.       when 2...@win_quicku.commands_order.size
  597.         wqc = @win_quicku.commands_order[@win_quicku.index]
  598.         RPG::SE.new(OPENING_SE, 80, 80).play
  599.         if wqc == 2
  600.           $scene = Scene_Item.new
  601.         elsif wqc == 3
  602.           $scene = Scene_Skill.new
  603.         elsif wqc == 4
  604.           $scene = Scene_Equip.new
  605.         elsif wqc == 5
  606.           $scene = Scene_Status.new
  607.         elsif wqc == 6
  608.           $scene = Scene_File.new(true, false, false)
  609.         elsif wqc == 7
  610.           $scene = Scene_End.new
  611.         end
  612.       end
  613.     elsif Input.trigger?(Input::B)
  614.       RPG::SE.new(CANCEL_SE, 80, 80).play
  615.       $scene = Scene_Map.new
  616.     end
  617.   end
  618.  
  619.   alias nffm_gm_terminate terminate unless $@
  620.   def terminate
  621.     if $game_temp.quicku
  622.       @win_quicku.dispose
  623.       $game_temp.quicku = false
  624.       $game_temp.from_friend = false
  625.     end
  626.     nffm_gm_terminate
  627.   end
  628.  
  629.  
  630. end
  631.  
  632. #===============================================================================
  633. #                         Scene Item
  634. #===============================================================================
  635. class Scene_Item < Scene_Base
  636.  
  637.   include NFFM
  638.  
  639.   alias nffm_si_return_scene return_scene unless $@
  640.   def return_scene
  641.     if $game_switches[NFFM_SWITCH]
  642.       $game_temp.from_friend = true
  643.       $scene = Scene_Map.new
  644.     else
  645.       nffm_si_return_scene
  646.     end
  647.   end
  648.  
  649. end
  650.  
  651. #===============================================================================
  652. #                          Scene Skill
  653. #===============================================================================
  654. class Scene_Skill < Scene_Base
  655.  
  656.   include NFFM
  657.  
  658.   alias nffm_ss_return_scene return_scene unless $@
  659.   def return_scene
  660.     if $game_switches[NFFM_SWITCH]
  661.       $game_temp.from_friend = true
  662.       $scene = Scene_Map.new
  663.     else
  664.       nffm_ss_return_scene
  665.     end
  666.   end
  667.  
  668. end
  669.  
  670. #===============================================================================
  671. #                         Scene Equip
  672. #===============================================================================
  673. class Scene_Equip < Scene_Base
  674.  
  675.   include NFFM
  676.  
  677.   alias nffm_se_return_scene return_scene unless $@
  678.   def return_scene
  679.     if $game_switches[NFFM_SWITCH]
  680.       $game_temp.from_friend = true
  681.       $scene = Scene_Map.new
  682.     else
  683.       nffm_se_return_scene
  684.     end
  685.   end
  686.  
  687. end
  688.  
  689. #===============================================================================
  690. #                          Scene Status
  691. #===============================================================================
  692. class Scene_Status < Scene_Status
  693.  
  694.   include NFFM
  695.  
  696.   alias nffm_sstat_return_scene return_scene unless $@
  697.   def return_scene
  698.     if $game_switches[NFFM_SWITCH]
  699.       $game_temp.from_friend = true
  700.       $scene = Scene_Map.new
  701.     else
  702.       nffm_sstat_return_scene
  703.     end
  704.   end
  705.  
  706. end
  707. #===============================================================================
  708. #                          Scene File
  709. #===============================================================================
  710. class Scene_File < Scene_Base
  711.  
  712.   include NFFM
  713.  
  714.   alias nffm_write_save_data write_save_data unless $@
  715.   def write_save_data(file)
  716.     nffm_write_save_data(file)
  717.     Marshal.dump($game_friends, file)
  718.   end
  719.  
  720.   alias nffm_read_save_data read_save_data unless $@
  721.   def read_save_data(file)
  722.     $game_friends = Marshal.load(file)
  723.     nffm_read_save_data(file)
  724.   end
  725.  
  726.   alias nffm_sf_return_scene return_scene unless $@
  727.   def return_scene
  728.     if $game_switches[NFFM_SWITCH]
  729.       $game_temp.from_friend = true
  730.       $scene = Scene_Map.new
  731.     else
  732.       nffm_sf_return_scene
  733.     end
  734.   end
  735. end
  736.  
  737. #===============================================================================
  738. #                           Scene_End
  739. #===============================================================================
  740. class Scene_End < Scene_Base
  741.  
  742.   include NFFM
  743.  
  744.   alias nffm_send_return_scene return_scene unless $@
  745.   def return_scene
  746.     if $game_switches[NFFM_SWITCH]
  747.       $game_temp.from_friend = true
  748.       $scene = Scene_Map.new
  749.     else
  750.       nffm_send_return_scene
  751.     end
  752.   end
  753.  
  754. end
  755.  
  756. #===============================================================================
  757. #                       Window QuickMenu
  758. #===============================================================================
  759.  
  760. class Window_QuickMenu < Window_Selectable
  761.  
  762.   include NFFM
  763.  
  764.   attr_reader :commands_order
  765.  
  766.   def initialize(x, y)
  767.     super(x, y, QUICK_MENU_WIDTH, QUICK_MENU_HEIGHT)
  768.     @commands = []
  769.     get_commands
  770.     @item_max = @commands.size
  771.     unless MENU_SKIN == ""
  772.       self.windowskin = Cache.system(MENU_SKIN)
  773.     end
  774.     refresh
  775.     self.index = 0
  776.   end
  777.  
  778.   def get_commands
  779.     c1 = $game_party.members[0].name
  780.     c2 = COMMAND_FRIENDSHIP
  781.     shorts = [c1, c2]
  782.     @commands.concat(shorts)
  783.     if USE_INVENTORY
  784.       @commands.push(Vocab::item)
  785.     end
  786.     if USE_SKILL
  787.       @commands.push(Vocab::skill)
  788.     end
  789.     if USE_EQUIPMENT
  790.       @commands.push(Vocab::equip)
  791.     end
  792.     if USE_STATUS
  793.       @commands.push(Vocab::status)
  794.     end
  795.     if USE_SAVE
  796.       @commands.push(Vocab::save)
  797.     end
  798.     if USE_END
  799.       @commands.push(Vocab::game_end)
  800.     end
  801.     @commands_order = []
  802.     @commands_order[0] = 0
  803.     @commands_order[1] = 1
  804.     for i in 2...@commands.size
  805.       case @commands[i]
  806.       when Vocab::item
  807.         @commands_order[i] = 2
  808.       when Vocab::skill
  809.         @commands_order[i] = 3
  810.       when Vocab::equip
  811.         @commands_order[i] = 4
  812.       when Vocab::status
  813.         @commands_order[i] = 5
  814.       when Vocab::save
  815.         @commands_order[i] = 6
  816.       when Vocab::game_end
  817.         @commands_order[i] = 7
  818.       end
  819.     end
  820.   end
  821.  
  822.   def refresh
  823.     self.contents.clear
  824.     create_contents
  825.     for i in 0...@item_max
  826.       draw_item(i)
  827.     end
  828.   end
  829.  
  830.   def draw_item(index)
  831.     rect = item_rect(index)
  832.     self.contents.clear_rect(rect)
  833.     rect.x += 4
  834.     rect.width -= 8
  835.     self.contents.font.color = text_color(COMMANDS_COLOR)
  836.     self.contents.draw_text(rect, @commands[index])
  837.   end
  838.  
  839. end
  840.  
  841.  
  842. #===============================================================================
  843. #                             Window Biography
  844. #===============================================================================
  845. class Window_Biography < Window_Base
  846.  
  847.   include NFFM
  848.  
  849.   def initialize(x, y)
  850.     super(x, y, 544, 216)
  851.     @actor = $game_party.members[0]
  852.     unless BIO_SKIN == ""
  853.       self.windowskin = Cache.system(BIO_SKIN)
  854.     end
  855.     refresh
  856.   end
  857.  
  858.   def refresh
  859.     self.contents.clear
  860.     self.contents.font.size = BIO_FONTSIZE
  861.     self.contents.font.color = text_color(BIO_TITLE_COLOR)
  862.     self.contents.draw_text(-16, 0, self.width, 30, @actor.name + BIO_TITLE, 1)
  863.     self.contents.font.size = BIO_FONTSIZE
  864.     self.contents.font.color = normal_color
  865.     self.contents.draw_paragraph(0, 35, self.width - 32, 116, ACTOR_BIOS[@actor.id])
  866.   end
  867.  
  868. end
  869.  
  870. #===============================================================================
  871. #                           Window Portrait
  872. #===============================================================================
  873. class Window_Portrait < Window_Base
  874.  
  875.   include NFFM
  876.  
  877.   attr_accessor :bio_sprite
  878.  
  879.   def initialize(x, y, actor)
  880.     super(x, y, 544, 200)
  881.     @actor = actor
  882.     unless BIO_SKIN == ""
  883.       self.windowskin = Cache.system(BIO_SKIN)
  884.     end
  885.     refresh
  886.   end
  887.  
  888.   def refresh
  889.     self.contents.clear
  890.     self.contents.font.size = 26
  891.     self.contents.font.color = text_color(BIO_NAME_COLOR)
  892.     self.contents.draw_text((self.width - 32) / 4, 0, self.width - 32, 30, @actor.name, 1)
  893.     self.contents.font.size = BIO_FONTSIZE
  894.     self.contents.font.color = system_color
  895.     self.contents.draw_text((self.width - 32) / 4, 34, self.width - 32, BIO_FONTSIZE + 4, FRIENDCOUNT_STRING, 1)
  896.     self.contents.font.color = normal_color
  897.     move = FRIENDCOUNT_STRING.length
  898.     self.contents.draw_text((self.width - 32) / 4, 64, self.width - 32, 30, $game_party.total_friends.to_s, 1)
  899.     self.contents.font.size = 12
  900.     port = Viewport.new(0, -50, 218, 236)
  901.     port.z = 101
  902.     @bio_sprite = Sprite.new(port)
  903.     @bio_sprite.bitmap = Cache.picture(BIO_IMAGES[@actor.id])
  904.     @bio_sprite.x = 0
  905.     @bio_sprite.y = 0
  906.   end
  907.  
  908. end
  909.  
  910. #===============================================================================
  911. #                           Scene Bio
  912. #===============================================================================
  913. class Scene_Bio < Scene_Base
  914.  
  915.   include NFFM
  916.  
  917.   def initialize(party_position)
  918.     @actor = $game_party.members[party_position]
  919.   end
  920.  
  921.  
  922.   def start
  923.     super
  924.     create_menu_background
  925.     @win_bio = Window_Biography.new(0, 201)
  926.     @win_portrait = Window_Portrait.new(0, 0, @actor)
  927.   end
  928.  
  929.   def update
  930.     @win_portrait.bio_sprite.update
  931.     if Input.trigger?(Input::B)
  932.       RPG::SE.new(CANCEL_SE, 80, 80)
  933.       $game_temp.from_friend = true
  934.       $scene = Scene_Map.new
  935.     end
  936.   end
  937.  
  938.   def terminate
  939.     @win_bio.dispose
  940.     @win_portrait.bio_sprite.dispose
  941.     @win_portrait.dispose
  942.   end
  943.  
  944. end
  945.  
  946. #===============================================================================
  947. #                              Window_FriendCommands
  948. #===============================================================================
  949. class Window_FriendCommands < Window_Selectable
  950.  
  951.   include NFFM
  952.  
  953.   def initialize(x, y)
  954.     if USE_STORYLINES
  955.       super(x, y, 180, 326)
  956.     else
  957.       super(x, y, 180, 416)
  958.     end
  959.     @commands = []
  960.     for i in 0...FRIENDS.size
  961.       if $game_party.friends.include?(i)
  962.         @commands.push($game_friends[$game_party.friends[i]].name)
  963.       end
  964.     end
  965.     @item_max = @commands.size
  966.     unless FRIEND_SKIN == ""
  967.       self.windowskin = Cache.system(FRIEND_SKIN)
  968.     end
  969.     refresh
  970.     self.index = 0
  971.   end
  972.  
  973.   def refresh
  974.     create_contents
  975.     self.contents.clear
  976.     for i in 0...@item_max
  977.       draw_item(i)
  978.     end
  979.   end
  980.  
  981.   def draw_item(index, enabled = true)
  982.     rect = item_rect(index)
  983.     self.contents.clear_rect(rect)
  984.     rect.x += 4
  985.     rect.width -= 8
  986.     self.contents.font.color = text_color(COMMANDS_COLOR)
  987.     self.contents.draw_text(rect, @commands[index], 1)
  988.   end
  989.  
  990. end
  991.  
  992. #===============================================================================
  993. #                         Window Storyline Command
  994. #===============================================================================
  995. class Window_StorylineCommand < Window_Selectable
  996.  
  997.   include NFFM
  998.  
  999.   def initialize(x, y)
  1000.     super(x, y, 180, 90)
  1001.     @commands = []
  1002.     @commands[0] = STORYLINE_TEXT
  1003.     @commands[1] = "Cancel"
  1004.     @item_max = @commands.size
  1005.     unless FRIEND_SKIN == ""
  1006.       self.windowskin = Cache.system(FRIEND_SKIN)
  1007.     end
  1008.     refresh
  1009.     self.index = 0
  1010.   end
  1011.  
  1012.   def refresh
  1013.     create_contents
  1014.     self.contents.clear
  1015.     for i in 0...@item_max
  1016.       draw_item(i)
  1017.     end
  1018.   end
  1019.  
  1020.   def draw_item(index, enabled = true)
  1021.     rect = item_rect(index)
  1022.     self.contents.clear_rect(rect)
  1023.     rect.x += 4
  1024.     rect.width -= 8
  1025.     self.contents.font.color = text_color(COMMANDS_COLOR)
  1026.     self.contents.draw_text(rect, @commands[index], 1)
  1027.   end
  1028.  
  1029. end
  1030.  
  1031. #===============================================================================
  1032. #                          Window Friend Info
  1033. #===============================================================================
  1034. class Window_FriendInfo < Window_Base
  1035.  
  1036.   include NFFM
  1037.  
  1038.   def initialize(x, y)
  1039.     super(x, y, 364, 416)
  1040.     @friends = $game_friends
  1041.     unless FRIEND_SKIN == ""
  1042.       self.windowskin = Cache.system(FRIEND_SKIN)
  1043.     end
  1044.   end
  1045.  
  1046.   def create_friend_contents(friend_id)
  1047.     create_contents
  1048.     self.contents.clear
  1049.     if USE_FRIEND_PORTRAITS
  1050.       clear_portrait
  1051.     end
  1052.     id = friend_id
  1053.     friend = @friends[friend_id]
  1054.     self.contents.font.size = 26
  1055.     self.contents.font.color = text_color(FRIEND_TITLE_COLOR)
  1056.     draw_friend_name(id, 0, 0)
  1057.     if USE_FRIEND_PORTRAITS
  1058.       draw_friend_portrait(id, 225, 25)
  1059.     else
  1060.       draw_face(friend.face_name, friend.face_index, 25, 120, 96)
  1061.     end
  1062.     self.contents.font.color = system_color
  1063.     self.contents.font.size = 12
  1064.     self.contents.draw_text(0, 30, self.width, WLH, METER_TEXT)
  1065.     draw_friendship_gauge(id, (self.width - 32) - 240, 24, 200)
  1066.     if USE_HOMES
  1067.       self.contents.draw_text(0, 50, self.width, WLH, HOME_TEXT)
  1068.     end
  1069.     self.contents.font.color = normal_color
  1070.     self.contents.font.size = 12
  1071.     if USE_HOMES
  1072.       draw_friend_home(id, (self.width - 32) - 240, 50)
  1073.     end
  1074.     draw_character(friend.char_name, friend.char_index, self.width - 48, 56)
  1075.     self.contents.font.size = FRIEND_FONTSIZE
  1076.     self.contents.draw_paragraph(0, 250, self.width - 32, self.height - 80, friend.info)
  1077.   end
  1078.  
  1079. end
  1080.  
  1081. #===============================================================================
  1082. #                       Window Storylines
  1083. #===============================================================================
  1084. class Window_Storylines < Window_Base
  1085.  
  1086.   include NFFM
  1087.  
  1088.   attr_accessor :story
  1089.  
  1090.   def initialize(x, y)
  1091.     super(x, y, 544, 416)
  1092.     unless FRIEND_SKIN == ""
  1093.       self.windowskin = Cache.system(FRIEND_SKIN)
  1094.     end
  1095.     @story = 0
  1096.     refresh
  1097.   end
  1098.  
  1099.   def refresh
  1100.     self.contents.clear
  1101.     unless @story == nil
  1102.       self.contents.font.color = normal_color
  1103.       self.contents.draw_paragraph(0, 0, 480, 380, $game_friends[@story].storyline)
  1104.     end
  1105.   end
  1106.  
  1107. end
  1108.  
  1109. #===============================================================================
  1110. #                               Scene Friendships
  1111. #===============================================================================
  1112. class Scene_Friendships < Scene_Base
  1113.  
  1114.   include NFFM
  1115.  
  1116.   def start
  1117.     super
  1118.     @win_fcom = Window_FriendCommands.new(0, 0)
  1119.     @win_finfo = Window_FriendInfo.new(181, 0)
  1120.     if USE_STORYLINES
  1121.       @win_fslines = Window_StorylineCommand.new(0, 327)
  1122.     end
  1123.     @story_open = false
  1124.     @win_fcom.active = true
  1125.   end
  1126.  
  1127.   def update
  1128.     if @win_fcom.active
  1129.       @win_fcom.refresh
  1130.       @win_fcom.update
  1131.       @win_finfo.create_friend_contents($game_friends[$game_party.friends[@win_fcom.index]].id)
  1132.       @win_finfo.update_portrait
  1133.       if Input.trigger?(Input::B)
  1134.         RPG::SE.new(CANCEL_SE, 80, 80)
  1135.         $game_temp.quicku = true
  1136.         $game_temp.from_friend = true
  1137.         $scene = Scene_Map.new
  1138.       elsif Input.trigger?(Input::C)
  1139.         if USE_STORYLINES
  1140.           RPG::SE.new(OPENING_SE, 80, 80)
  1141.           make_storyline_active
  1142.         end
  1143.       end
  1144.     elsif USE_STORYLINES
  1145.       if @win_fslines.active
  1146.         @win_fslines.refresh
  1147.         @win_fslines.update
  1148.         if Input.trigger?(Input::B)
  1149.           RPG::SE.new(CANCEL_SE, 80, 80)
  1150.           make_commands_active
  1151.         elsif Input.trigger?(Input::C)
  1152.           RPG::SE.new(OPENING_SE, 80, 80)
  1153.           case @win_fslines.index
  1154.           when 0
  1155.            @win_story = Window_Storylines.new(0, 0)
  1156.            @win_story.story = $game_friends[$game_party.friends[@win_fcom.index]].id
  1157.            make_story_active
  1158.            @story_open = true
  1159.           when 1
  1160.             RPG::SE.new(CANCEL_SE, 80, 80)
  1161.             make_commands_active
  1162.           end
  1163.         end
  1164.       elsif @story_open
  1165.         @win_story.refresh
  1166.         if Input.trigger?(Input::B)
  1167.           RPG::SE.new(CANCEL_SE, 80, 80)
  1168.           make_storyline_active
  1169.         elsif Input.trigger?(Input::C)
  1170.           RPG::SE.new(CANCEL_SE, 80,80)
  1171.           make_storyline_active
  1172.         end
  1173.       end
  1174.     end
  1175.   end
  1176.  
  1177.   def make_storyline_active
  1178.     @win_fcom.active = false
  1179.     @win_fslines.active = true
  1180.     if @story_open
  1181.       $game_temp.storybase = -1
  1182.       @win_story.dispose
  1183.       @story_open = false
  1184.     end
  1185.   end
  1186.  
  1187.   def make_commands_active
  1188.     @win_fslines.active = false
  1189.     @win_fcom.active = true
  1190.   end
  1191.  
  1192.   def make_story_active
  1193.     @win_fslines.active = false
  1194.     @win_fcom.active = false
  1195.   end
  1196.  
  1197.   def terminate
  1198.     @win_fcom.dispose
  1199.     @win_finfo.contents.dispose
  1200.     @win_finfo.dispose
  1201.     if USE_STORYLINES
  1202.       @win_fslines.dispose
  1203.     end
  1204.   end
  1205.  
  1206. end
Advertisement
Add Comment
Please, Sign In to add comment