Jump to content
Rpg²S Forum

Gabbo4ever

Utenti
  • Posts

    11
  • Joined

  • Last visited

Posts posted by Gabbo4ever

  1. Salve gente :)

    Vi preannuncio che non sono molto bravo con gli scipt...

     

    Stavo creando una nuova stringa nel titolo... nella Scene_Title ho messo:

     

    def command_trofei

    close_command_window

    SceneManager.call(Scene_Trofei)

    end

     

    Poi quando provo il gioco mi dice:

     

    Script 'Scene_Title' line 127: NameError occured

    unitialized costant Scene_Title::Scene_Trofei

     

    Il problema è che non mi va nella Scene_Trofei...

    Ora vi faccio vedere tutto quello che ho fatto

    Questo è per i vocaboli

     

    
    [spoiler]#==============================================================================
    # ** Vocaboli
    #------------------------------------------------------------------------------
    #  Questo modulo definisce termini e messaggi. Definisce alcuni dati e variabili
    # costanti. I termini nel database sono ottenuti da $data_system.
    #==============================================================================
    module Vocab
     # Trofei
     Trofei		  = "Trofei"
     Sconosciuto	 = "Sconosciuto"
     # Schermata del Negozio
     ShopBuy		 = "Compra"
     ShopSell		= "Vendi"
     ShopCancel	  = "Annulla"
     Possession	  = "Posseduti"
     # Schermata dello Status
     ExpTotal		= "Esp. Attuale"
     ExpNext		 = "Per il prossimo %s"
     # Schermata di Salvataggio/Caricamento
     SaveMessage	 = "In quale File vuoi salvare?"
     LoadMessage	 = "Quale File vuoi caricare?"
     File			= "File"
     # Mostra quando ci sono più membri
     PartyName	   = "Il gruppo di %s"
     # Messaggi di Battaglia normali
     Emerge		  = "Appare %s!"
     Preemptive	  = "%s ha il sopravvento!"
     Surprise		= "%s è stato sorpreso!"
     EscapeStart	 = "%s cerca di fuggire!"
     EscapeFailure   = "Tuttavia, non è riuscito nell'impresa!"
     # Messaggi di Fine Battaglia
     Victory		 = "%s ha ottenuto la vittoria!"
     Defeat		  = "%s è stato sconfitto."
     ObtainExp	   = "%s ESP ricevuta!"
     ObtainGold	  = "Hai guadagnato %s\\G!"
     ObtainItem	  = "Hai trovato %s!"
     LevelUp		 = "%s è ora al %s %s!"
     ObtainSkill	 = "Ha imparato %s!"
     # Usa Oggetto
     UseItem		 = "%s usa %s!"
     # Colpo Critico
     CriticalToEnemy = "Un colpo eccellente!!"
     CriticalToActor = "Ahi, questo fa male!!"
     # Risultanti delle azioni sugli eroi
     ActorDamage	 = "%s subisce %s punti danno!"
     ActorRecovery   = "%s recupera %s %s!"
     ActorGain	   = "%s ottiene %s %s!"
     ActorLoss	   = "%s ha perso %s %s!"
     ActorDrain	  = "%s è stato assorbito di %s %s!"
     ActorNoDamage   = "%s non subisce danno!"
     ActorNoHit	  = "Mancato! %s non subisce danno!"
     # Risultanti delle azioni sui nemici
     EnemyDamage	 = "%s subisce %s punti danno!"
     EnemyRecovery   = "%s recupera %s %s!"
     EnemyGain	   = "%s ottiene %s %s!"
     EnemyLoss	   = "%s ha perso %s %s!"
     EnemyDrain	  = "Assorbe %s %s da %s!"
     EnemyNoDamage   = "%s non subisce danno!"
     EnemyNoHit	  = "Mancato! %s non subisce danno!"
     # Evasione/Riflesso
     Evasion		 = "%s ha schivato l'attacco!"
     MagicEvasion	= "%s ha annullato la magia!"
     MagicReflection = "%s ha riflesso la magia!"
     CounterAttack   = "%s ha contrattaccato!"
     Substitute	  = "%s ha protetto %s!"
     # Buff/Debuff
     BuffAdd		 = "%s di %s aumenta!"
     DebuffAdd	   = "%s di %s diminuisce!"
     BuffRemove	  = "%s di %s torna normale."
     # Quando un'abilità o un oggetto non ha effetto
     ActionFailure   = "Non ha avuto effetto su %s!"
     # Messaggi di Errore
     PlayerPosError  = "Non hai impostato la posizione iniziale del giocatore."
     EventOverflow   = "Le chiamate agli Eventi Comuni hanno raggiunto il limite."
     # Statistiche di Base
     def self.basic(basic_id)
    $data_system.terms.basic[basic_id]
     end
     # Parametri
     def self.param(param_id)
    $data_system.terms.params[param_id]
     end
     # Tipo Equipaggiamento
     def self.etype(etype_id)
    $data_system.terms.etypes[etype_id]
     end
     # Comandi
     def self.command(command_id)
    $data_system.terms.commands[command_id]
     end
     # Valuta
     def self.currency_unit
    $data_system.currency_unit
     end
     #--------------------------------------------------------------------------
     def self.level;	   basic(0);	 end   # Livello
     def self.level_a;	 basic(1);	 end   # Livello (abbreviato)
     def self.hp;		  basic(2);	 end   # PV
     def self.hp_a;		basic(3);	 end   # PV (abbreviato)
     def self.mp;		  basic(4);	 end   # PM
     def self.mp_a;		basic(5);	 end   # PM (abbreviato)
     def self.tp;		  basic(6);	 end   # PT
     def self.tp_a;		basic(7);	 end   # PT (abbreviato)
     def self.fight;	   command(0);   end   # Lotta
     def self.escape;	  command(1);   end   # Fuggi
     def self.attack;	  command(2);   end   # Attacca
     def self.guard;	   command(3);   end   # Difendi
     def self.item;		command(4);   end   # Oggetti
     def self.skill;	   command(5);   end   # Abilità
     def self.equip;	   command(6);   end   # Equipaggia
     def self.status;	  command(7);   end   # Status
     def self.formation;   command(8);   end   # Cambia Formazione
     def self.save;		command(9);   end   # Salva
     def self.game_end;	command(10);  end   # Esci dal Gioco
     def self.weapon;	  command(12);  end   # Armi
     def self.armor;	   command(13);  end   # Armature
     def self.key_item;	command(14);  end   # Oggetti Chiave
     def self.equip2;	  command(15);  end   # Cambia Equipaggiamento
     def self.optimize;	command(16);  end   # Ottimizza Equipaggiamento
     def self.clear;	   command(17);  end   # Rimuovi Tutto
     def self.new_game;	command(18);  end   # Nuovo Gioco
     def self.continue;	command(19);  end   # Continua
     def self.shutdown;	command(20);  end   # Esci
     def self.to_title;	command(21);  end   # Vai al Titolo
     def self.cancel;	  command(22);  end   # Annulla
     #--------------------------------------------------------------------------
    end[/ SPOILER]
    

     

    Window_Titlecommand:

    [spoiler]#==============================================================================
    # ** Window_TitleCommand
    #------------------------------------------------------------------------------
    #  This window is for selecting New Game/Continue on the title screen.
    #==============================================================================
    class Window_TitleCommand < Window_Command
     #--------------------------------------------------------------------------
     # * Object Initialization
     #--------------------------------------------------------------------------
     def initialize
    super(0, 0)
    update_placement
    select_symbol(:continue) if continue_enabled
    self.openness = 0
    open
     end
     #--------------------------------------------------------------------------
     # * Get Window Width
     #--------------------------------------------------------------------------
     def window_width
    return 160
     end
     #--------------------------------------------------------------------------
     # * Update Window Position
     #--------------------------------------------------------------------------
     def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height * 1.6 - height) / 2
     end
     #--------------------------------------------------------------------------
     # * Create Command List
     #--------------------------------------------------------------------------
     def make_command_list
    add_command(Vocab::new_game, :new_game)
    add_command(Vocab::continue, :continue, continue_enabled)
    add_command(Vocab::Trofei  , :trofei)
    add_command(Vocab::shutdown, :shutdown)
     end
     #--------------------------------------------------------------------------
     # * Get Activation State of Continue
     #--------------------------------------------------------------------------
     def continue_enabled
    DataManager.save_file_exists?
     end
    end[/spoiler]
    
    

     

    WIndow_TrofeiCommand: (Fatto da me):

    
    [spoiler]#==============================================================================
    # ** Window_TitleCommand
    #------------------------------------------------------------------------------
    #  This window is for selecting New Game/Continue on the title screen.
    #==============================================================================
    class Window_TrofeiCommand < Window_Command
     #--------------------------------------------------------------------------
     # * Object Initialization
     #--------------------------------------------------------------------------
     def initialize
    super(0, 0)
    update_placement
    select_symbol(:continue) if continue_enabled
    self.openness = 0
    open
     end
     #--------------------------------------------------------------------------
     # * Get Window Width
     #--------------------------------------------------------------------------
     def window_width
    return 160
     end
     #--------------------------------------------------------------------------
     # * Update Window Position
     #--------------------------------------------------------------------------
     def update_placement
    self.x = (Graphics.width - width) / 2
    self.y = (Graphics.height * 1.6 - height) / 2
     end
     #--------------------------------------------------------------------------
     # * Create Command List
     #--------------------------------------------------------------------------
     def make_command_list
    add_command(Vocab::Sconosciuto, :bho)
    add_command(Vocab::Sconosciuto, :bho)
    add_command(Vocab::Sconosciuto, :bho)
    add_command(Vocab::Sconosciuto, :bho)
     end
     #--------------------------------------------------------------------------
     # * Get Activation State of Continue
     #--------------------------------------------------------------------------
     def continue_enabled
    DataManager.save_file_exists?
     end
    end[/spoiler]
    
    

     

    Scene_Title:

    
    [spoiler]#==============================================================================
    # ** Scene_Title
    #------------------------------------------------------------------------------
    #  This class performs the title screen processing.
    #==============================================================================
    class Scene_Title < Scene_Base
     #--------------------------------------------------------------------------
     # * Start Processing
     #--------------------------------------------------------------------------
     def start
    super
    SceneManager.clear
    Graphics.freeze
    create_background
    create_foreground
    create_command_window
    play_title_music
     end
     #--------------------------------------------------------------------------
     # * Get Transition Speed
     #--------------------------------------------------------------------------
     def transition_speed
    return 20
     end
     #--------------------------------------------------------------------------
     # * Termination Processing
     #--------------------------------------------------------------------------
     def terminate
    super
    SceneManager.snapshot_for_background
    dispose_background
    dispose_foreground
     end
     #--------------------------------------------------------------------------
     # * Create Background
     #--------------------------------------------------------------------------
     def create_background
    @sprite1 = Sprite.new
    @sprite1.bitmap = Cache.title1($data_system.title1_name)
    @sprite2 = Sprite.new
    @sprite2.bitmap = Cache.title2($data_system.title2_name)
    center_sprite(@sprite1)
    center_sprite(@sprite2)
     end
     #--------------------------------------------------------------------------
     # * Create Foreground
     #--------------------------------------------------------------------------
     def create_foreground
    @foreground_sprite = Sprite.new
    @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    @foreground_sprite.z = 100
    draw_game_title if $data_system.opt_draw_title
     end
     #--------------------------------------------------------------------------
     # * Draw Game Title
     #--------------------------------------------------------------------------
     def draw_game_title
    @foreground_sprite.bitmap.font.size = 48
    rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
    @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
     end
     #--------------------------------------------------------------------------
     # * Free Background
     #--------------------------------------------------------------------------
     def dispose_background
    @sprite1.bitmap.dispose
    @sprite1.dispose
    @sprite2.bitmap.dispose
    @sprite2.dispose
     end
     #--------------------------------------------------------------------------
     # * Free Foreground
     #--------------------------------------------------------------------------
     def dispose_foreground
    @foreground_sprite.bitmap.dispose
    @foreground_sprite.dispose
     end
     #--------------------------------------------------------------------------
     # * Move Sprite to Screen Center
     #--------------------------------------------------------------------------
     def center_sprite(sprite)
    sprite.ox = sprite.bitmap.width / 2
    sprite.oy = sprite.bitmap.height / 2
    sprite.x = Graphics.width / 2
    sprite.y = Graphics.height / 2
     end
     #--------------------------------------------------------------------------
     # * Create Command Window
     #--------------------------------------------------------------------------
     def create_command_window
    @command_window = Window_TitleCommand.new
    @command_window.set_handler(:new_game, method(:command_new_game))
    @command_window.set_handler(:continue, method(:command_continue))
    @command_window.set_handler(:trofei  , method(:command_trofei))
    @command_window.set_handler(:shutdown, method(:command_shutdown))
     end
     #--------------------------------------------------------------------------
     # * Close Command Window
     #--------------------------------------------------------------------------
     def close_command_window
    @command_window.close
    update until @command_window.close?
     end
     #--------------------------------------------------------------------------
     # * [New Game] Command
     #--------------------------------------------------------------------------
     def command_new_game
    DataManager.setup_new_game
    close_command_window
    fadeout_all
    $game_map.autoplay
    SceneManager.goto(Scene_Map)
     end
     #--------------------------------------------------------------------------
     # * [Continue] Command
     #--------------------------------------------------------------------------
     def command_continue
    close_command_window
    SceneManager.call(Scene_Load)
     end
     #--------------------------------------------------------------------------
     # * [Trofei] Command
     #--------------------------------------------------------------------------
     def command_trofei
    close_command_window
    SceneManager.call(Scene_Trofei)
     end
     #--------------------------------------------------------------------------
     # * [shut Down] Command
     #--------------------------------------------------------------------------
     def command_shutdown
    close_command_window
    fadeout_all
    SceneManager.exit
     end
     #--------------------------------------------------------------------------
     # * Play Title Screen Music
     #--------------------------------------------------------------------------
     def play_title_music
    $data_system.title_bgm.play
    RPG::BGS.stop
    RPG::ME.stop
     end
    end[/spoiler]
    
    

     

    Scene_Trofei:

    [spoiler]#==============================================================================
    # ** Scene_Trofei
    #------------------------------------------------------------------------------
    #  This class performs the Trofei screen processing.
    #==============================================================================
    class Scene_Menu < Scene_MenuBase
     #--------------------------------------------------------------------------
     # * Start Processing
     #--------------------------------------------------------------------------
     def start
    super
    create_command_window
     end
     #--------------------------------------------------------------------------
     # * Create Command Window
     #--------------------------------------------------------------------------
     def create_command_window
    @command_window = Window_TrofeiCommand.new
    @command_window.set_handler(:bho,	 method(:command_bho))
    @command_window.set_handler(:bho,	 method(:command_bho))
    @command_window.set_handler(:bho,	 method(:command_bho))
    @command_window.set_handler(:bho,	 method(:command_bho))
     end
     #--------------------------------------------------------------------------
     # * [bho] Command
     #--------------------------------------------------------------------------
     def commad_bho
    Vocab::Bho
     end
    end[/sPOLER]
    

  2. Oggi girovagando per il web ho trovato questo script per il pentolone alchemico alla Dragon Quest 8

     

     

    Istruzioni:

     

    Mettere lo script sopra Main

     

    Script:

    #==============================================================================

    # ** Alchemy Pot

     

    #------------------------------------------------------------------------------

     

    # Autore: The Sleeping Leonhart

     

    # Versione: 1.4

     

    # Data di rilascio: 10/07/2001

     

    #------------------------------------------------------------------------------

     

    # Descrizione:

     

    # Questo script simula il pentolone alchemico di Dragon Quest VIII.

     

    # Per chi non lo conoscesse il pentolone alchemico permette di "buttare"

     

    # nel pentolone oggetti per crearne uno nuovo.

     

    #------------------------------------------------------------------------------

     

    # Version:

     

    # 1.0 (07/10/2008): Versione Base.

     

    # 1.1 (06/12/2008): Aggiunta l'opzione Failure Item.

     

    # 1.2 (08/12/2008): Ora si possono vedere immediatamente i risultati.

     

    # 1.3 (09/12/2008): Aggiunto un time meter.

     

    # Aggiunto un filtro per gli oggetti inusabili.

     

    # 1.4 (10/07/2010): Bugfix.

     

    #------------------------------------------------------------------------------

     

    # Istruzioni:

     

    # Per chiamare il pentolone usate il comando script degli eventi ed inserite:

     

    # $scene = Scene_AlchemyPot.new

     

    # Premere A per passare dalla finestra di conferma a quella degli oggetti e viceversa.

     

    # Per personalizzare lo script andate nella sezione Configurazione e Vocabolario.

     

    #==============================================================================

     

     

    #==============================================================================

     

    # Configuration

     

    #=============================================================================

     

    module AlchemyPot

     

    #=====NON TOCCARE=========================================================

     

    i = load_data("Data/Items.rvdata")

     

    w = load_data("Data/Weapons.rvdata")

     

    a = load_data("Data/Armors.rvdata")

     

    #=========================================================================

     

     

    #=========================================================================

     

    # Formula: Imposta le formule del pentolone.

     

    #-------------------------------------------------------------------------

     

    # Sintassi:

     

    # Formula[iId1, ...] = [iId2, time]

     

    # Parametri:

     

    # iId1: id degli ingredienti, usate i[id] per gli oggetti, w[id] per le armi,

     

    # a[id] per le armature. id è il numero dell'oggetto nel database.

     

    # iId2: id dell'oggetto ottenuto, usate i[id] per gli oggetti, w[id] per le armi,

     

    # a[id] per le armature. id è il numero dell'oggetto nel database.

     

    # time: numero di minuti richiesti per la ricetta.

     

    #=========================================================================

     

    Formula = {}

     

    Formula[[i[1], i[1]]] = [i[2], 1]

     

    Formula[[i[1], w[1]]] = [w[2], 2]

     

    Formula[[a[1], w[2]]] = [a[2], 4]

     

    #=========================================================================

     

    # UnusableItem: Definisce gli oggetti che non possono essere messi nel pentolone

     

    #-------------------------------------------------------------------------

     

    # Sintax:

     

    # UnusableItem = [iId, ...]

     

    # Parameter:

     

    # iId: id degli ingredienti, usate i[id] per gli oggetti, w[id] per le armi,

     

    # a[id] per le armature. id è il numero dell'oggetto nel database.

     

    #=========================================================================

     

    UnusableItem = [i[3], w[5], a[4]]

     

    #=========================================================================

     

    # MaxItem: Numero massimo di oggetti inserbili nel pentolone.

     

    #-------------------------------------------------------------------------

     

    # Sintassi:

     

    # MaxItem = n

     

    # Parametri:

     

    # n: Numero massimo di oggetti inserbili nel pentolone.

     

    #=========================================================================

     

    MaxItem = 5

     

    #=========================================================================

     

    # FailureItem: Imposta gli ogetti ottenuti se si sbaglia formula

     

    #-------------------------------------------------------------------------

     

    # Sintassi:

     

    # FailureItem = [iId, ...]

     

    # Parametri:

     

    # iId: id dell'oggetto ottenuto, usate i[id] per gli oggetti, w[id] per le armi,

     

    # a[id] per le armature. id è il numero dell'oggetto nel database.

     

    #=========================================================================

     

    FailureItem = [i[1], w[4], a[5]]

     

    #=========================================================================

     

    # FailureTime: Imposta il tempo per creare l'oggetto sbagliato

     

    #-------------------------------------------------------------------------

     

    # Sintassi:

     

    # FailureItem = time

     

    # Parametri:

     

    # time: numero di minuti richiesti per la ricetta.

     

    #=========================================================================

     

    FailureTime = 1

     

    #=========================================================================

     

    # TimeMeter: Imposta le immagini per la barra del tempo

     

    #-------------------------------------------------------------------------

     

    # Sintassi:

     

    # TimeMeter = [emptymeter, fullmeter] o nil

     

    # Parametri:

     

    # emptymeter = picture che rappresenta la barra del tempo vuota

     

    # fullmeter = picture che rappresenta la barra del tempo piena

     

    # nil = mettere nil per non visualizzare la barra del tempo

     

    #=========================================================================

     

    TimeMeter = nil

     

    end

     

     

    #==============================================================================

     

    # Vocabolario

     

    #=============================================================================

     

    module Vocab

     

    #Pulsante di Conferma

     

    AlchemyPotGo = "Avvia"

     

    #Pulsante di uscita

     

    AlchemyPotExit = "Esci"

     

    #Formula Corretta

     

    AlchemyPotRightFormula = "Credo che possa funzionare!"

     

    #Formula Inesistente

     

    AlchemyPotWrongFormula = "Non credo che possa funzionare!"

     

    #Ricetta Terminata

     

    AlchemyPotFormulaFinished = "La ricetta è pronta!"

     

    #Ricetta non Terminata

     

    AlchemyPotFormulaNotFinished = "La ricetta non è ancora pronta!"

     

    #Oggetto ottenuto

     

    AlchemyPotObtained = "Hai ottenuto:"

     

    end

     

     

    class Game_Party

     

    attr_accessor :alchemy_pot

     

    alias tslalchemypot_gameparty_initialize initialize

     

    def initialize

     

    tslalchemypot_gameparty_initialize

     

    @alchemy_pot = []

     

    end

     

    end

     

     

    class Window_Base

     

    def draw_graphical_bar(x, y, barravuota, barrapiena, corrente, max)

     

    barra_vuota = Bitmap.new("Graphics/Pictures/"+barravuota)

     

    barra_piena = Bitmap.new("Graphics/Pictures/"+barrapiena)

     

    taglio = corrente.to_f / max.to_f

     

    cwp = barra_piena.width

     

    cwv = barra_vuota.width

     

    chp = barra_piena.height

     

    chv = barra_vuota.height

     

    taglio = taglio*cwp

     

    src_rect = Rect.new(0, 0, taglio, chp)

     

    self.contents.blt(32+x-cwp/4, 18+y-chp/2, barra_piena, src_rect)

     

    src_rect = Rect.new(taglio, 0, cwv-taglio, chv)

     

    self.contents.blt(32+x-cwv/4+taglio, 18+y-chv/2, barra_vuota, src_rect)

     

    end

     

    end

     

     

    class Window_AlchemyPotItem < Window_Selectable

     

    def initialize

     

    super(32, 80, 292, 292)

     

    @column_max = 10

     

    self.index = 0

     

    refresh

     

    end

     

    def item

     

    return @data[self.index]

     

    end

     

    def include?(item)

     

    return false if item == nil

     

    if $game_temp.in_battle

     

    return false unless item.is_a?(RPG::Item)

     

    end

     

    return true

     

    end

     

    def item_rect(index)

     

    rect = Rect.new(0, 0, 0, 0)

     

    rect.width = 24

     

    rect.height = 24

     

    rect.x = index % @column_max * 26

     

    rect.y = index / @column_max * 26

     

    return rect

     

    end

     

    def enable?(item)

     

    return $game_party.item_can_use?(item)

     

    end

     

    def refresh

     

    @data = []

     

    for item in $game_party.items

     

    next unless include?(item)

     

    @data.push(item) if check(item)

     

    end

     

    @data.push(nil) if include?(nil)

     

    @item_max = @data.size

     

    create_contents

     

    for i in 0...@item_max

     

    draw_item(i)

     

    end

     

    end

     

    def draw_item(index)

     

    rect = item_rect(index)

     

    self.contents.clear_rect(rect)

     

    item = @data[index]

     

    if item != nil

     

    number = $game_party.item_number(item)

     

    x = index % @column_max * 26

     

    y = index / @column_max * 26

     

    draw_icon(item.icon_index, x, y)

     

    self.contents.font.size = 12

     

    self.contents.draw_text(10 + x, 6 + y, 24, 24, number.to_s)

     

    end

     

    end

     

    def update_help

     

    @help_window.set_text(item == nil ? "" : item.name)

     

    end

     

    def check(item)

     

    for i in AlchemyPot::UnusableItem

     

    if i.id == item.id and i.class == item.class

     

    return false

     

    end

     

    end

     

    return true

     

    end

     

    end

     

     

    class Window_AlchemyPotPot < Window_Base

     

    def initialize

     

    super(454, 80, 26 + 32, 26 * AlchemyPot::MaxItem + 32)

     

    refresh

     

    end

     

    def refresh(pot = [])

     

    self.contents.clear

     

    @data = pot.clone

     

    @data.push(nil) if @data == []

     

    @item_max = @data.size

     

    create_contents

     

    for i in 0...@item_max

     

    draw_item(i)

     

    end

     

    end

     

    def draw_item(index)

     

    item = @data[index]

     

    if item != nil

     

    y = index * 26

     

    draw_icon(item.icon_index, 0, y)

     

    end

     

    end

     

    end

     

     

    class Window_AlchemyPotResult < Window_Base

     

    def initialize

     

    super(0, 180, 272, WLH + 32)

     

    self.width = [self.contents.text_size(Vocab::AlchemyPotObtained).width + 192, 544].min

     

    self.x = 272 - self.width / 2

     

    create_contents

     

    refresh

     

    end

     

    def refresh(item = nil)

     

    self.contents.clear

     

    self.contents.font.color = normal_color

     

    self.contents.draw_text(0, 0, self.width - 40, WLH, Vocab::AlchemyPotObtained)

     

    draw_item_name(item, self.contents.text_size(Vocab::AlchemyPotObtained).width + 2, 0)

     

    end

     

    end

     

     

    class Window_PotTimeMeter < Window_Base

     

    def initialize(a = 0)

     

    super(180, 360, 192, 64)

     

    self.contents = Bitmap.new(width - 32, height - 32)

     

    self.opacity = 0

     

    refresh(a)

     

    end

     

    def refresh(a)

     

    if AlchemyPot::TimeMeter != nil

     

    self.contents.clear

     

    a = 0 if a == nil

     

    b = $game_party.alchemy_pot[2]

     

    b = (Graphics.frame_count - a) * 100 if b == nil

     

    draw_graphical_bar(0, 0, AlchemyPot::TimeMeter[0], AlchemyPot::TimeMeter[1], Graphics.frame_count-a, b)

     

    end

     

    end

     

    end

     

     

    class Scene_AlchemyPot < Scene_Base

     

    def start

     

    super

     

    create_menu_background

     

    create_command_window

     

    @help_window = Window_Help.new

     

    @item_window = Window_AlchemyPotItem.new

     

    @item_window.help_window = @help_window

     

    @pot_window = Window_AlchemyPotPot.new

     

    @result_window = Window_AlchemyPotResult.new

     

    @result_window.visible = false

     

    @meter = Window_PotTimeMeter.new($game_party.alchemy_pot[1])

     

    @ready = false

     

    if $game_party.alchemy_pot != []

     

    if $game_party.alchemy_pot[0][0] == "Wrong"

     

    @ingredients = $game_party.alchemy_pot[0][1].clone

     

    item = AlchemyPot::FailureItem[rand(AlchemyPot::FailureItem.size)]

     

    else

     

    @ingredients = $game_party.alchemy_pot[0].clone

     

    item = AlchemyPot::Formula[find_recipe(@ingredients)][0]

     

    end

     

    @pot_window.refresh(@ingredients)

     

    @item_window.active = false

     

    if Graphics.frame_count - $game_party.alchemy_pot[1] >= $game_party.alchemy_pot[2]

     

    @help_window.set_text(Vocab::AlchemyPotFormulaFinished)

     

    $game_party.gain_item(item, 1)

     

    @result_window.refresh(item)

     

    $game_party.alchemy_pot = []

     

    @ready = true

     

    else

     

    @help_window.set_text(Vocab::AlchemyPotFormulaNotFinished)

     

    end

     

    else

     

    @ingredients = []

     

    end

     

    end

     

     

    def terminate

     

    super

     

    dispose_menu_background

     

    dispose_command_window

     

    @help_window.dispose

     

    @item_window.dispose

     

    @pot_window.dispose

     

    @meter.dispose

     

    end

     

     

    def update

     

    super

     

    update_menu_background

     

    @help_window.update

     

    @command_window.update

     

    @item_window.update

     

    @pot_window.update

     

    @meter.update

     

    if @command_window.active

     

    update_command_selection

     

    elsif @item_window.active

     

    update_item_selection

     

    elsif @ready and @result_window.visible == false

     

    if Input.trigger?(Input::C)

     

    Sound.play_decision

     

    @result_window.visible = true

     

    return

     

    end

     

    elsif @result_window.visible

     

    if Input.trigger?(Input::C)

     

    Sound.play_decision

     

    @ingredients = []

     

    @ready = false

     

    @result_window.visible = false

     

    @item_window.active = true

     

    @item_window.refresh

     

    @pot_window.refresh

     

    return

     

    end

     

    else

     

    if Input.trigger?(Input::C)

     

    Sound.play_decision

     

    $scene = Scene_Map.new

     

    end

     

    end

     

    if $game_party.alchemy_pot[1] != nil

     

    @meter.refresh($game_party.alchemy_pot[1])

     

    if Graphics.frame_count - $game_party.alchemy_pot[1] >= $game_party.alchemy_pot[2]

     

    $scene = Scene_AlchemyPot.new

     

    end

     

    end

     

    end

     

     

    def create_command_window

     

    s1 = Vocab::AlchemyPotGo

     

    s2 = Vocab::AlchemyPotExit

     

    @command_window = Window_Command.new(96, [s1, s2])

     

    @command_window.active = false

     

    @command_window.x = 430

     

    @command_window.y = 304

     

    end

     

     

    def dispose_command_window

     

    @command_window.dispose

     

    end

     

     

    def update_item_selection

     

    if Input.trigger?(Input::B)

     

    Sound.play_cancel

     

    if @ingredients == []

     

    $scene = Scene_Map.new

     

    else

     

    $game_party.gain_item(@ingredients.pop, 1)

     

    @item_window.refresh

     

    @pot_window.refresh(@ingredients)

     

    end

     

    elsif Input.trigger?(Input::C)

     

    if @ingredients.size < AlchemyPot::MaxItem and @item_window.item != nil

     

    Sound.play_decision

     

    item = @item_window.item

     

    @ingredients.push(item)

     

    $game_party.gain_item(item, -1)

     

    @item_window.refresh

     

    @pot_window.refresh(@ingredients)

     

    else

     

    Sound.play_buzzer

     

    end

     

    elsif Input.trigger?(Input::A)

     

    Sound.play_decision

     

    @item_window.active = false

     

    @command_window.active = true

     

    end

     

    end

     

     

    def update_command_selection

     

    if Input.trigger?(Input::B)

     

    Sound.play_cancel

     

    exit

     

    elsif Input.trigger?(Input::C)

     

    case @command_window.index

     

    when 0

     

    if @ingredients.size > 1

     

    Sound.play_decision

     

    start_alchemy

     

    else

     

    Sound.play_buzzer

     

    end

     

    when 1

     

    Sound.play_decision

     

    exit

     

    end

     

    elsif Input.trigger?(Input::A)

     

    Sound.play_decision

     

    @item_window.active = true

     

    @command_window.active = false

     

    end

     

    end

     

     

    def exit

     

    for item in @ingredients

     

    $game_party.gain_item(item, 1)

     

    end

     

    $scene = Scene_Map.new

     

    end

     

     

    def start_alchemy

     

    rec = find_recipe(@ingredients)

     

    if rec != nil && AlchemyPot::Formula[rec] != nil

     

    @help_window.set_text(Vocab::AlchemyPotRightFormula)

     

    $game_party.alchemy_pot[0] = rec.clone

     

    $game_party.alchemy_pot[1] = Graphics.frame_count

     

    $game_party.alchemy_pot[2] = AlchemyPot::Formula[rec][1] * Graphics.frame_rate * 60

     

    @command_window.active = false

     

    return

     

    end

     

    @help_window.set_text(Vocab::AlchemyPotWrongFormula)

     

    if AlchemyPot::FailureItem.size > 0

     

    $game_party.alchemy_pot[0] = ["Wrong", @ingredients.clone]

     

    $game_party.alchemy_pot[1] = Graphics.frame_count

     

    $game_party.alchemy_pot[2] = AlchemyPot::FailureTime * Graphics.frame_rate * 60

     

    @command_window.active = false

     

    return

     

    else

     

    for item in @ingredients

     

    $game_party.gain_item(item, 1)

     

    end

     

    @ingredients = []

     

    @item_window.refresh

     

    @pot_window.refresh(@ingredients)

     

    end

     

    end

     

     

    def find_recipe(items)

     

    for i in AlchemyPot::Formula.keys

     

    formula = item_sort(i)

     

    ingredients = item_sort(items)

     

    if formula == ingredients

     

    return i

     

    end

     

    end

     

    end

     

     

    def item_sort(formula)

     

    i = []; w = []; a = []

     

    for item in 0...formula.size

     

    case formula[item]

     

    when RPG::Item

     

    i.push(formula[item].id)

     

    i.sort!

     

    when RPG::Weapon

     

    w.push(formula[item].id)

     

    w.sort!

     

    when RPG::Armor

     

    a.push(formula[item].id)

     

    a.sort!

     

    end

     

    end

     

    formula = []

     

    for item in i

     

    formula.push($data_items[item])

     

    end

     

    for item in w

     

    formula.push($data_weapons[item])

     

    end

     

    for item in a

     

    formula.push($data_armors[item])

     

     

    end

     

    return formula

     

    end

     

    end

     

     

     

     

    Per chiamare il pentolone usate il comando script degli eventi ed inserite

     

    $scene = Scene_AlchemyPot.new

     

     

    Autore:

    The Sleeping Leonhart.

     

    Bug e Conflitti : Nessuno

     

    Spero vi possa aiutare e spero non ci sia già... Almeno io non ho trovato nulla a riguardo xD

×
×
  • Create New...