Spoiler
dato tale script è possibile modificarlo per far si che invece di cambiare personaggio cambiasse classe? grazie in anticipo
# =============================================================================
# Actor Selection Script
# Author: Omegas7
# Version: 1.0
# Site: http://omegadev.forumn.net
# -----------------------------------------------------------------------------
# This script will open a menu for the player to choose a character. Said
# character will be added to the party.
# There are many useful commands that will let you edit the selectable
# characters list. Good for game starts etc.
# -----------------------------------------------------------------------------
# Features:
# * Graphical menu with nice fading effects =D
# * Add/Remove X actor to the selectable list
# * Remove the last chosen actor
# * Set default selectable actors for the start of the game.
# * Description box for the actors [optional]
# * Picture preview for the actors [optional]
# * Character preview for the actors [optional]
# -----------------------------------------------------------------------------
# Instructions:
# Below is the configuration area.
# Default_Selectable_Actors is an array telling what actors (id) will be
# selectable from the very start of the game.
# Next is the Pictures hash. Some actors may have a picture that represents
# them, in that case, put the picture in the Pictures folder, then come
# to the hash and add
# id => 'PicName'
# id is the ID number of the actor
# 'PicName' is the name of the picture in the Pictures folder. Remember
# to put the name inside quotes " " or ' '
# The picture will be placed on the bottom right of the menu.
# The picture is optional, some actors may have and others not.
#
# Now here we got the Descriptions section. This is also optional for
# the actors. The description is a block of text shown in the left area
# of the menu. When you want an actor to have a description block,
# put this:
# Descriptions[ID] = ["Line","Line","Line"]
# ID is the ID number of the actor.
# "Line" is one text line or sentence of the block. It is inside quotes
# " " or ' '.
# You can put as many lines as you want, each separated by a comma.
# -----------------------------------------------------------------------------
# Script call commands for editing the selectable actors listing:
# Use these script commands in an event "Script call":
# $game_party.add_selectable(ID)
# $game_party.remove_selectable(ID)
# $game_party.remove_last_actor_selected
# $game_party.remove_all
#
# ID would be the actor ID. Don't worry, if you add an actor multiple
# times, the actor will still only appear once.
# -----------------------------------------------------------------------------
# WARNING
# -----------------------------------------------------------------------------
# This script can only work if there is at least one selectable actor in
# the listing. Otherwise, it will send an error if called (which makes sense).
# There is one script command you can put in a conditional branch for knowing
# if there is at least one actor in the selectable listing:
# $game_party.selectable.size > 0
# The conditional branch will return TRUE if there is someone in the listing,
# and FALSE if there is no one.
# =============================================================================
module OmegaX
module Character_Selection
Default_Selectable_Actors = [2,3,4]
Descriptions = [] # <- Don't edit this line
Pictures = {
1 => 'RalphPic',
2 => 'UlrikaPic',
3 => 'BennettPic',
4 => 'YlvaPic'
}
Descriptions[1] = ["Ralph De Cookie is the powerful",
"knight that serves the king Omega VII",
"with heroic missions and saving",
"the kingdom from evil. He likes cookies and",
"Ulrika. He hates Bennett."]
Descriptions[2] = ["Ulrika The Character, is a game character.",
"She is playable. She has stats. She has",
"a story. She is, a character.",
"She is deeply in love for Bennett. That",
"must mean only one thing: She is a girl, and",
"probably have feelings. Ralph likes her.",
"But she doesn't, so it seems Ulrika is also",
"evil."]
Descriptions[3] = ["Bennett The Chaotic is another loyal",
"servant of the great king Omega VII,",
"and his reputation is almost as high as",
"Ralph's.",
"",
"Bennet dislikes cookies. That's why he is",
"chaotic and evil."]
Descriptions[4] = ["Ylva The Cookie Hunter is an advanced",
"aggressive cookie hunter, hired to catch",
"every innocent cookie in the land. She sells",
"the cookies she catches for a lot of gold, and",
"uses it to melt it into the legendary golden cookie.",
"",
"",
"The golden cookie is just a myth... or maybe not.",
"Only the most advanced cookie alchemists know",
"about it. They say it tastes delicious though."]
end
end
class Character_Selection < Scene_Base
include OmegaX::Character_Selection
def initialize
@selectable = $game_party.selectable
@bg = Sprite_Base.new
@bg.bitmap = Cache.system('CharSelectionBG')
@bg.z = 100
@pictures = []
create_picture(260,65,'Character',@selectable[0])
if Pictures[@selectable[0]] != nil
create_picture(0,0,'Preview',@selectable[0])
end
@pictures.push(Character_Selection_Window.new(@selectable[0]))
@index = 0
end
def create_picture(x,y,type,id)
@pictures.push(Character_Selection_Picture.new(x,y,type,id))
end
def update
for i in [email protected]
@pictures[i].update
if @pictures[i].done
@pictures[i] = nil
end
end
@pictures.compact!
if Input.trigger?(Input::RIGHT) && @selectable.size > 1
@index += 1
@index = 0 if @index > (@selectable.size - 1)
change_pics
elsif Input.trigger?(Input::LEFT) && @selectable.size > 1
@index -= 1
@index = (@selectable.size - 1) if @index < 0
change_pics
end
if Input.trigger?(Input::C)
Sound.play_decision
$game_party.add_actor(@selectable[@index])
$game_party.last_actor = (@selectable[@index])
finish
end
end
def change_pics
Sound.play_cursor
for i in [email protected]
@pictures[i].appearing = false
end
@pictures.push(Character_Selection_Window.new(@selectable[@index]))
create_picture(260,65,'Character',@selectable[@index])
if Pictures[@selectable[@index]] != nil
create_picture(0,0,'Preview',@selectable[@index])
end
end
def finish
for i in [email protected]
@pictures[i].finish
@pictures[i] = nil
end
@pictures.compact!
@bg.dispose
$scene = Scene_Map.new
end
end
class Game_Party
include OmegaX::Character_Selection
attr_accessor :selectable
attr_accessor :last_actor
alias omega_character_selection_init initialize
def initialize
omega_character_selection_init
@selectable = Default_Selectable_Actors
@last_actor = nil
end
def add_selectable(id)
@selectable.push(id) if !(@selectable.include?(id))
end
def remove_selectable(id)
@selectable.delete(id) if (@selectable.include?(id))
end
def remove_last_actor_selected
remove_selectable(@last_actor)
end
def remove_all
@selectable = []
end
end
class Character_Selection_Picture
include OmegaX::Character_Selection
attr_reader :done
attr_accessor :appearing
def initialize(x,y,type,id)
@sprite = Sprite_Base.new
if type == 'Character'
bitmap = Cache.character($game_actors[id].character_name)
sign = $game_actors[id].character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
@sprite.bitmap = Bitmap.new(cw,ch)
else
cw = bitmap.width / 12
ch = bitmap.height / 8
@sprite.bitmap = Bitmap.new(cw,ch)
end
n = $game_actors[id].character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
@sprite.bitmap.blt(0, 0, bitmap, src_rect)
@sprite.x = x
@sprite.y = y
elsif type == 'Preview'
@sprite.bitmap = Cache.picture(Pictures[id])
@sprite.x = 544 - @sprite.width
@sprite.y = 416 - @sprite.height
end
@sprite.z = 101
@sprite.opacity = 0
@appearing = true
@done = false
end
def update
if (@appearing && @sprite.opacity < 255)
@sprite.opacity += 12
end
if (!@appearing && @sprite.opacity > 0)
@sprite.opacity -= 12
finish if @sprite.opacity <= 0
end
end
def finish
@sprite.dispose
@sprite = nil
@done = true
end
end
class Character_Selection_Window
include OmegaX::Character_Selection
attr_reader :done
attr_accessor :appearing
def initialize(id)
@window = Window_Base.new(0,160,360,416 - 160)
@window.z = 102
@window.opacity = 0
@appearing = true
@done = false
@window.contents.font.size = 17
@window.contents.draw_text(0,0,340,20,$game_actors[id].name)
@window.contents_opacity = 0
@window.opacity = 0
@window.contents.font.size = 14
if Descriptions[id] != nil
for i in 0...Descriptions[id].size
@window.contents.draw_text(0,16*i + 30,340,16,Descriptions[id][i].to_s)
end
end
end
def update
if (@appearing && @window.opacity < 255)
@window.contents_opacity += 12
end
if (!@appearing && @window.contents_opacity > 0)
@window.contents_opacity -= 12
finish if @window.contents_opacity <= 0
end
end
def finish
@window.dispose
@window = nil
@done = true
end
end
# Actor Selection Script
# Author: Omegas7
# Version: 1.0
# Site: http://omegadev.forumn.net
# -----------------------------------------------------------------------------
# This script will open a menu for the player to choose a character. Said
# character will be added to the party.
# There are many useful commands that will let you edit the selectable
# characters list. Good for game starts etc.
# -----------------------------------------------------------------------------
# Features:
# * Graphical menu with nice fading effects =D
# * Add/Remove X actor to the selectable list
# * Remove the last chosen actor
# * Set default selectable actors for the start of the game.
# * Description box for the actors [optional]
# * Picture preview for the actors [optional]
# * Character preview for the actors [optional]
# -----------------------------------------------------------------------------
# Instructions:
# Below is the configuration area.
# Default_Selectable_Actors is an array telling what actors (id) will be
# selectable from the very start of the game.
# Next is the Pictures hash. Some actors may have a picture that represents
# them, in that case, put the picture in the Pictures folder, then come
# to the hash and add
# id => 'PicName'
# id is the ID number of the actor
# 'PicName' is the name of the picture in the Pictures folder. Remember
# to put the name inside quotes " " or ' '
# The picture will be placed on the bottom right of the menu.
# The picture is optional, some actors may have and others not.
#
# Now here we got the Descriptions section. This is also optional for
# the actors. The description is a block of text shown in the left area
# of the menu. When you want an actor to have a description block,
# put this:
# Descriptions[ID] = ["Line","Line","Line"]
# ID is the ID number of the actor.
# "Line" is one text line or sentence of the block. It is inside quotes
# " " or ' '.
# You can put as many lines as you want, each separated by a comma.
# -----------------------------------------------------------------------------
# Script call commands for editing the selectable actors listing:
# Use these script commands in an event "Script call":
# $game_party.add_selectable(ID)
# $game_party.remove_selectable(ID)
# $game_party.remove_last_actor_selected
# $game_party.remove_all
#
# ID would be the actor ID. Don't worry, if you add an actor multiple
# times, the actor will still only appear once.
# -----------------------------------------------------------------------------
# WARNING
# -----------------------------------------------------------------------------
# This script can only work if there is at least one selectable actor in
# the listing. Otherwise, it will send an error if called (which makes sense).
# There is one script command you can put in a conditional branch for knowing
# if there is at least one actor in the selectable listing:
# $game_party.selectable.size > 0
# The conditional branch will return TRUE if there is someone in the listing,
# and FALSE if there is no one.
# =============================================================================
module OmegaX
module Character_Selection
Default_Selectable_Actors = [2,3,4]
Descriptions = [] # <- Don't edit this line
Pictures = {
1 => 'RalphPic',
2 => 'UlrikaPic',
3 => 'BennettPic',
4 => 'YlvaPic'
}
Descriptions[1] = ["Ralph De Cookie is the powerful",
"knight that serves the king Omega VII",
"with heroic missions and saving",
"the kingdom from evil. He likes cookies and",
"Ulrika. He hates Bennett."]
Descriptions[2] = ["Ulrika The Character, is a game character.",
"She is playable. She has stats. She has",
"a story. She is, a character.",
"She is deeply in love for Bennett. That",
"must mean only one thing: She is a girl, and",
"probably have feelings. Ralph likes her.",
"But she doesn't, so it seems Ulrika is also",
"evil."]
Descriptions[3] = ["Bennett The Chaotic is another loyal",
"servant of the great king Omega VII,",
"and his reputation is almost as high as",
"Ralph's.",
"",
"Bennet dislikes cookies. That's why he is",
"chaotic and evil."]
Descriptions[4] = ["Ylva The Cookie Hunter is an advanced",
"aggressive cookie hunter, hired to catch",
"every innocent cookie in the land. She sells",
"the cookies she catches for a lot of gold, and",
"uses it to melt it into the legendary golden cookie.",
"",
"",
"The golden cookie is just a myth... or maybe not.",
"Only the most advanced cookie alchemists know",
"about it. They say it tastes delicious though."]
end
end
class Character_Selection < Scene_Base
include OmegaX::Character_Selection
def initialize
@selectable = $game_party.selectable
@bg = Sprite_Base.new
@bg.bitmap = Cache.system('CharSelectionBG')
@bg.z = 100
@pictures = []
create_picture(260,65,'Character',@selectable[0])
if Pictures[@selectable[0]] != nil
create_picture(0,0,'Preview',@selectable[0])
end
@pictures.push(Character_Selection_Window.new(@selectable[0]))
@index = 0
end
def create_picture(x,y,type,id)
@pictures.push(Character_Selection_Picture.new(x,y,type,id))
end
def update
for i in [email protected]
@pictures[i].update
if @pictures[i].done
@pictures[i] = nil
end
end
@pictures.compact!
if Input.trigger?(Input::RIGHT) && @selectable.size > 1
@index += 1
@index = 0 if @index > (@selectable.size - 1)
change_pics
elsif Input.trigger?(Input::LEFT) && @selectable.size > 1
@index -= 1
@index = (@selectable.size - 1) if @index < 0
change_pics
end
if Input.trigger?(Input::C)
Sound.play_decision
$game_party.add_actor(@selectable[@index])
$game_party.last_actor = (@selectable[@index])
finish
end
end
def change_pics
Sound.play_cursor
for i in [email protected]
@pictures[i].appearing = false
end
@pictures.push(Character_Selection_Window.new(@selectable[@index]))
create_picture(260,65,'Character',@selectable[@index])
if Pictures[@selectable[@index]] != nil
create_picture(0,0,'Preview',@selectable[@index])
end
end
def finish
for i in [email protected]
@pictures[i].finish
@pictures[i] = nil
end
@pictures.compact!
@bg.dispose
$scene = Scene_Map.new
end
end
class Game_Party
include OmegaX::Character_Selection
attr_accessor :selectable
attr_accessor :last_actor
alias omega_character_selection_init initialize
def initialize
omega_character_selection_init
@selectable = Default_Selectable_Actors
@last_actor = nil
end
def add_selectable(id)
@selectable.push(id) if !(@selectable.include?(id))
end
def remove_selectable(id)
@selectable.delete(id) if (@selectable.include?(id))
end
def remove_last_actor_selected
remove_selectable(@last_actor)
end
def remove_all
@selectable = []
end
end
class Character_Selection_Picture
include OmegaX::Character_Selection
attr_reader :done
attr_accessor :appearing
def initialize(x,y,type,id)
@sprite = Sprite_Base.new
if type == 'Character'
bitmap = Cache.character($game_actors[id].character_name)
sign = $game_actors[id].character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
cw = bitmap.width / 3
ch = bitmap.height / 4
@sprite.bitmap = Bitmap.new(cw,ch)
else
cw = bitmap.width / 12
ch = bitmap.height / 8
@sprite.bitmap = Bitmap.new(cw,ch)
end
n = $game_actors[id].character_index
src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
@sprite.bitmap.blt(0, 0, bitmap, src_rect)
@sprite.x = x
@sprite.y = y
elsif type == 'Preview'
@sprite.bitmap = Cache.picture(Pictures[id])
@sprite.x = 544 - @sprite.width
@sprite.y = 416 - @sprite.height
end
@sprite.z = 101
@sprite.opacity = 0
@appearing = true
@done = false
end
def update
if (@appearing && @sprite.opacity < 255)
@sprite.opacity += 12
end
if (!@appearing && @sprite.opacity > 0)
@sprite.opacity -= 12
finish if @sprite.opacity <= 0
end
end
def finish
@sprite.dispose
@sprite = nil
@done = true
end
end
class Character_Selection_Window
include OmegaX::Character_Selection
attr_reader :done
attr_accessor :appearing
def initialize(id)
@window = Window_Base.new(0,160,360,416 - 160)
@window.z = 102
@window.opacity = 0
@appearing = true
@done = false
@window.contents.font.size = 17
@window.contents.draw_text(0,0,340,20,$game_actors[id].name)
@window.contents_opacity = 0
@window.opacity = 0
@window.contents.font.size = 14
if Descriptions[id] != nil
for i in 0...Descriptions[id].size
@window.contents.draw_text(0,16*i + 30,340,16,Descriptions[id][i].to_s)
end
end
end
def update
if (@appearing && @window.opacity < 255)
@window.contents_opacity += 12
end
if (!@appearing && @window.contents_opacity > 0)
@window.contents_opacity -= 12
finish if @window.contents_opacity <= 0
end
end
def finish
@window.dispose
@window = nil
@done = true
end
end