HellKiteChaoS 36 Posted May 13, 2013 (edited) Chaos - Reputations / FactionsBy: Chaos (HellKiteChaoS)Last Update: May 13, 2013Latest version: 1.0 This script can be used for non commercial and commercial games as long as I am credited. ^.^ This is my first script, so I'm open to corrections, suggestions, and opinions. If you find a issue or bug, please let me know and I'll get an update out as soon as I can. Hope you all enjoy! IntroductionThis script allows you to create and setup any number of factions and reputations. Screenshots The profession menu. Here you can see a positive reputation amount. This player has done something that this faction likes, thus the value of that faction has gone up. Here you can see a negative reputation amount. This player has done something that this faction does not appreciate or like, thus the value of that reputation has gone down. How to UsePlace in your materials section. Some setup is needed, some assembly required. The graphics needed is in the demo found here. Place the image in the corresponding folder in your project. Call with SceneManager.call(ReputationScene) Updates version 1.0 (May 13, 2013) - Script released. Known issues to fix -If no factions are currently activated in game, the list should no longer display anything but a blank screen. (Even this I'm debating on changing since that defeats the purpose of having the menu in the first place at that stage of the game.) -If you only have one faction activated in game, when scroling through the list of factions, the menu thinks there is a second faction and displays a blank section. The script should only allow you to scroll if there are more than 2 factions activated. -If the first faction activated in game isn't the first faction on the setup list in the scrip's setup area, the script will show the correct faction on the list to the left of the page, but no information will be displayed on the right until the user scrolls through the "bank sections". I believe this also ties into the bug listed above. Future ideas for this script - Ability to place a banner / flag picture or icon for further detail. (Will be implemented after the bug fixes.) Script #============================================================================== # ############################ # ### Reputations / Factions ### # ############################ # # Version: 1.0 # Author: HellKiteChaoS # # Credits and thanks: # -Galv: Modified variable outline graphic. # -DP3: For his video tutorials on RGSS3 scripting. # #============================================================================== #============================================================================== # Updates # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # 5/6/2013 - Started Script. # #============================================================================== # Introduction # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # Creates a window to display reputations found in game as you play. This is # controlled by switches in game, as well as variables used to store the values # of your reputation. # #============================================================================== # Instructions # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # To install this script, open up your script editor and copy/paste this script # to an open slot below â–¼ Materials but above â–¼ Main. Remember to save! # # To call this script from a event, use: # SceneManager.call(ReputationScene) # #============================================================================== # Compatibility # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that # it will run with RPG Maker VX without adjusting. # #============================================================================== #=============================================================================== # == Setup == #=============================================================================== # # This section is where you list the reputations you wish to use. # # RepSetup[x]: This is the main array that will be used. This will # start at 0. For every faction / reputation that you # make, increase x by 1. See setup below for example. # # switch_id: This is the switch ID used in game to represent the # reputation. Turn this switch on to display it in the # reputation list. # # variable_id: This is the variable ID used in game to represent the # reputation amount. This variable will hold the value # and be shown in the window. # # reputation name: This is where you become creative and give your # reputations names. # # reputation_info: This is where you can add extra information about your # reputations. Each "info1, info2, info3" are individual # lines that will be displayed. If you choose to not use # a line, simply put "" and nothing will be displayed. # You do not have to use all 10 lines if you choose not to. # # Setup example: # # RepSetup[0] = { # :switch_id => 15, # :variable_id => 30, # :reputation_name => "Kingsport", # :reputation_info1 => "Kingsport is the greatest city across the land.", # :reputation_info2 => "", # :reputation_info3 => "Only the best goods are sold here.", # :reputation_info4 => "", # :reputation_info5 => "This faction will increase as your reputation", # :reputation_info6 => "with Kingston decreases. Keep this in mind.", # :reputation_info7 => "", # :reputation_info8 => "", # :reputation_info9 => "", # :reputation_info10 => "" # } # #=============================================================================== module Chaos module RepDataSetup #------------------------------------------------------------------------------- RepSetup = [] # DO NOT TOUCH! GURRR! #------------------------------------------------------------------------------- RepSetup[0] = { :switch_id => 15, :variable_id => 30, :reputation_name => "Kingsport", :reputation_info1 => "Kingsport is the greatest city across the land.", :reputation_info2 => "", :reputation_info3 => "Only the best goods are sold here.", :reputation_info4 => "", :reputation_info5 => "This faction will increase as your reputation", :reputation_info6 => "with Kingston decreases. Keep this in mind.", :reputation_info7 => "", :reputation_info8 => "", :reputation_info9 => "", :reputation_info10 => "" } RepSetup[1] = { :switch_id => 16, :variable_id => 31, :reputation_name => "Livington", :reputation_info1 => "", :reputation_info2 => "Great city. Plenty of rich and poor to go around!", :reputation_info3 => "", :reputation_info4 => "Killing wild animals might lower your reputation", :reputation_info5 => "with the Livington. They like living things...", :reputation_info6 => "", :reputation_info7 => "", :reputation_info8 => "", :reputation_info9 => "", :reputation_info10 => "" } #=============================================================================== # == Reputation title setup == #=============================================================================== # # This section is where you list the reputation title names. # Here you can choose to give names for reaching a specific amount of # reputation with a faction. # # Array construction: # [minimum, maximum, title name] # # minimum: This variable will be what is needed to reach the title # rank. Once the in game variable has reached this amount, # the title will be updated on the page. # # maximum: This variabe will fill in the range before the next title # rank. For example, if you have 99 rep of reputation A, # and you gain 1 more rep, you will achive the next title. # To achive the next rank you need 200, so the min for the # current rank is now 100, and the max would be 199. # # title name: Here again is where you get creative. Give your ranks # names. Are you loved by said people, or hated and would # be killed if they ever see you. # # EXAMPLE: [400, 500, "Loved"], # [300, 399, "Friends"] <--- Don't forget, the last # entry in the array needs # to NOT have a comma. # #=============================================================================== RepTitle = [ [400, 500, "Exalted"], [300, 399, "Allies"], [200, 299, "Knighted"], [50, 199, "Friendly"], [0, 49, "Neutral"], [-99, -1, "Unfriendly"], [-199, -100, "Dangerous"], [-500, -200, "Kill on sight"] #------------------------------------------------------------------------------- ] # DO NOT TOUCH THIS! #------------------------------------------------------------------------------- #=============================================================================== # == Variable and options setup == #=============================================================================== #--------------------------------------------------------------------------- # Show Reputation Title # Here you can choose to show the title ranks of the reputations or not. # true: It will display the titles on the screen. # false: Will not display titles. #--------------------------------------------------------------------------- ShowTitle = true #--------------------------------------------------------------------------- # Show Reputation Progress Gauge # Here you can choose to show a progress bar. # true: It will display the progress bar at the bottom of the page. # false: Will not use the progress bar. #--------------------------------------------------------------------------- ShowGauge = true #--------------------------------------------------------------------------- # Show Reputation Information # Here you can choose to show the extra information about the reputations. # true: It will display the extra information. # false: Will not use the extra information. #--------------------------------------------------------------------------- ShowInfo = true #--------------------------------------------------------------------------- # Min And Max Value Setup # These two variables will control the two polar ends of the reputation # values. The MAXVALUE variable will control the "cap" that you can # reach with a reputation. The MINVALUE variable acts the same way, but # is the cap to the lowest you can go with a reputation. # # MINVALUE can be less than zero. # MAXVALUE must be greater than zero and greather than MINVALUE. # MINVALUE and MAXVALUE must be identical numbers. # Example: 500 and -500, 750 and -750, 1556 and -1556. #--------------------------------------------------------------------------- MaxValue = 500 MinValue = -500 #--------------------------------------------------------------------------- # Information Font Setup # Here you setup the font size for the detail information about the # reputations. #--------------------------------------------------------------------------- FontSize = 20 #--------------------------------------------------------------------------- # Menu Name # Here you choose what the selection name will be in the command menu. #--------------------------------------------------------------------------- MenuName = "Reputations" #--------------------------------------------------------------------------- # Title Name # Here you choose what the title name that will display for your titles. #--------------------------------------------------------------------------- TitleName = "Standing" #--------------------------------------------------------------------------- # Numeric Name # Here you choose the numeric name that will display under the title. #--------------------------------------------------------------------------- NumericName = "Value" #=============================================================================== end ########################################################### end ##### END SETUP CONFIGURATION. NO EDITING PAST THIS POINT GRRRRR! ##### ########################################################### #=============================================================================== class ReputationScene < Scene_Base include Chaos::RepDataSetup #-------------------------------------------------------------------------- # * Start Processing #-------------------------------------------------------------------------- def start super() create_reputation_command_list() create_reputation_info_window() create_reputation_bar_outline() end #-------------------------------------------------------------------------- # * Post-Start Processing #-------------------------------------------------------------------------- def post_start super() end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super() return_scene() if Input.trigger?(: end def create_reputation_info_window @reputation_info_window = Reputation_Info_Window.new(150,0,(Graphics.width - 150) ,Graphics.height) end def create_reputation_command_list @reputation_cmmdwindow = ReputationCommand.new(0, 0) end def create_reputation_bar_outline @bar_outline = Sprite.new() @bar_outline.bitmap = Cache.picture("RepBarCover") @bar_outline.x = 190 @bar_outline.y = Graphics.height * 0.85 @bar_outline.z = 100 end def terminate super() @bar_outline.bitmap.dispose() @bar_outline.dispose() end end #============================================================================== # ** Window_MenuCommand #------------------------------------------------------------------------------ # This command window appears on the menu screen. #============================================================================== class Window_MenuCommand < Window_Command #-------------------------------------------------------------------------- # * For Adding Original Commands #-------------------------------------------------------------------------- alias hkchaos_customscene_windowsmenucommand_add_reputation_window_46514 add_original_commands def add_original_commands hkchaos_customscene_windowsmenucommand_add_reputation_window_46514() add_command(Chaos::RepDataSetup::MenuName.to_s, :reputations, true) end end class Scene_Menu < Scene_MenuBase #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- alias hkchaos_custcomscene_reputation_window_46514 create_command_window def create_command_window hkchaos_custcomscene_reputation_window_46514() @command_window.set_handler(:reputations, method(:command_customscene)) end def command_customscene SceneManager.call(ReputationScene) end end class ReputationCommand < Window_Command include Chaos::RepDataSetup #-------------------------------------------------------------------------- # * Make Command List #-------------------------------------------------------------------------- def make_command_list $rep_index = 0 RepSetup.each_with_index do |index, position| switch_id = RepSetup[position][:switch_id] next unless $game_switches[switch_id] || switch_id == 0 text = RepSetup[position][:reputation_name] add_command(text, :reputation_name) end end def window_width return 150 end def window_height return Graphics.height end def cursor_up(wrap = true) $rep_index -= 1 if $rep_index < 0 $rep_index = RepSetup.count - 1 end if index >= col_max || index == RepSetup.count - 1 || index == 0 select((index - col_max + item_max) % item_max) end end def cursor_down(wrap = true) $rep_index += 1 if $rep_index >= RepSetup.count $rep_index = 0 end if index < item_max - col_max || index == RepSetup.count - 1 || index == 0 select((index + col_max) % item_max) end end end class Reputation_Info_Window < Window_Base include Chaos::RepDataSetup #--------------------------------------------------------------------------# # Object Initialization # #--------------------------------------------------------------------------# def initialize(x, y, width, height) super(x, y, width, height) draw_rep_info($rep_index) end #--------------------------------------------------------------------------# # Draw Rep Info Text # #--------------------------------------------------------------------------# def draw_rep_info(index) #Pull data from array in setup rep_name = RepSetup[index][:reputation_name] switch_id = RepSetup[index][:switch_id] var_id = RepSetup[index][:variable_id] info_line1 = RepSetup[index][:reputation_info1] info_line2 = RepSetup[index][:reputation_info2] info_line3 = RepSetup[index][:reputation_info3] info_line4 = RepSetup[index][:reputation_info4] info_line5 = RepSetup[index][:reputation_info5] info_line6 = RepSetup[index][:reputation_info6] info_line7 = RepSetup[index][:reputation_info7] info_line8 = RepSetup[index][:reputation_info8] info_line9 = RepSetup[index][:reputation_info9] info_line10 = RepSetup[index][:reputation_info10] #Sets up variables based on data listed above if $game_variables[var_id] > MaxValue $game_variables[var_id] = MaxValue end if $game_variables[var_id] < MinValue $game_variables[var_id] = MinValue end repvalue = $game_variables[var_id] maxvalue = MaxValue minvalue = MinValue #Draws the reputation name as a title at the top left contents.font.bold = true contents.font.size = 30 draw_text(0, 0, contents.width, 50, rep_name, 0) contents.font.bold = false contents.font.size = FontSize if ShowTitle == true l = 0 for k in RepTitle min = RepTitle[l][0] max = RepTitle[l][1] if repvalue >= min && repvalue <= max rank_title = RepTitle[l][2] draw_text(0, 20, contents.width, 75, TitleName + ": " + rank_title.to_s, 0) break end l += 1 end end #Draws the reputation bar and amount if ShowGauge == true reprate = (((((maxvalue/maxvalue).to_f)/maxvalue).to_f) * repvalue).to_f rep_min_max = repvalue.to_s + " / " + maxvalue.to_s gh = (Graphics.height * 0.8) if repvalue < 0 reprate *= -1 color1 = hp_gauge_color1 color2 = hp_gauge_color2 draw_gauge_neg(40, gh+2, 150, reprate, color1, color2) draw_gauge_pos(191, gh+2 , 150, 0, color1, color2) else color1 = tp_gauge_color1 color2 = tp_gauge_color2 draw_gauge_neg(40, gh+2, 150, 0, color1, color2) draw_gauge_pos(191, gh+2, 150, reprate, color1, color2) end contents.font.bold = false contents.font.size = 20 draw_text(0, 50, contents.width, 50, NumericName + ": " + rep_min_max.to_s, 0) contents.font.bold = false contents.font.size = FontSize end if ShowInfo == true draw_text(0, 100, contents.width, line_height, info_line1, 0) draw_text(0, 120, contents.width, line_height, info_line2, 0) draw_text(0, 140, contents.width, line_height, info_line3, 0) draw_text(0, 160, contents.width, line_height, info_line4, 0) draw_text(0, 180, contents.width, line_height, info_line5, 0) draw_text(0, 200, contents.width, line_height, info_line6, 0) draw_text(0, 220, contents.width, line_height, info_line7, 0) draw_text(0, 240, contents.width, line_height, info_line8, 0) draw_text(0, 260, contents.width, line_height, info_line9, 0) draw_text(0, 280, contents.width, line_height, info_line10, 0) end end def update super contents.clear draw_rep_info($rep_index) end # Custom draw_gauge to allow gauges to build both forward and backwords to # display positive values and negative values. alias hkchaos_customgauge_neg__46514 draw_gauge def draw_gauge_neg(x, y, width, rate, color1, color2) hkchaos_customgauge_neg__46514(x, y, width, rate, color1, color2) fill_w = (width * rate).to_i gauge_y = y + line_height - 8 contents.fill_rect(x, gauge_y, width, 30, gauge_back_color) contents.gradient_fill_rect(189-(width - (width * (1 - rate))), gauge_y, fill_w, 30, color1, color2) end alias hkchaos_customgauge_pos__46514 draw_gauge def draw_gauge_pos(x, y, width, rate, color1, color2) hkchaos_customgauge_pos__46514(x, y, width, rate, color1, color2) fill_w = (width * rate).to_i gauge_y = y + line_height - 8 contents.fill_rect(x, gauge_y, width, 30, gauge_back_color) contents.gradient_fill_rect(x, gauge_y, fill_w, 30, color1, color2) end end Credit / ThanksHellKiteChaos Galv DP3 Edited November 25, 2013 by HellKiteChaoS 4 Share this post Link to post Share on other sites
Darkanine 116 Posted May 13, 2013 Woah! yesterday me and my team were just discussing about making a faction system,this is just what I needed :3 Share this post Link to post Share on other sites
Camupin 0 Posted May 13, 2013 Love it! One of the best rep scripts I've seen so far. Totes gonna use this~ Share this post Link to post Share on other sites
Pikalyze 4 Posted May 13, 2013 Woah! Another one. This one looks really good. I'm definitely considering this. Share this post Link to post Share on other sites
jpem 0 Posted May 17, 2013 I keep getting this error, I know nothing about scripting so was wondering if anyone had any ideas. http://puu.sh/2VzpH Share this post Link to post Share on other sites
HellKiteChaoS 36 Posted May 18, 2013 (edited) I keep getting this error, I know nothing about scripting so was wondering if anyone had any ideas. http://puu.sh/2VzpH Hey jpem. I found the error in the code that was giving you that message. Somehow when I copied and pasted the code from the game to here, it added a space at the ?(: This is fixed on the post above. return_scene() if Input.trigger?(: If anyone else is getting this error message, I updated the script in the spoiler on this page if your copying it from there. The script in the demo does not have this issue. Thanks for letting me know about that, and sorry it gave you issues. Edited May 18, 2013 by HellKiteChaoS Share this post Link to post Share on other sites
jpem 0 Posted May 18, 2013 That worked. Thank you very much. Share this post Link to post Share on other sites
gutter201 0 Posted June 2, 2013 This is great, I have one small request. Is there anyway to have an overall reputation also... by some how adding the city/guild reps together. I'm working on a game that would gain alot from that. If you do, infact and a overall rep could you make it so it changes the hero's nickname? Share this post Link to post Share on other sites
HellKiteChaoS 36 Posted June 3, 2013 This is great, I have one small request. Is there anyway to have an overall reputation also... by some how adding the city/guild reps together. I'm working on a game that would gain alot from that. If you do, infact and a overall rep could you make it so it changes the hero's nickname? As far as making an "overall reputation", that's the easy part. The actual reputation values that's used in game are actually just simple variables that you can alter manually in game. So to have a "main" reputation that adds / subtracts all the reputations together, simply put that in a common event and call as needed in your events. Also, in the setup of the script create a main faction / reputation that will then use that main variable. The only issue I can see having is adding all the reputations together will exceed the "max" reputation amount set in the setup. I like the idea of having a "main" reputation or "overall" reputation, as well as it changing your nickname. If I can get some free time soon (I'm actually very busy at work / home atm ugggg) I'll start taking a swing at this. No guarantee's though as I'm still a beginner scripter but I'll do what I can. Share this post Link to post Share on other sites
Alex Anth 0 Posted August 19, 2013 I like the script but I think I found a glitch. If you go into the Reputation screen and press up or down you can still scroll through reputations that haven't been unlocked yet. Share this post Link to post Share on other sites
HellKiteChaoS 36 Posted August 19, 2013 I like the script but I think I found a glitch. If you go into the Reputation screen and press up or down you can still scroll through reputations that haven't been unlocked yet. I'll try to look into this sometime this week. I'm in the process of moving at the moment so I don't have much free time on my hands. Good find though. =D Share this post Link to post Share on other sites
Alex Anth 0 Posted August 30, 2013 Thank you, great script btw Share this post Link to post Share on other sites
NBalchemist 5 Posted September 2, 2013 Awesome. Definitely keeping this in mind! Share this post Link to post Share on other sites
jhondidfool 2 Posted September 19, 2013 Heyas, I've been messing around with your script (it's great!) to use it as a sanity meter and relationship meter, and managed to make it show different kinds of titles for different reputations (Yay me!). But there is something that annoys me terribly: I have eight factions, perfectly set up, but only two are initialized; when I press up in the first faction, the display changes to the eight, and if I'm in the second and push down it shifts to the third, even though those factions have not been activated. I must admit I'm pretty new to RGSS3 (Started yesterday, I must not have poured more than six hours on it!), but I've tried everything that came to my mind. The problem is I yet do not understand the menu system well enough, and I've been going a bit blind. My pseudocode would be something like: def cursor_down (wrap true) $rep_index += 1 if RepSetup[$rep_index].[:switch_id] != false #Do stuff that makes the cursor go down and the data change else $rep_index -=1 end I don't know if my problem is in the algorithm I'm trying to use, my sintaxis (although it complies) or that I'm missing the point completely on what cursor_down (or up) does. Thank you! Share this post Link to post Share on other sites
KayDgirl91 99 Posted September 19, 2013 Very nice script! I love it! Share this post Link to post Share on other sites
Regless 0 Posted September 23, 2013 I seem to having the same issue as jhondidfool. Any help would be appreciated. Kickass script otherwise. Share this post Link to post Share on other sites
zulor 0 Posted November 11, 2013 I like the script but I think I found a glitch. If you go into the Reputation screen and press up or down you can still scroll through reputations that haven't been unlocked yet. Excellent script! Only issue I have found is the one mentioned by Alex. Otherwise, script is great and an excellent resource. Thanks for sharing with us all by HellKiteChaoS. Share this post Link to post Share on other sites
Chaos17 31 Posted November 11, 2013 I've a suggestion : the option to put a picture for each faction. Share this post Link to post Share on other sites
Acolon 0 Posted November 22, 2013 Hi this may be a noob question. I´m using a custom menu and I want to add a scene call to show up your script. But I can´t find the name of your new scene on the script. I don´t know if I´m expressing myself right. But I need to now wich scene I need to call to show up this new window. Share this post Link to post Share on other sites
estriole 326 Posted November 22, 2013 @vitor: SceneManager.call(ReputationScene) Share this post Link to post Share on other sites
Acolon 0 Posted November 24, 2013 @vitor: SceneManager.call(ReputationScene) I´m using this and I geting an error: Script HE - Settings line 57 Name Error ocurred. uninitialized constant Hirion::Settings::ReputationScene This script call works just fine for an event call but for activating from the game menu I get this error. I supose the Reputation Screen have a diferent name but I can´t find it. I´m Using the HE - Main Menu script. Share this post Link to post Share on other sites
HellKiteChaoS 36 Posted November 25, 2013 Hey Acolon, the issue might be a conflict of code between the two scripts. My script by default places the menu option into the game. When I update the script I'll put an option in the setup to turn that off so you can use the scene call instead. This might fix the issue since my script touches the menu list. The current bugs I'm working on: -If no factions are currently activated in game, the list should no longer display anything but a blank screen. (Even this I'm debating on changing since that defeats the purpose of having the menu in the first place at that stage of the game.) -If you only have one faction activated in game, when scroling through the list of factions, the menu thinks there is a second faction and displays a blank section. The script should only allow you to scroll if there are more than 2 factions activated. -If the first faction activated in game isn't the first faction on the setup list in the scrip's setup area, the script will show the correct faction on the list to the left of the page, but no information will be displayed on the right until the user scrolls through the "bank sections". I believe this also ties into the bug listed above. After these bugs are fixed I will be adding in the request to be able to add pictures to go with the factions. Some ideas I had were: -A small icon to the left of the faction's name in the command list -A small pictures in the top right of the information screen -A transparent picture in the background of the information screen I've been out of Ruby for about 5 months now, so I'm having to adjust to the code again. Works finally slowing down for me thus some free time here and there is arriving again. I'll do my best to have this fixed for you guys asap. -HellKiteChaos Share this post Link to post Share on other sites
Acolon 0 Posted November 26, 2013 Humm no prob HellKiteChaos take your time I was wondering if the error had something to do with me doing something wrong. If it is an incompatibility I can wait for an update the faction reputation is not something major for my project I can implement it latter. Thx for the feedback. Share this post Link to post Share on other sites
Fhizban 96 Posted July 7, 2014 (sorry for the necro) is anybody still working on this script? There are still quite some errors in it, but they can easily be fixed. Any plans on releasing another version? Share this post Link to post Share on other sites