# RECRUIT SHOPS
# By: Ixfuru
# version 1.1
# December 26th, 2012
#
################################################################################
# This script allows you to 'recruit' actors to the party by purchasing them at
# shops. The shops are a new scene, created by the script, which can be
# accessed at anytime by using a script call. This means going to the third
# tab of an event and selecting 'Script'. Then placing the following text into
# the window:
# $scene = Scene_Recruit.new(shop_id)
#
# You'll have to set up the 'shop_id's below. Once they are set up, just replace
# the 'shop_id' part of the script call with the id of the shop you want to
# access.
#
# This script has a great many customization options. It is very versatile in
# both the scene's appearance and that actors which can be recruited.
#
# The recruits (or actors) you acquire can be set up to be 'random'. That is,
# the pc will generate an actor from variables you set up in the module.
#
# To use the script, place it in the script editor, below Materials and above
# Main.
#
# Please take your time and make sure you read the instructions for the 6 parts
# of the script thoroughly. If you have questions, just post them under this
# scripts topic and I'll do my best to answer them, as well as adapt them to
# compatibility with other scripts and fix them when necessary.
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# THINGS YOU WILL REQUIRE
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# You need to get ModernAlgebra's script "ParagraphFormatter 2.0". You can find
# it here:
# http://rmrk.net/index.php/topic,25129.0.html
#
# By taking it, you'll have to make sure and credit him or arrange permission
# from him.
#
#-------------------------------------------------------------------------------
# Secondly, you can alter the windowskins of the shop scene by placing a new
# windowskin graphic in the Graphics\System folder of your project, and then
# setting the variable in SECTION 6. If you attained this script via the
# demo, you'll find that I have already placed a somewhat cheap windowskin that
# I created in the folder for you. It's not necessary for you to credit me for
# using the windowskin.
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#
# This AND every IXFURU script is the property of IXFURU. You cannot
# redistribute this script without his permission. You may alter it and use it
# for your own non-commercial projects at will provided that you give credit to
# him for the creation. Furthermore, if you choose to use this in a commercial
# game, you'll be required to contact IXFURU and gain his permission. He is
# NOT in anyway obligated to allow this script to be used in this manner. But
# is open to discussion.
#
#===============================================================================
# ADVANCED USE OF THE SCRIPT
#===============================================================================
# There are many script calls which can be used for this script. They can be
# used in conditional branches and other ways to get the most out of the script.
# They are as follows:
#
# 1) $game_actors[actor_id].is_random?
# This can be used in a conditional branch to see if the actor is a randomly
# generated one.
#
# 2) $game_actors[actor_id].is_male?, .is_female?, .is_beast?
# These can be used in a conditional branch to state whether the actor is
# one of the three 'types' of recruits. Male, Female or Beast (by default)
#
# 3) $game_actors[actor_id].regenerate_random(top_level)
# If the actor is random, this will regenerate them. That is, will transform
# them into a new actor altogether. This script call will transform the
# character, but will NOT change their 'type'.
#
# 4) $game_party.has_males?(amount), .has_females?(amount), .has_beasts?(amount)
# These script calls, to be used in a conditional branch, can check to see
# if there is 'amount' of the type of actors in your party.
#
# 5) $game_party.leader_is_male?, .leader_is_female?, .leader_is_beast?
# These script calls, in a conditional branch, will check to see if the
# leader is of a certain 'type'. For instance, it will return true for
# '.leader_is_beast?' if the leader is in fact a beast type.
#
# 6) $game_party.member_regenerate(position)
# If the member is a random actor, this will regenerate them, just as in
# the $game_actors script call. However, this is based on position of
# party member rather than actual actor's id.
#
#===============================================================================
module RecShops
##############################################################################
# CUSTOMIZATION STARTS HERE
##############################################################################
#-----------------------------------------------------------------------------
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# SECTION 1, Recruits
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#-----------------------------------------------------------------------------
# This section allows you to create the possibilities of your random recruits.
# It will allow you to change the random pool of names and classes of those
# recruits which will be generated at runtime.
#-----------------------------------------------------------------------------
RANDOM_RECRUIT_POOLS = {#<<<Don't delete this!
# For now, you MUST have three elements in the 'Type' array. I may expand on
# this further someday. Basically, this is just the text that will be displayed
# in any seen which shows a recruits, (or actor's) type. I set this up as not
# only a way to retrieve the strings (or double quoted words in the array), but
# to design a way to check for type in game. For now, unless you want to change
# what you call a male, female or beast, it would be best to skip this constant.
"Type" => ["male", "female", "beast"],
# In this array, add any class which your random recruits can be in. You do
# this by placing the class's database id in the array.
"Human_Classes" => [1, 2, 3, 4, 5, 6, 7, 8],
# This is the same as the human classes, but these are classes that beasts,
# or (third type from above) can be.
"Beast_Classes" => [9, 10, 11, 12],
# The names arrays contain possible names for the generated recruits. When a
# random recruit is created, the system will pull their names from these
# arrays, dependent upon which 'type' the random recruit is.
"Female_Names" => ["Hariett", "Joan", "Breidy", "Hannah", "Sola", "Lelle",
"Bertrude", "Farrah", "Lindsey", "Chyann", "Ruby", "Scarlet",
"Daye", "April", "Ciera"],
# The character arrays are the same as the names arrays, the system will
# create the character by giving them these character and face sets. Place
# the filename of a character set in your Graphics\Characters folder in
# the 1st position of the array, and the index of the character from that
# file you wish to use in the 2nd position.
#
#*****************************************************************************
# QUICK NOTE ON RANDOM CHARACTERS
#*****************************************************************************
# I may, in the future implement separating the character set from the face
# set. But for now, you MUST have a matching faceset to the character set
# you provide herein.
#*****************************************************************************
"Female_Characters" => { 0 => ["Actor1", 1],
1 => ["Actor1", 3],
2 => ["Actor1", 4],
3 => ["Actor1", 5],
4 => ["Actor2", 0],
5 => ["Actor2", 1],
6 => ["Actor2", 3],
7 => ["Actor2", 5],
8 => ["Actor2", 7],
9 => ["Actor3", 1],
10 => ["Actor3", 3],
11 => ["Actor3", 5],
12 => ["Actor3", 7]},
#-----------------------------------------------------------------------------
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# SECTION 2, Random Recruits
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#-----------------------------------------------------------------------------
# The following array holds the ids of actors who you want to set as 'random'
# recruits. Only place those actor_ids in the array which you want the
# pc to generate when they first appear in a shop.
##############################################################################
RANDOM_RECRUITS = [17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
#-----------------------------------------------------------------------------
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# SECTION 3, Pricing
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#-----------------------------------------------------------------------------
# Pricing in this system is based on two factors, class and experience level.
# Price of recruits are figured by multiplying their experience level by the
# value of their class.
#
# The generic pricing value is a backup for if you forget to place the
# class's id in the PRICE_PER_CLASS_LEVEL hash. This means that if a price
# for the class can't be found, the recruits price will be multiplied by the
# value you set here.
#-----------------------------------------------------------------------------
GENERIC_PRICING = 300
#-----------------------------------------------------------------------------
# In the next hash, you will give a price to each class. This means that for
# every experience level the recruit is, their price will be multiplied by
# the amount given.
#
# Use this formula:
#
# class_id => price_per_level,
#
# EXAMPLE:
#
# 4 => 900,
#
# In the example above we value a recruit whose class is class number 4 in the
# database, at 900 gold. This means that if you were to try and recruit an
# actor with a level of 6 in this class, it would cost you 5400 gold. At level
# 2, it would cost 1800.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# SECTION 4, Shops
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#-----------------------------------------------------------------------------
# The following hash is used to set up recruits. A recruit is just an actor
# from the database, but here you can set up the specific shops and the recruits
# available to that shop. You can call these shops from the game by placing
# this script call inside a script command (3rd Tab of Events):
# $scene = Scene_Recruit.new(shop_id)
# The shop_id should be replaced with a key from the hash below. That is, the
# number to the left of the '=>'.
#
# In the hash, use this formula:
# shop_id => {"shop_name" => string,
# "seller_face" => filename, index,
# "seller_name" => string,
# "use_variable" => [boolean, value],
# "use_random" => [value, boolean],
# "recruits" => variable_value => [recruit_ids]},
#
# This inner hash should retain its keys. The only part you need to adjust
# will be the item right of the '=' sign.
#
# "shop_id": Must be unique and in numerical order. (requires integer)
# "shop_name": Any name, encompassed with ("") double quotes, you wish to
# name the shop. (requires string)
# "seller_face": This array allows you to determine which face file is used
# for the given shop. Just replace the filename part with
# a file from your Graphics\Faces folder. And the index part
# with the index of which face on the file you wish to show.
# "seller_name": This requires a string, like in the shop_name, which will
# be used as a display for the shopkeeper's name.
# "use_variable": This array starts with a boolean (true or false), which is
# used to state whether the shop uses a variable in order to
# make different actors recruitable at different times. If
# the boolean is true, you need to set the value following the
# boolean to a game variable to be used. If you set the boolean
# to false, then just place a '0' in the variable position.
# "use_random": This is a two position array which will be used when
# generating random actors (recruits). Replace the value,
# with a number to indicate the highest possible level the
# generated actor can be. Then, replace the boolean with
# whether or not you want to include the 'beast' type in the
# generation. When this is false, only males or females will
# be created.
# "recruits": This hash will contain arrays of the recruits you want to
# be available in the shop. If you set the '"use_variable"' to
# false, just use an array instead of a hash, use '0' as the
# variable_value.
#
# Because I understand this script may be a little perplexing to those who are
# not quite scripters, I'll show a few examples here and try to explain them
# step by step.
#
# EXAMPLE 1:
# 12 => {"shop_name" => "Richard's Recruits",
# "seller_face" => ["People1", 4],
# "use_variable" => [false, 0],
# "use_random" => [3, false],
# "recruits" => {nil => [14, 10, 8, 7, 26, 4]}},
#
# In Example 1, you see that the shop has an ID of 12. This means, when you
# call the scene, you will place '12' as the argument for the scene, like
# this:
# $scene = Scene_Recruit.new(12)
#
# We called this recruit shop "Richard's Recruits", therefor that's the name
# which will be displayed when you are in the Recruit Scene.
#
# We told the system to show the People1, index 4, for the seller's face.
#
# For "use_variable" we chose false, which basically tells us that this shop
# will ALWAYS have the same actors for recruit, and does not depend upon an
# in game variable's value to determine its recruit inventory. We place the
# zero '0' in the second position, because we chose false in the 1st.
#
# In the use_random key, we have another two position array.
# We set the 1st position of the array to '3' to signify, the level limit
# on randomly created recruits. Then we set the second position to 'false',
# stating that we don't want to generate 'beasts' in this shop.
#
# Finally, for the recruits hash, we just used a '0' for a hash key, signifying
# that these recruit_ids will never change, and therefor we don't need different
# recruits found when a variable holds a specific value. Then, we merely filled
# the array with ids of actors in the database which we will find for recruitment
# in this recruit shop.
#
# EXAMPLE 2:
# 9 => {"shop_name" => "The Scrapyard",
# "seller_face" => ["People3", 4]
# "use_variable" => [true, 7],
# "use_random" => [13, true],
# "recruits" => {0 => [14, 6, 3, 18, 121],
# 1 => [5, 9, 23, 17, 6, 15, 4, 8],
# 2 => [64, 54, 12, 7, 3]}},
#
# In Example 2, we used the ID of '9'. This means, we will use the script
# call:
# $scene = Scene_Recruit.new(9)
#
# We named the shop 'The Scrapyard'.
#
# We set the seller's face to People3, index 4.
#
# For "use_variable", we placed 'true' in the first position of the array.
# This means that we will base which recruits are available in this shop based
# on the game variable we provided. In this case, the 7. So, which recruits
# are available at this shop is dependent upon the value of variable 7.
#
# Next, in the use_random section, we start off by telling
# the system, via the '13' in the 1st position of the array that when
# generating random recruits for this shop, that we don't want any recruits
# whose experience level is above 13. Finally, the 'true' tells us, this
# shop has the ability to randomly generate beast-type recruits in the
# third position.
#
# Finally, we set up the recruits hash with three different keys (0, 1, 2).
# These numbers represent the value of the in game variable (which is number
# 7 according to this example). That means that when variable 7 has a value
# of 0, then those recruits listed after the '0 =>' will be found in the shop.
# When the value is 1, then those in the array of the '1' hashkey will be
# in the shop. And the same applies for 2. This is awesome, because it lets
# us change available recruits based on the value of an in game variable. And
# because, each shop has it's own unique variable, You can make a specific
# recruit 'travel' from shop to shop. Showing up in one shop at
# one point, and at another some other time. You can also make the same
# recruit available at both shops at the same time.
#
# &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
# & AN IMPORTANT NOTE ON RANDOM RECRUITS
# &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
# When an actor (recruit) is generated, he/she is flagged as such. This means
# that the actor will retain this generated status for as long as they are
# available, unless they are 'unset'. As a bonus, I placed the ability to
# script call the '$game_actors[actor_id].unset_actor' method. This will
# make it so the given actor will be altered again upon visiting a random
# shop with his/her id found in the recruits.
#
# You should realize that because they retain their 'set' status unless
# manually unset, they will not be regenerated when they show up in a new
# shop at a later time.
# &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
#-----------------------------------------------------------------------------
RECRUIT_SHOPS = {#<<<Don't delete this!
0 => {"shop_name" => "Littletown Services",#<<<Don't forget the commas!
"seller_face" => ["People3", 3],
"seller_name" => "Ribby Joe",
"use_variable" => [false, 0],
"use_random" => [0, false],
"recruits" => {0 => [5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]}},#<<Don't
#forget to use the
#double '}}' to end
#the recruits!!
#-----------------------------------------------------------------------------
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# SECTION 5, Unrandom Types
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#-----------------------------------------------------------------------------
#
# Here you will declare, in the last hash, any actors which will be joining
# the party WITHOUT coming from a shop. For example, the ones that start in
# your party. Also, those you will be setting up for non-random shops should
# be included in this hash.
#
# This is important, because it allows your unrecruited and
# non-random actors to inherit the recruitable stat 'type', which you can then
# use in conditional branches throughout the game. Use this formula to set
# it up:
#
# actor_id => type
#
# By default, these types are 0 for male, 1 for female, 2 for beast. You can
#-----------------------------------------------------------------------------
UNRANDOM_TYPES = {#<<<Don't delete this!
#-----------------------------------------------------------------------------
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# SECTION 6, Extras
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#-----------------------------------------------------------------------------
# In this section, you'll set up a number of constants which alter things like
# color of text, windowskins, etc. All of which are provided to make the
# scene more customizable.
#-----------------------------------------------------------------------------
SHOP_NAME_COLOR = 12 # Color of text in Shop's Name
# SELLER TEXT DISPLAYS:
# These arrays hold various possible quotes the seller of the shop will tell
# you dependent upon what you are doing in the shop.
# This is the text shown as you enter the shop.
SELLER_RANDOM_GREETING = ["Searching for a recruit? You've come to the right place",
"Hello there, traveler. How can I help you?",
"Here for a new party member? Glad to be of service.",
"Looks like you could use some help. Take a look."]
# This is the text shown while you are browsing.
SELLER_RANDOM_VIEWING = ["Take your time.", "I'm sure you'll find what you need.",
"There's no better recruits anywhere."]
# This is the text shown when you purchase something.
SELLER_RANDOM_SELLING = ["You've made a wise purchase.", "Thank you.",
"I'm sure this recruit will help you.",
"That's the one I had in mind for you."]
# This is the text shown when you leave.
SELLER_RANDOM_LEAVING = ["See you soon.", "Take it easy.", "Be careful out there.",
"Come again."]
# This is the text shown when you don't have enough gold to purchase a recruit
SELLER_RANDOM_SHORTFUNDS = ["I would love to sell you this recruit. But you are short on funds.",
"Maybe when you have the correct amount of funds.", "Are you joking?",
"Hmm... Go and get more funds."]
# This is the text shown when you attempt to purchase recruit when party is full
SELLER_RANDOM_PARTYFULL = ["You can't buy this recruit when you have a full party.",
"But your party is already full.",
"Come back when you have room for this recruit."]
# This is the text shown when you are in an empty shop and choose "Shop"
SELLER_RANDOM_SHOPEMPTY = ["As you can see, I have nothing more to offer.",
"I'd like to help. But I have no recruits.",
"Sorry. There are no recruits available."]
SELLER_NAME_COLOR = 20 #Color of Seller's name
SHOP_COMMAND_SHOP = "Shop" # this is used for the command saying you want to buy
SHOP_COMMAND_LEAVE = "Exit" # this is used for the command saying you want to leave
SHOP_COMMAND_COLOR = 3 # this is the color of the shop commands
# This is the windowskin you want to use for all the shop scenes. Make sure
# you place it within your Graphics\System folder
SHOPSKIN = "RecShopSkin"
SHOP_SE_SELECT = "Ice1" # Sound effect played when decision is made
SHOP_SE_BACK = "Cancel" # Sound effect played when cancelling or leaving
SHOP_SE_PURCHASE = "Saint9" # Sound effect played when purchase is made
RECRUIT_NAME_COLOR = 10 #Color of text for recruit's name in preview window
RECRUIT_CLASS_COLOR = 25 #Color of text for recruit's class
RECRUIT_LEVEL_COLOR = 6 #Color of text for recruit's level
RECRUIT_TYPE_COLOR = 15
RECRUIT_PRICE_COLOR = 14 #Color of text for recruit's price
RECRUIT_GOLD_ICON = 205 #Icon from Iconset used to display price of recruit
PARAMETER_TAG_COLOR = 7 #Color of parameter tags (abbreviations)
RECRUIT_PARAMETER_COLOR = 29 #Color of recruit's parameter values
USE_SHOP_BGM = true #if 'true', the Background music you select below will play
#while you are browsing in the Recruit Shop Scene.
SHOP_BGM = "Scene7" #The background music which will play if the above is true
end
################################################################################
# END OF CUSTOMIZATION:
# Don't alter below unless you know what you are doing!
################################################################################
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
################################################################################
# Game Temp Class
################################################################################
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
class Game_Temp
attr_accessor :recshop_id
alias recshops_gt_initialize initialize unless $@
def initialize
recshops_gt_initialize
@recshop_id = 0
end
end
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Game Actor Class
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
class Game_Actor < Game_Battler
alias rs_ga_setup setup unless $@
def setup(actor_id)
rs_ga_setup(actor_id)
@type = nil
@is_set = false
get_is_random
set_recruit_price
nonrand = UNRANDOM_TYPES.keys
unless @is_random
if nonrand.include?(actor_id)
@type = UNRANDOM_TYPES[actor_id]
else
@type = 0
@is_set = true
end
end
end
def get_is_random
if RANDOM_RECRUITS.include?(self.id)
@is_random = true
else
@is_random = false
end
end
# Method can be used in conditional branch
def is_random?
if @is_random
return true
else
return false
end
end
# Method can be used in conditional branch.
def is_male?
if @type == 0
return true
else
return false
end
end
# Method can be used in conditional branch.
def is_female?
if @type == 1
return true
else
return false
end
end
# Method can be used in conditional branch.
def is_beast?
if @type == 2
return true
else
return false
end
end
#Method generates a random recruit, accepts argument for beast type inclusion
def produce_random_recruit(level, using_beasts = false)
set_recruit_type(using_beasts) #passes whether or not to use beasts
set_recruit_class(@type) #passes type of recruit
set_recruit_level(level)
set_recruit_name(@type)
set_recruit_character(@type)
@is_set = true
end
#Method chooses an appropriate type
def set_recruit_type(beast)
if beast
@type = rand(2)
else
@type = rand(1) #either male or female
end
end
#Method chooses appropriate class, accepts argument of recruit type
def set_recruit_class(type)
if type < 2 #if type is human
pos = RANDOM_RECRUIT_POOLS["Human_Classes"] #get possible human classes
elsif type == 2 #if type is beast
pos = RANDOM_RECRUIT_POOLS["Beast_Classes"] #get possible beast classes
end
@class_id = pos[rand(pos.size - 1)] #choose a class
for i in 0..4 # Remove equippable items
change_equip(i, nil)
end
end
#Method chooses appropriate name, accepts argument of recruit type
def set_recruit_name(type)
case type
when 0
pos = RANDOM_RECRUIT_POOLS["Male_Names"]
when 1
pos = RANDOM_RECRUIT_POOLS["Female_Names"]
when 2
pos = RANDOM_RECRUIT_POOLS["Beast_Names"]
end
@name = pos[rand(pos.size - 1)]
end
#Method chooses appropriate character and face set, accepts argument of type
def set_recruit_character(type)
case type
when 0
pos = RANDOM_RECRUIT_POOLS["Male_Characters"]
when 1
pos = RANDOM_RECRUIT_POOLS["Female_Characters"]
when 2
pos = RANDOM_RECRUIT_POOLS["Beast_Characters"]
end
set = pos[rand(pos.size - 1)]
@character_name = set[0]
@character_index = set[1]
@face_name = set[0]
@face_index = set[1]
end
#Method chooses an appropriate level
def set_recruit_level(top_lv)
lv = rand(top_lv)
self.change_level(lv, false)
end
#Method can be called from script call
def regenerate_random(top_level)
unpos = UNRANDOM_TYPES.keys #only if actor is a random
unless unpos.include?(@id)
if @type == 2
produce_random_recruit(top_level)
else
produce_random_recruit(top_level, false)
end
end
end
#Method sets price of actors (recruits)
def set_recruit_price
if PRICE_PER_CLASS_LEVEL.include?(@class_id)
@price = PRICE_PER_CLASS_LEVEL[@class_id]
@price *= @level
else
@price = GENERIC_PRICING
@price *= @level
end
end
#Method makes a new actor 'taken'
def make_taken
@taken = true
end
#Method makes new actor untaken, enabling resale of actor
def make_untaken
@taken = false
end
#Method makes actor 'unset', allowing them to be regenerated by shops
def unset_actor
if RANDOM_RECRUITS.include?(self.id) && @is_set
@is_set = false
end
end
end
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
################################################################################
# GAME PARTY CLASS
################################################################################
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
class Game_Party < Game_Unit
include RecShops
# This is an OVERWRITTEN METHOD, this implements the 'taken' variable to
# actors in the initial party.
def setup_starting_members
@actors = []
for i in $data_system.party_members
@actors.push(i)
$game_actors[i].make_taken
end
end
#This is an OVERWRITTEN METHOD, this causes added actors to have a 'true'
# taken variable value.
def add_actor(actor_id)
if @actors.size < MAX_MEMBERS and not @actors.include?(actor_id)
@actors.push(actor_id)
$game_player.refresh
$game_actors[actor_id].make_taken
end
end
#Aliased method of removing actor from party
alias recshops_gp_remove_actor remove_actor unless $@
def remove_actor(actor_id)
recshops_gp_remove_actor(actor_id)
$game_actors[actor_id].make_untaken
end
#Method used to determine if party is full (returns a boolean)
def party_is_full
if @actors.size < MAX_MEMBERS
return false
else
return true
end
end
#Method can be called from conditional branch
def has_males?(amount)
mm = 0
for actor in members
if actor.type == 0 #if actor is a male
mm += 1
end
end
if mm >= amount # if there is an adequate amount of males
return true
else
return false
end
end
#Method can be called from conditional branch
def has_females?(amount)
fm = 0
for actor in members
if actor.type == 1 # if actor is a female
fm += 1
end
end
if fm >= amount # if there is an adequate amount of females
return true
else
return false
end
end
#Method can be called from conditional branch
def has_beasts?(amount)
bm = 0
for actor in members
if actor.type == 2 #if member is a beast
bm += 1
end
end
if bm >= amount # if there is an adequate amount of beasts
return true
else
return false
end
end
#Method can be called from conditional branch
def leader_is_male?
if members[0].type == 0 #if leader is male
return true
else
return false
end
end
#Method can be called from conditional branch
def leader_is_female?
if members[0].type == 1 #if leader is female
return true
else
return false
end
end
#Method can be called from conditional branch
def leader_is_beast?
if members[0].type == 2 #if leader is beast
return true
else
return false
end
end
#Method can be called from script call
def member_regenerate(position)
impos = UNRANDOM_TYPES.keys
unless impos.include?(members[position].id)
if members[position].type == 2
members[position].produce_random_recruit(true)
else
members[position].produce_random_recruit
end
end
end
end
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
################################################################################
# WINDOW BASE CLASS
################################################################################
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
class Window_Base < Window
include RecShops
def draw_recruit_price(recruit_id, x, y)
price = $game_actors[recruit_id].price
if $game_party.gold >= price
enabled = true
else
enabled = false
end
draw_icon(RECRUIT_GOLD_ICON, x, y, enabled)
self.contents.font.color = text_color(RECRUIT_PRICE_COLOR)
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 30, y, self.width, WLH, price.to_s)
end
end
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
################################################################################
# WINDOW GOLD CLASS
################################################################################
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
class Window_Gold < Window_Base
include RecShops
alias recshop_wg_initialize initialize unless $@
def initialize(x, y)
if $scene.is_a?(Scene_Recruit)
super(x, y, 162, 80)
self.windowskin = Cache.system(SHOPSKIN)
refresh
else
recshop_wg_initialize(x, y)
end
end
alias recshop_wg_refresh refresh unless $@
def refresh
if $scene.is_a?(Scene_Recruit)
self.contents.clear
draw_currency_value($game_party.gold, 4, 15, 120)
else
recshop_wg_refresh
end
end
end
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
################################################################################
# WINDOW RECRUIT SHOP NAME CLASS
################################################################################
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
class Window_RecruitShopName < Window_Base
include RecShops
def initialize(id)
super(285, 0, 260, 80)
@id = id
self.windowskin = Cache.system(SHOPSKIN)
refresh
end
def initialize(x, y, width, height)
super(x, y, width, height)
self.windowskin = Cache.system(SHOPSKIN)
@shop_id = $game_temp.recshop_id
get_shop_variable
get_recruit_ids
get_random_recruits
get_commands
@item_max = @commands.size
refresh
end
def get_shop_variable
if RECRUIT_SHOPS[@shop_id]["use_variable"][0]
var = RECRUIT_SHOPS[@shop_id]["use_variable"][1]
@shopvar = $game_variables[var]
else
@shopvar = 0
end
end
def get_recruit_ids
@recruit_ids = RECRUIT_SHOPS[@shop_id]["recruits"][@shopvar]
for i in @recruit_ids
if $game_actors[i].taken
@recruit_ids.delete(i)
end
end
end
def get_random_recruits
top_lv = RECRUIT_SHOPS[@shop_id]["use_random"][0]
beasts = RECRUIT_SHOPS[@shop_id]["use_random"][1]
for i in @recruit_ids
if $game_actors[i].is_random
unless $game_actors[i].is_set
$game_actors[i].produce_random_recruit(top_lv, beasts)
$game_actors[i].set_recruit_price
end
end
end
end
def get_commands
@commands = []
for i in @recruit_ids
@commands.push($game_actors[i].name)
end
end
def refresh
self.contents.clear
create_contents
for i in 0...@item_max
draw_items(i)
end
end
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
################################################################################
# SCENE RECRUIT CLASS
################################################################################
#0000000000000000000000000000000000000000000000000000000000000000000000000000000
class Scene_Recruit < Scene_Base
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum