Partagez
Aller en bas
Zydd
Zydd
Membre

Nombre de messages : 114
Age : 36
Localisation : Pink City
Distinction : aucune
Date d'inscription : 07/07/2008

Factions Empty Factions

le Sam 4 Avr 2009 - 10:03
Edit : Faction : Gouvernement ou peuple . Ce script permet donc de gérer une faction dans votre jeu . Vous rendant ainsi plus ou moins influent et important auprès des factions qui serons vos amies ou ennemies Smile



J'ai trouvé ça sur le web us héhé :

Version 1.3
Author SojaBird (=me)
Release Date
BETA > 4-12-'08 - 29-12-'08
v1.0 (full release) > 03-01-'09
v1.2 (not released) > 07-02-'09
v1.3 > 14-02-'09
Weblink www.scriptology.co.nr


Contenu de cette version :

. Créer et gérer vos factions !
.
Utilisez de nombreuses fonctionnalités supplémentaires !


v1.0 (version complète)

* Ajouter les factions;
* Gérer les;
* Ajouter, retirer et mettre en valeur la réputation de l';
* Voir discriptions supplémentaires et des images;
* Message de faction de la valeur, au moyen d'un simple "/ FAC [nom]"-commande;
* Et beaucoup plus encore! ..



v1.2 (non publié)

* Une nouvelle et une meilleure impression à la fonction "outil de script".

v1.3

* Set de départ factions;
* Nouvel appel script "add_factions" de sorte que vous pouvez en ajouter d'autres factions en même temps;
* "Game_Temp" changements dans Game_System, pour que je puisse supprimer la "Save and Load" code des factions du script.
Spoiler:

################################################################################
=begin
################################################################################
Name: Factions

By: SojaBird
Version: 1.3
Data: 14-02-'09
Site: http://www.nestcast.blogspot.com

Discription: The script is finished!

After a long BETA-stage, the script finaly works as it should.
Please be sure that you read all the info on how to use the
script, before doing anything. After reading, you can go and edit
the module wich is directly below the script info. With every
change you make, the script will adept it's functionality, so that
the factions you add, are displayed as they should.

Enjoy and have fun!


Greatzz,
SojaBird.

################################################################################
(\_/) (\_/)
(o.o) READ BEFORE USING (o.o)
(> <) (> <)

