Jump to content
Rpg²S Forum
  • 0

PROBLEMA CON UNO SCRIPT


redXIII
 Share

Question

ciao a tutti mi potete per favore dare una mano con uno script...

vi spiego: ho preso il menu di ProGM ispirato a final fantasy 12 e volevo madificare alcune cose, cioè alcuni cambiamenti li ho fatti gia da me ma qualcosa non mi funziona...

ora vi illustro il probblema:

Volevo modificare la classe mappa, nel menu:

Attualmente il comando apre un disegno o picture, che viene posto come sfondo al menu

io invece volevo far sì che teletrasportasse il pg in una mappa

così ho pensato di usare un switch...

ho usato questo codice per attivare la switch nello script:

$game_switches[008] = true

ora il probblema è che non vuole partire e mi dà errore e non capisco il perché...mi potete dera una mano?

# ***CMS***
# Ispirato a FFXII.
# By ProGM
class Window_Base2 < Window_Base
def draw_actor_face(actor, x, y)
bitmap = RPG::Cache.picture(actor.name)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
def draw_actor_level(actor, x, y)
self.contents.font.color = normal_color
self.contents.font.size = 40
self.contents.font.name = "Addled"
if actor.level < 10
self.contents.draw_text(x + 32, y, 32, 32, "0" + actor.level.to_s, 2, 2)
else
self.contents.draw_text(x + 32, y, 32, 32, actor.level.to_s, 2, 2)
end
self.contents.font.size = $fontsize
self.contents.font.name = $fontface
end
def draw_actor_exp(actor, x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 40, 32, "EXP")
self.contents.font.color = normal_color
self.contents.draw_text(x + 48, y, 84, 32, actor.exp_s, 1, 2)
self.contents.font.color = Color.new(120, 120, 120)
if actor.exp_s.to_i < 10
self.contents.font.color = Color.new(255, 255, 255, 120)
self.contents.draw_text(x + 40, y, 84, 32, "0000", 0, 2)
elsif actor.next_exp_s.to_i < 100
self.contents.draw_text(x + 40, y, 84, 32, "000", 0, 2)
elsif actor.next_exp_s.to_i < 1000
self.contents.draw_text(x + 40, y, 84, 32, "00", 0, 2)
elsif actor.next_exp_s.to_i < 10000
self.contents.draw_text(x + 40, y, 84, 32, "0", 0, 2)
end
self.contents.font.color = normal_color

x = x + 140
self.contents.font.color = system_color
self.contents.draw_text(x - 3, y, 40, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(x + 42, y, 84, 32, actor.next_exp_s, 1, 2)
self.contents.font.color = Color.new(120, 120, 120)
if actor.next_exp_s.to_i < 10
self.contents.font.color = Color.new(255, 255, 255, 120)
self.contents.draw_text(x + 40, y, 84, 32, "0000", 0, 2)
elsif actor.next_exp_s.to_i < 100
self.contents.draw_text(x + 40, y, 84, 32, "000", 0, 2)
elsif actor.next_exp_s.to_i < 1000
self.contents.draw_text(x + 40, y, 84, 32, "00", 0, 2)
elsif actor.next_exp_s.to_i < 10000
self.contents.draw_text(x + 40, y, 84, 32, "0", 0, 2)
end
self.contents.font.color = normal_color
end
def draw_actor_hp(actor, x, y, width = 144)
# Draw "HP" text string
self.contents.draw_text(x + 80, y - 25, 48, 32, "HP/Max", 0, 2)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# Draw HP
self.contents.font.size = 33
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y - 6, 48, 32, actor.hp.to_s, 2, 2)
# Draw MaxHP
if flag
self.contents.font.color = normal_color
self.contents.font.size = $fontsize
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1, 2)
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s, 0, 2)
end
end
def draw_actor_sp(actor, x, y, width = 144)
# Draw "SP" text string
self.contents.draw_text(x + 80, y - 25, 48, 32, "SP/Max", 0, 2)
# Calculate if there is draw space for MaxHP
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# Draw SP
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.font.size = 33
self.contents.draw_text(sp_x, y - 6, 48, 32, actor.sp.to_s, 2, 2)
# Draw MaxSP
if flag
self.contents.font.color = normal_color
self.contents.font.size = $fontsize
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1, 2)
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s, 0, 2)
end
end
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end
class Window_Selectable2 < Window_Base2
attr_reader :index # cursor position
attr_reader :help_window # help window
def initialize(x, y, width, height)
super(x, y, width, height)
@item_max = 1
@column_max = 1
@index = -1
end
def index=(index)
@index = index
if self.active and @help_window != nil
update_help
end
update_cursor_rect
end
def row_max
return (@item_max + @column_max - 1) / @column_max
end
def top_row
return self.oy / 32
end
def top_row=(row)
if row < 0
row = 0
end
if row > row_max - 1
row = row_max - 1
end
self.oy = row * 32
end
def page_row_max
return (self.height - 32) / 32
end
def page_item_max
return page_row_max * @column_max
end
def help_window=(help_window)
@help_window = help_window
if self.active and @help_window != nil
update_help
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
return
end
row = @index / @column_max
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 32 - self.oy
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, 32)
end
def update
super
# If cursor is movable
if self.active and @item_max > 0 and @index >= 0
# If pressing down on the directional buttons
if Input.repeat?(Input::DOWN)
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
# Move cursor down
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
if @column_max >= 2 and @index < @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
# If column count is 2 or more, and cursor position is more back than 0
if @column_max >= 2 and @index > 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
# If R button was pressed
if Input.repeat?(Input::R)
# If bottom row being displayed is more to front than bottom data row
if self.top_row + (self.page_row_max - 1) < (self.row_max - 1)
# Move cursor 1 page back
$game_system.se_play($data_system.cursor_se)
@index = [@index + self.page_item_max, @item_max - 1].min
self.top_row += self.page_row_max
end
end
# If L button was pressed
if Input.repeat?(Input::L)
# If top row being displayed is more to back than 0
if self.top_row > 0
# Move cursor 1 page forward
$game_system.se_play($data_system.cursor_se)
@index = [@index - self.page_item_max, 0].max
self.top_row -= self.page_row_max
end
end
end
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
end
class Window_MenuStatus < Window_Selectable2
def initialize
super(0, 0, 430, 416)
self.contents = New_Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.active = false
self.index = -1
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 64
y = i * 90
actor = $game_party.actors[i]
draw_actor_face(actor, x - 30, y + 38)
draw_actor_level(actor, x - 32, y)
draw_actor_exp(actor, x, y + 35)
draw_actor_hp(actor, x + 50, y + 16)
draw_actor_sp(actor, x + 180, y + 16)
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 90 - 7, self.width - 32, 70)
end
end
end
class Window_Help2 < Window_Base
def initialize
super(-10, 0, 672, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
end
def set_text(text, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = normal_color
self.contents.blt(0, 3, RPG::Cache.icon("Help.png"), Rect.new(0, 0, 32, 24))
self.contents.draw_text(36, 0, self.width - 40, 32, text, align)
@text = text
@align = align
end
self.visible = true
end
def choice(id)
case id
when 0
set_text("Per inserire o escudere dal gruppo i vari personaggi.")
when 1
set_text("Per dare uno sguardo ai nostri personaggi e alle loro condizioni.")
when 2
set_text("Per dotare i personaggi di nuove armi o armature.")
when 3
set_text("Qui è contenuto l'elenco di oggetti posseduti dal gruppo.")
when 4
set_text("Qui verranno mostrate le abilita di ogni eroe.")
when 5
set_text("La mappa principale.")
when 6
set_text("Per salvare la partita.")
when 7
set_text("Per caricare una partita salvata.")
when 8
set_text("Per uscire dal gioco.")
end
end
end
class New_Bitmap < Bitmap
def draw_text(x, y, w, h, text, m = 0, command = 0)
case command
when 0
super (x, y, w, h, text, m)
when 1
old_color = font.color.dup
font.color = Color.new(0, 0, 0, 120)
super (x - 2, y + 2, w, h, text, m)
font.color = old_color
super (x, y, w, h, text, m)
when 2
old_color = font.color.dup
font.color = Color.new(0, 0, 0, 255)
super (x - 1, y - 1, w, h, text, m)
super (x - 1, y + 1, w, h, text, m)
super (x + 1, y - 1, w, h, text, m)
super (x + 1, y + 1, w, h, text, m)
font.color = old_color
super (x, y, w, h, text, m)
end
end
end
class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
@background = Sprite.new
@background.bitmap = RPG::Cache.picture("BackGround.png")
# Make command window
s1 = "1 Battle Member"
s2 = "2 Status"
s3 = "3 Inventario"
s4 = "4 Oggetti"
s5 = "5 Magie"
s6 = "6 Mappa"
s7 = "7 Salva"
s8 = "8 Carica"
s9 = "9 Esci"
@command_window = Window_Command.new(140, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
@command_window.index = @menu_index
@command_window.x = 20
@command_window.y = 64
@command_window.opacity = 76
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
@help_window = Window_Help2.new
@help_window.opacity = 0
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 180
@status_window.y = 64
@status_window.opacity = 0
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 20
@gold_window.y = 400
@gold_window.opacity = 76
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@background.dispose
@help_window.dispose
@command_window.dispose
@status_window.dispose
@gold_window.dispose
@map.dispose if @map != nil
end
def update
# Update windows
@command_window.update
@status_window.update
@gold_window.update
@help_window.choice(@command_window.index)
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 3 # item mod
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 0
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Battler.new
when 4 # skill mod
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # map mod
$game_system.se_play($data_system.decision_se)
$game_switches[008] = true
$scene = Scene_Map.new
when 2 # equipment mod
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 1 # status mod
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 6 # save mod
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 7 # load mod
$game_system.se_play($data_system.decision_se)
$scene = Scene_Load.new(true)
when 8 # end game mod
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 4 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 1 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
class Game_Actor < Game_Battler
attr_accessor :active
alias other_setup setup
def setup(actor_id)
other_setup(actor_id)
@active = true
end
end
class Scene_Battle
def phase3_next_actor
begin
if @active_battler != nil
@active_battler.blink = false
end
if @actor_index == $game_party.actors.size-1
start_phase4
return
end
@actor_index += 1
if $game_party.actors[@actor_index].active == false
@actor_index += 1
$game_party.actors[@actor_index].current_action.basic == 1 unless @actor_index == $game_party.actors.size
end
if @actor_index == $game_party.actors.size
start_phase4
return
end
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
end until @active_battler.inputable?
phase3_setup_command_window
end
end
class Scene_Battler
def main
@names=[]
for i in $game_party.actors
@names.push(i.name)
end
@command_window = Window_Command.new(200, @names)
for i in 0...$game_party.actors.size
if $game_party.actors[i].active == false
@command_window.disable_item(i)
end
end
@command_window.x = 120
@command_window.y = 100
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
@command_window.dispose
end
def update
@command_window.update
if Input.trigger?(Input::C)
case @command_window.index
when 0
if $game_party.actors[0].active == false
$game_party.actors[0].active = true
else
$game_party.actors[0].active = false
end
when 1
if $game_party.actors[1].active == false
$game_party.actors[1].active = true
else
$game_party.actors[1].active = false
end
when 2
if $game_party.actors[2].active == false
$game_party.actors[2].active = true
else
$game_party.actors[2].active = false
end
when 3
if $game_party.actors[3].active == false
$game_party.actors[3].active = true
else
$game_party.actors[3].active = false
end
end
@command_window.dispose
@names=[]
for i in $game_party.actors
@names.push(i.name)
end
@command_window = Window_Command.new(200, @names)
for i in 0...$game_party.actors.size
if $game_party.actors[i].active == false
@command_window.disable_item(i)
end
end
@command_window.x = 120
@command_window.y = 100
end
if Input.trigger?(Input::B)
$scene = Scene_Menu.new(0)
end
end
end
class Sprite_Battler < RPG::Sprite
alias old_update update
def update
old_update
self.opacity = 120 if @battler.is_a?(Game_Actor) and @battler.active == false
self.color = Color.new(255, 255, 255, 90) if @battler.is_a?(Game_Actor) and @battler.active == false
end
end
class Scene_Load
alias old_initialize initialize
def initialize(menu = false)
@menu = menu
old_initialize
end
def on_cancel
$game_system.se_play($data_system.cancel_se)
if @menu
$scene = Scene_Menu.new(7)
else
$scene = Scene_Title.new
end
end
end

Edited by redXIII

LAST LEGEND tempo di programmazione rimasto in percentuale è:

Storia del gioco: 98%

Storia dei personaggi: 75%

Storia politica mondiale: 80%

Applicazione e sviluppo dell'avventura, tempo rimasto in percentuale è:

Titleset:40%

Charaset:20%

Animation:90%

Idem,Skill,Armi:50%

Scene Animate:10%

http://img518.imageshack.us/img518/5919/logoufficialecopiawr2.png

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...