Advertisement
CrowMakerVX

Nffm2.1a

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