~Call script~
Faction startup:
add_faction(name, max_value, start_value, *help_text, *pic)
This will add a faction to the system. Value's that must be insert are;
- name (name of the faction)
- max_value (the heighest amount of reputation the faction can get)
- start_value (the reputation of the faction when entered in the system)
Value's that could be insert for a personal touch are;
- help_text (the text that will be displayed when the faction is selected
in the menu (add ## to go the second line))
- pic (the picture that can be shown in the menu)
add_factions([name, max_value, start_value, *help_text, *pic],[..])
This will add mutiple factions to the system. It does the same as the
add_faction call, but only with more factions at the same time. Value's
that must be in insert are the same as with the add_faction, only now they
must be inside a array [..] (usefull when adding more than 1 faction).
delete_faction(name)
This will delete a faction from the system with the name of your choice.
Value's that must be insert are;
- name (the name of the faction that need to be deleted)

Faction value changes:
set_faction_value(name, value)
This will set the value of a faction to the value of your choice. Value's
that must be insert are;
- name (the name of the faction that gets a new value)
- value (the new value of the faction)
add_faction_value(name, value)
This will add an amount of reputation of your choice to a faction.
Value's that must be insert are;
- name (the name of the faction that gets reputation)
- value (the value that needs to be add to the faction reputation)
remove_faction_value(name, value)
This will remove an amount of reputation of your choice from a faction.
Value's that must be insert are;
- name (the name of the faction that lose reputation)
- value (the value that needs to be removed from the faction reputation)

Faction max_value changes:
set_faction_value_max(name, value)
This will set the max_value of a faction to the value of your choice.
Value's that must be insert are;
- name (the name of the faction that gets a new max_value)
- value (the new max_value of the faction)
add_faction_value_max(name, value)
This will add an amount to the max_value of your choice to a faction.
Value's that must be insert are;
- name (the name of the faction that gets a heigher max_value)
- value (the value that needs to be add to the faction max_value)
remove_faction_value_max(name, value)
This will remove an amount of the max_value of your choice from a
faction. Value's that must be insert are;
- name (the name of the faction that gets a lower max_value)
- value (the value that needs to be removed from the faction max_value)

Faction info changes:
change_faction_help(name, text)
This will changes the help_text of a faction. Value's that must be insert
are;
- name (the name of the faction that gets a new help_text)
- text (the new help text for the faction (a "/" will jump to the 2nd
line))
change_faction_pic(name, pic)
This will changes the picture of a faction. Value's that must be insert
are;
- name (the name of the faction that gets a new picture)
- pic (the name of the picture for the faction)

~Conditional Branch~
faction?(name)
This will check if a faction exists in the system. Value's that must be
instert are;
- name (the name of the faction that needs to be check on existence)
faction_value?(name, value)
This will check if a faction has a sertain minimum value. Value's that
must be insert are;
- name (the name of the faction that needs to have a sertain value)
- value (the minimun value the faction needs to have)

~Extra's~
F5 in testmode
When you're in the DEBUG_mode (testmode), F5 will bring up the factions
with their data, stored by the system.
\FAC[name] in message
When you put \FAC[name] in a message, it'll transform to the current value
of the selected faction. Value's that must be insert are;
- name (the name of the faction wich value must be displayed)

################################################################################
=end
################################################################################
module SojaBird_Factions
####################################
# Customize module
You_Name_It = "Reputation" # Name that will showup in the menu.
Line_Height = 19 # Size of the text and bars (default = 19, wich will show 8 factions).
Help_Name = 2 # Add's the faction-name in the descriptionwindow [0="Description", 1="Name: Description", 2="Name"|"Description"].
Help_Picture = true # Add's the faction-picture to the descriptionwindow [true=Display, false=Don't display].
Display_Picture = true # Add's the faction-picture to the selectionwindow [true=Display, false=Don't display].
Empty_Picture = "" # The picture to be shown when no picture is added to the faction-info (put "" for no picture at all).
Empty_Description = "No extra information available." # The text that is displayed when there's no text added to the faction-info).
Print = true # The way of displaying the faction array when in test mode F5 is pressed [true=Easy 1by1, false=Raw data].

# To start the game with factions allready, set them here. Though, you do have to set all the data (description and picture as well).
Start_Factions = [ # << Don't edit <<
["SojaBird", 100, 100, Empty_Description, Empty_Picture], # << Example (remove) <<
["Pim321", 100, 50, Empty_Description, Empty_Picture] # << Example (remove) <<
] # << Don't edit <<
# Customize module: End
#####################################
end
#####################################
# Call script functions
#-----------------------------------#
# Change factions
def add_faction(name, max_value, start_value, help_text = SojaBird_Factions::Empty_Description, pic = SojaBird_Factions::Empty_Picture)
@info = [name, max_value, start_value, help_text, pic]
@info[1] = @info[1] * -1 if @info[2] < 0
$game_system.faction_data.each do |data|
if data[0] == name
$game_system.faction_data.delete_at $game_system.faction_data.index(data)
end
end
$game_system.faction_data.push @info
correct_faction_values(@info)
end

def add_factions(*arg)
arg.each do |i|
case i.size
when 3; add_faction(i[0], i[1], i[2])
when 4; add_faction(i[0], i[1], i[2], i[3])
when 5; add_faction(i[0], i[1], i[2], i[3], i[4])
end
end
end

def delete_faction(name)
$game_system.faction_data.each do |data|
if data[0] == name
$game_system.faction_data.delete(data)
end
end
end
# Change factions: End
#-----------------------------------#
# Change value
def set_faction_value(name, value)
$game_system.faction_data.each do |data|
if data[0] == name
data[2] = value
correct_faction_values(data)
end
end
end

def add_faction_value(name, value)
$game_system.faction_data.each do |data|
if data[0] == name
data[2] += value
correct_faction_values(data)
end
end
end

def remove_faction_value(name, value)
$game_system.faction_data.each do |data|
if data[0] == name
data[2] -= value
correct_faction_values(data)
end
end
end
# Change value: End
#-----------------------------------#
# Change max_value
def set_faction_max(name, value)
$game_system.faction_data.each do |data|
if data[0] == name
data[1] = value
correct_faction_values(data)
end
end
end

Suite dans le prochain message ^^


Dernière édition par Zydd le Sam 4 Avr 2009 - 14:28, édité 1 fois
Zydd
Zydd
Membre

Nombre de messages : 114
Age : 36
Localisation : Pink City
Distinction : aucune
Date d'inscription : 07/07/2008

Factions Empty Re: Factions

le Sam 4 Avr 2009 - 10:04
La suite !


Spoiler:

def add_faction_max(name, value)
$game_system.faction_data.each do |data|
if data[0] == name
data[1] += value
correct_faction_values(data)
end
end
end

def remove_faction_max(name, value)
$game_system.faction_data.each do |data|
if data[0] == name
data[1] -= value
correct_faction_values(data)
end
end
end
# Change max_value: End
#-----------------------------------#
# Correct values (no actual callscript)
def correct_faction_values(data)
data[1] *= -1 if data[2] < 0 and data[1] > 0
data[1] *= -1 if data[2] > 0 and data[1] < 0
data[2] = data[1] if data[2] < 0 and data[2] < data[1]
data[2] = data[1] if data[2] > 0 and data[2] > data[1]
end
# Correct values: End
#-----------------------------------#
# Change extra's
def change_faction_help(name, text)
$game_system.faction_data.each do |data|
if data[0] == name
data[3] = text
end
end
end

def change_faction_pic(name, pic)
$game_system.faction_data.each do |data|
if data[0] == name
data[4] = pic
end
end
end
# Change extra's: End
#-----------------------------------#
# User help
# In testmode, F5 will show the factions-array
def print_faction_data
if SojaBird_Factions::Print == false; p $game_system.faction_data; else;
index = 0; $game_system.faction_data.each do |i|; index += 1
p "Position: #{index} | Name: #{i[0]} | Value: #{i[2]}/#{i[1]} | Description: #{i[3]} | Picture: #{i[4]}"
end; end; end
# User help: End
#-----------------------------------#
# Conditional-braches
# As conditional-branch use 'faction?("name")', returns true if 'faction(name) exists'
def faction?(name); $game_system.faction_data.each do |data|; return true if data[0] == name; end; end
# As conditional-branch use 'faction_value?("name", value)', returns true if 'faction_value >= value'
def faction_value?(name, value); $game_system.faction_data.each do |data|; if data[0] == name; return true if data[2] >= value; end; end; end
# Conditional-braches: End
#-----------------------------------#
# Call script: End
#####################################
#-----------------------------------#
#####################################
# Shows factions information
class Window_Factions < Window_Selectable
include SojaBird_Factions
def initialize(x, y, width, height, start)
super(x, y, width, height, (2 * Line_Height))
self.index = 0
self.contents.font.size = Line_Height
@max_lines = 304 / (Line_Height * 2)
@start = start * @max_lines
self.contents = Bitmap.new(width - 32, (2 * Line_Height) * @max_lines)
refresh
end

def refresh
self.contents.clear
for faction in @start..@max_lines + @start - 1
if $game_system.faction_data[faction] != nil
@item_max = faction - @start + 1
data = $game_system.faction_data[faction]
x = 0
y = (faction - @start) * Line_Height * 2
if Display_Picture == true and data[4] != ""
draw_picture(x, y, data)
x += Cache.picture(data[4]).width
end
draw_bar(x, y, data)
draw_name(x, y, data)
end
end
end

def draw_picture(x, y, data)
pic = data[4]
rect = Rect.new(0, (Line_Height * 2) - (Cache.picture(pic).height / 2), Cache.picture(pic).width - 1, Line_Height * 2 - 2)
self.contents.blt(x + 1, y + 1, Cache.picture(pic), rect)
end

def draw_bar(x, y, data)
### Initialize ###
# ~Parent info~
@value = data[2]
@value_max = data[1]
# ~Color~
@back_color = 4
if @value > 0; color = 11
elsif @value == 0; color = 4
elsif @value < 0; color = 4; @back_color = 18
end
# ~Width~
gauge_width = self.contents.width * @value / @value_max if @value_max != 0
gauge_width = 0 if @value_max == 0
border_width = self.contents.width
# ~Position~
@bar_x = 0
@bar_x = self.contents.width - gauge_width if @value < 0
@bar_y = y + Line_Height
# ~Offset~
if Display_Picture == true and data[4] != ""
@picture_width = Cache.picture(data[4]).width
@bar_x += @picture_width
gauge_width -= @picture_width
border_width -= @picture_width
end
### Draw ###
# ~Bar~
self.contents.fill_rect(x + 1, @bar_y, border_width - 2, Line_Height - 1, text_color(4))
self.contents.gradient_fill_rect(@bar_x + 1, @bar_y, gauge_width - 2, Line_Height - 1, text_color(@back_color), text_color(color))
# ~Text~
text_line = "#{@value}/#{@value_max}"
if Display_Picture == true and data[4] != ""; x -= @picture_width; end
self.contents.draw_text(x, @bar_y - 2, self.contents.width, Line_Height, text_line, 1)
end

def draw_name(x, y, data)
name = data[0]
self.contents.draw_text(x, y, self.contents.width, Line_Height, name)
end

def update_cursor
self.cursor_rect.empty if @index < 0
self.cursor_rect.set(0, @index * (Line_Height * 2), self.contents.width, Line_Height * 2)
end

def update_help
if $game_system.faction_data != []
@description = $game_system.faction_data[self.index + @start]
text = ""
text += @description[0] + ": " if Help_Name == 1
text += @description[0] + "##" if Help_Name == 2
text += @description[3]
text.gsub!(/\n/, "")
@help_window.set_text(text, 0, 4, @description[4]) if $game_system.faction_data != []
end
end
end
# Window_Factions: End
#####################################
#-----------------------------------#
#####################################
# Faction info storage
class Game_System
attr_accessor :faction_data
alias old_initialize initialize
def initialize
old_initialize
@faction_data = SojaBird_Factions::Start_Factions
end
end
# Game_System: End
#####################################
#-----------------------------------#
#####################################
# Operating scene
class Scene_Factions < Scene_Base
def initialize(fac_list = 0)
@fac_list = fac_list
@max_lines = 304 / (SojaBird_Factions::Line_Height * 2)
end

def start
super
create_menu_background
create_factions_windows
end

def create_factions_windows
@faction_window = Window_Factions.new(0, 2*24+32, 544, 360-24, @fac_list)
@help_window = Window_Help_Factions.new(0, 0, 544, 2*24+32)
@faction_window.help_window = @help_window
end

def terminate
super
dispose_menu_background
dispose_factions_windows
end

def dispose_factions_windows
@faction_window.dispose
@help_window.dispose
end

def update
super
update_menu_background
update_factions_stuff
update_factions_input
end

def update_factions_stuff
@faction_window.update
@help_window.update
end

def update_factions_input
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Menu.new(4)
elsif Input.trigger?(Input::R) or Input.trigger?(Input::RIGHT)
if (@fac_list + 1) * @max_lines < $game_system.faction_data.size
Sound.play_cursor
next_fac_list
else
Sound.play_buzzer
end
elsif Input.trigger?(Input::L) or Input.trigger?(Input::LEFT)
if @fac_list > 0
Sound.play_cursor
prev_fac_list
else
Sound.play_buzzer
end
end
end

def next_fac_list
@fac_list += 1
$scene = Scene_Factions.new(@fac_list)
end

def prev_fac_list
@fac_list -= 1
$scene = Scene_Factions.new(@fac_list)
end
end
# Scene_Factions: End
#####################################
#-----------------------------------#
#####################################
# Add's an option to the menu
class Scene_Menu < Scene_Base
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = SojaBird_Factions::You_Name_It
s6 = Vocab::save
s7 = Vocab::game_end
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
if $game_party.members.size == 0 # If number of party members is 0
@command_window.draw_item(0, false) # Disable item
@command_window.draw_item(1, false) # Disable skill
@command_window.draw_item(2, false) # Disable equipment
@command_window.draw_item(3, false) # Disable status
end
if $game_system.save_disabled # If save is forbidden
@command_window.draw_item(4, false) # Disable save
end
end

def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2,3 # Skill, equipment, status
start_actor_selection
when 4 # Factions Menu
$scene = Scene_Factions.new
when 5 # Save
$scene = Scene_File.new(true, false, false)
when 6 # End Game
$scene = Scene_End.new
end
end
end
end
# Scene_Menu: End
#####################################
#-----------------------------------#
#####################################
# Add's display factions-array with F5
class Scene_Map < Scene_Base
alias old_update update
def update
old_update
if $TEST and Input.trigger?(Input::F5)
print_faction_data
end
end
end
# Scene_Map: End
#####################################
#-----------------------------------#
#####################################
# Fixes the return_scene for the file-scene
class Scene_File < Scene_Base
def return_scene
if @from_title
$scene = Scene_Title.new
elsif @from_event
$scene = Scene_Map.new
else
$scene = Scene_Menu.new(5)
end
end
end
# Scene_File: End
#####################################
#-----------------------------------#
#####################################
# Adjustable helpwindow height and text
class Window_Help_Factions < Window_Base
def initialize(x = 0, y = 0, width= 544, height = WLH + 32)
super(x, y, width, height)
end

def set_text(text, align = 0, x = 4, pic = "")
if text != @text or align != @align or x != @x or pic != @pic
self.contents.clear
self.contents.font.color = normal_color
rect = Rect.new(0, 0, Cache.picture(pic).width, 52)
if SojaBird_Factions::Help_Picture == true and pic != ""
y = 26 - (Cache.picture(pic).height / 2)
self.contents.blt(0, y, Cache.picture(pic), rect)
x += Cache.picture(pic).width
end
text = text.split(/\##/)
for string in 0..text.size - 1
self.contents.draw_text(x, string * WLH, self.width - 40, WLH, text.shift, align)
end
@text = text; @align = align; @x = x; @pic = pic
end
end
end
# Window_Help: End
#####################################
#-----------------------------------#
#####################################
# Enables to display reputation in messages
class Window_Message < Window_Selectable
alias old_convert_special_characters convert_special_characters

def convert_special_characters
old_convert_special_characters
@text.gsub!(/\\FAC\[(\w+)\]/i) { "\x10#{$~}" }
end

def update_message
loop do
c = @text.slice!(/./m)
case c
when nil
finish_message
break
when "\x00"
new_line
if @line_count >= MAX_LINE
unless @text.empty?
self.pause = true
break
end
end
when "\x01"
@text.sub!(/\[([0-9]+)\]/, "")
contents.font.color = text_color($1.to_i)
next
when "\x02"
@gold_window.refresh
@gold_window.open
when "\x03"
@wait_count = 15
break
when "\x04"
@wait_count = 60
break
when "\x05"
self.pause = true
break
when "\x06"
@line_show_fast = true
when "\x07"
@line_show_fast = false
when "\x08"
@pause_skip = true
#---------------------------------------NEW---#
when "\x10"
@text.sub(/\\FAC\[(\w+)\]/, "")
$game_system.faction_data.each do |data|
if data[0] == $1
@text.sub!(/\\FAC\[(\w+)\]/, data[2].to_s)
end
end
#---------------------------------------NEW---#
else
contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
c_width = contents.text_size(c).width
@contents_x += c_width
end
break unless @show_fast or @line_show_fast
end
end
end
# Window_Message: End
#####################################

Screenshoots :

Factions Pbucket

Installation : A placé au dessus de main ^^

Faq (pas traduite totalement ^^ )

Comment puis-je montrer une factionvalue dans un message?
La fonction de montrer une factionvalue dans le message, est très facile à utiliser. Tout ce que vous avez à faire, c'est mettre un \ code dans votre messageswindow. Le code que vous utilisez, est le suivant:
CODE
\ AEC [...]
Les points seront comblés avec la factionname (en "...") de celui que vous voulez montrer la valeur de.
[Afficher / Masquer] Par exemple,
Je veux montrer la valeur de la faction appelée Humains. Pour ce faire, je vais ajouter le code dans mon message. Le message pourrait ressembler à ceci:
CODE
La valeur de la faction \ c [2] L'homme \ c [0] \ [3] \ FAC [ "Humans"] \ c [0].
Le message affiché indique la valeur actuelle de la faction «Humains». (désolé pour la traduction plus approximative je suis noob en english ^^ ) .

Merci de mettre l'auteur de ce script dans vos crédits Wink
Masouf
Masouf
Membre

Nombre de messages : 284
Age : 25
Localisation : Rennes
Distinction : aucune
Date d'inscription : 24/12/2008

Factions Empty Re: Factions

le Sam 4 Avr 2009 - 14:17
Bonjour,
Je n'ai pas trop compris,
Sa veut dire quoi factions? confused
Zydd
Zydd
Membre

Nombre de messages : 114
Age : 36
Localisation : Pink City
Distinction : aucune
Date d'inscription : 07/07/2008

Factions Empty Re: Factions

le Sam 4 Avr 2009 - 14:26
Ben les factions c'est des gouvernements ou peuples différents . Plus tu gagne de points dans une faction plus tu occupe une place important auprès de la dite faction . Et donc plus tu es influent et peut avoir du soutien auprès d'elle . Attention l'inverse est vraie aussi Smile
Tommynator
Tommynator
Membre

Nombre de messages : 25
Distinction : aucune
Date d'inscription : 07/02/2009

Factions Empty Re: Factions

le Sam 4 Avr 2009 - 16:15
Sa pourrait être par exemple de la réputation, tu accomplis des quètes et tu gagne de la réputation envers une faction, si tu fait quelque chose de pas bien, tu perd de la réputation auprès d'une faction, enfin si c'est fait pour ça ^^
Masouf
Masouf
Membre

Nombre de messages : 284
Age : 25
Localisation : Rennes
Distinction : aucune
Date d'inscription : 24/12/2008

Factions Empty Re: Factions

le Sam 4 Avr 2009 - 16:19
Ok merci,
Ca deviens plus claire maintenant!
Contenu sponsorisé

Factions Empty Re: Factions

Revenir en haut
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum