Szyu's Simple Factions

Szyu's Simple Factions

About

This script adds categorized factions to your game, which can be tracked and used for advanced event and script flow control.You can define event pages to be of a certain faction with simple access.

Download it HERE

How To Use

- Define your reputation levels, factions and faction categories in the module SZS_Factions.- To access a faction, use '$game_factions[index]'!The first faction has ID/index 0!- To add reputation to a faction, use'$game_factions.gain_reputation(id, amount)' to add reputation for a factionor'$game_factions.lose_reputation(id, amount)' to remove reputation for a factionIf the reputation was not visible, it now will be displayed in the factions list.- To define an event page to be from a certain faction, use a comment including following line:'<faction: x>' where x is the index of the faction in the module's Factions-list- You can check if an event page is from faction with following script call:event.factionThis will return the index (id) of the event's faction. If no faction is assigned, this will return nil.- With a Script-Condition likeif event.faction && $game_factions[event.faction].reputation > xyou can create a conditional branch, where you check for the players reputation with the event page's faction to be higher than a specific value. Screenshots

Spoiler
Script Condition in an event (Full Text: 'Conditional Branch: Script: event.faction && $game_factions[event.faction].reputation > 1500')

condition.png


Status of Factions simply displayed at the bottom

faction-list.png


Individual list for different categories; Status bar colored differently for reputation levels

faction-list2.png


If enabled, Faction Icon/Graphic and description can be displayed as well:

faction_zpsdnq8as0r.png

Terms of Use

You are free to use this script for commercial and non-commercial projects. However I'd like you to inform me of the projects you are planning to use it in, so I can keep track of where my scripts are used.
This is a really cool Script, if you convert it to MV I will be using it for sure in one of my 2016 games 🙂
I'm planning to and thank you =)
Szyu's Simple Factions

About

This script adds categorized factions to your game, which can be tracked and used for advanced event and script flow control.You can define event pages to be of a certain faction with simple access.

Download it HERE

How To Use

- Define your reputation levels, factions and faction categories in the module SZS_Factions.- To access a faction, use '$game_factions[index]'!The first faction has ID/index 0!- To add reputation to a faction, use'$game_factions.gain_reputation(id, amount)' to add reputation for a factionor'$game_factions.lose_reputation(id, amount)' to remove reputation for a factionIf the reputation was not visible, it now will be displayed in the factions list.- To define an event page to be from a certain faction, use a comment including following line:'<faction: x>' where x is the index of the faction in the module's Factions-list- You can check if an event page is from faction with following script call:event.factionThis will return the index (id) of the event's faction. If no faction is assigned, this will return nil.- With a Script-Condition likeif event.faction && $game_factions[event.faction].reputation > xyou can create a conditional branch, where you check for the players reputation with the event page's faction to be higher than a specific value. Screenshots

Spoiler
Script Condition in an event (Full Text: 'Conditional Branch: Script: event.faction && $game_factions[event.faction].reputation > 1500')

condition.png


Status of Factions simply displayed at the bottom

faction-list.png


Individual list for different categories; Status bar colored differently for reputation levels

faction-list2.png


If enabled, Faction Icon/Graphic and description can be displayed as well:

faction_zpsdnq8as0r.png

Terms of Use

You are free to use this script for commercial and non-commercial projects. However I'd like you to inform me of the projects you are planning to use it in, so I can keep track of where my scripts are used.
If you are still checking and updating this script, I was wondering if there is a way to change the faction graphic depending on relationship level?
Like an angry pic if hated, and smiling one if liked?
Otherwise, thank you for creating such a nice script.🙂
Hey, I like the script, and it works fine, but I have issue:
The reputation can go over and under value, it can go to - under minimum and over maximum value.
Any way to fix that? Or is there a way to remove numbers from the bar just to leave bar?
The reputation can go over and under value, it can go to - under minimum and over maximum value.
Untested, but try this
Ruby:
class Game_Faction
   alias r2_faction_reputation_gain    gain_reputation
    def gain_reputation(amount)
        if (@reputation += amount) <= 0
            amount = @reputation
        elsif (@reputation += amount) >= SZS_Factions::MaxReputation
            amount = SZS_Factions::MaxReputation - @reputation
        end
        r2_faction_reputation_gain(amount)
  end
end
Untested, but try this
Ruby:
class Game_Faction
   alias r2_faction_reputation_gain    gain_reputation
    def gain_reputation(amount)
        if (@reputation += amount) <= 0
            amount = @reputation
        elsif (@reputation += amount) >= SZS_Factions::MaxReputation
            amount = SZS_Factions::MaxReputation - @reputation
        end
        r2_faction_reputation_gain
  end
end
Sorry to anoy and bother you, but where do I place this? I tried different places in script and as a addon, but keeps crashing at start. But when I place it at end of script, it crashes when I add or remove reputation. It says game interpetation
But when I place it at end of script, it crashes when I add or remove reputation
Sorry small mistake. I corrected the code above.
Place in a new script slot below the factions script, or at the bottom of the factions script
Sorry small mistake. I corrected the code above.
Place in a new script slot below the factions script, or at the bottom of the factions script
OK, i got it to work partly, the numbers don't go over maximum of set value of 2500
BUT, they dont go value that I input. I use 300, but it goes by like 950. It does cap at 2500
When I use the $game_factions.lose_reputation command (tested with 255), the numbers go down, and they go down in like ~500 or something like that.
they go down in like ~500
That's really weird.
I had to break the values out as they were for some reason getting processed. I didn't think that could ever happen that way.
Ruby:
#==============================================================================
# ** Fix for max min limits
#==============================================================================

class Game_Faction
  alias r2_faction_reputation_gain    gain_reputation
  def gain_reputation(amount)
    current = @reputation
    change = current += amount
    if change <= 0
      amount = (-@reputation)
    elsif change >= SZS_Factions::MaxReputation
      amount = SZS_Factions::MaxReputation - @reputation
    end
    r2_faction_reputation_gain(amount)
  end
end
I just updated it before you replied, so you probably didn't see it.
Mainly, I noticed that vlaues that I add for plus, (used 300 got like 950) go up not the ones I wrote
Ok, I just went over the snipet again and found what the issue was. I somehow managed to copy the "Ruby" part 😀
Now, all works well and properly. Thanks man!
I love you! <3
Hello, could you please write an script-example how to check the reputation-value of a faction?
I don't really know how to make it. Thanks!
Can the window transparency in this script be semi-transparent like all other windows and not opaque? Or is there a reason why the windows are completely opaque? Even if I add an opacity = x function to the script, it does nothing.
Can the window transparency in this script be semi-transparent
The entire window or just the background? opacity or back_opacity
Does the script work for you? I had to change @help_window to @fac_help_window everywhere
Ruby:
module R2_Faction_Opac_Window
  Opacity = 150
end
class Scene_FactionList < Scene_Base
  alias r2_faction_cat_window create_category_window
  def create_category_window
    r2_faction_cat_window
    @category_win.opacity = R2_Faction_Opac_Window::Opacity
  end
  alias r2_faction_help_window  create_help_window
  def create_help_window
    r2_faction_help_window
    @help_window.opacity = R2_Faction_Opac_Window::Opacity
  end
  alias r2_faction_fac_list_window  create_fac_list_window
  def create_fac_list_window
    r2_faction_fac_list_window
    @fac_list_win.opacity = R2_Faction_Opac_Window::Opacity
  end
  alias r2_faction_desc_window  create_desc_window
  def create_desc_window
    r2_faction_desc_window
    @desc_window.opacity = R2_Faction_Opac_Window::Opacity
  end
end
@Roninator2 I tried this snipped but for me it only changes the window color to appear darker. Even if I change the Opacity to zero, the window appears black instead of semi-transparent.
the window appears black
That's because there is no background for the scene. You can either make one or rework the script to copy over Scene_MenuBase background.

Here is a copy of Theoallens code for using a custom image, but changed slightly.
Ruby:
class Scene_FactionList < Scene_Base
  BGName = "Faction"
 
  alias theo_menuedit_start start
  def start
    theo_menuedit_start
    configure_menu
  end
 
  def configure_menu
    @ex_bg = Sprite.new
    @ex_bg.bitmap = Cache.system(BGName)
    @ex_bg.z = 1
  end
 
  alias theo_menuedit_terminate terminate
  def terminate
    theo_menuedit_terminate
    @ex_bg.dispose
  end
 
end
@Roninator2 Hm, is it necessary to use a background? I just want the windows to appear semi-transparent. No background or anything like that. But if there's no other option, I'll try it that way.
I just want the windows to appear semi-transparent.
If there is any transparency, what would you see underneath?
If it's not an image, what do you expect to see?
If there is any transparency, what would you see underneath?
If it's not an image, what do you expect to see?
A blurred image of the map, like in any other menu. This would be important for consistency.

Original thread: https://forums.rpgmakerweb.com/threads/szyus-simple-factions.45682/