Jump to content
Rpg²S Forum

Sleeping Leonhart

Utenti
  • Posts

    569
  • Joined

  • Last visited

Posts posted by Sleeping Leonhart

  1. Sono un po di fretta ma provo a risponderti comunque.

    Allora per capire quanto dura un secondo come credo avrai capito devi vedere il frame rate, quindi l'immagine per attraversare lo schermo ci mette, (640 / frame_rate) secondi, nel caso di 40 FPS ci mette 16 secondi con lo spostamento di un pixel ad ogni update.

    Non occorre nessun wait, ti basti sapere che la funzione update è chiamata una volta a frame e quindi ti puoi regolare di conseguenza, non so fai un contatore che ti conta n frame e poi si riazzera quando ha raggiunto n e gli fai fare quello che vuoi (pratica molto usata, mi sembra anche gli eventi fanno così), ti prendi il resto della divisione del frame_count per vedere se sono passati tot frame o secondi (questa non so quanto sia affidabile xD), puoi sbizzarrirti come più ti piace, non è poi tanto difficile dopo che ci prendi la mano.

     

    Per quanto riguarda il frame_rate, quello dovrebbe rimanere invariato a meno che non lo cambi, solo che come hai detto tu il tuo pc ne riproduce di meno a schermo (credo, dovrei approfondire con qualche esperimento).

     

    Altra cosa, perchè usi tutte variabili globali? è solo un esempio vero? Altra cosa, in questo caso (come in molti casi in rpg maker) la creazione di altri thread è prettamente inutile, ti conviene mettere tutto in un metodo update che poi richiamerai ad ogni aggiornamento.(scusa la spiegazione da cani ma meglio di così non riesco a spiegarmi :P)

     

    Ora vado che mi stanno trascinando via dal PC, buona pasqua e buona programmazione :biggrin:

  2. 1) Serve quando vuoi modificare un metodo senza sovrascriverlo, in poche parole l'alias contiene il vecchio metodo,

    esempio

    def ciccio  print "A"end alias old_ciccio cicciodef ciccio  old_ciccio  print "B"end

    Quando chiami ciccio questo ti stamperà A e poi B

     

    2) Come fai a non capire un ciclo semplice come il for? Comunque il for è costituito così

    for indice in espressione  fai qualcosaend

    nell'indice andrà a finire ciascun valore dell'espressione, esempio

    for i in 0...3  print iend

    Stampa 0 1 2

     

    3)Si esatto, in questo caso ti sono utili gli alias che ti ho spiegato sopra se magari vuoi modificare un metodo ma non sovrascriverlo

     

    Se non capisci qualcosa sono a tua disposizione

  3. Sei fortunato in quanto ho appena finito un bs laterale e quindi ti posso dare qualche suggerimento, ti anticipo però che l'ho fatto modificando il bs standard e non ricreando le classi da 0 così da mantenere una buona compatibilità con gli script standard e con quelli creati da terzi.

    Allora io ho fatto così:

    In Game_Battler ho messo la gestione dei parametri quali coordinate del battler, calcolo del frame da mostrare, nome della grafica e altro, in Sprite_Battler invece ho messo la gestione del movimento del battler, la visualizzazione del frame, il movimento del battler verso il nemico e altra robaccia.

    Il Game_Battler viene passato allo Sprite_Battler come parametro @battler (in poche parole come fa rpg maker) e dal battler si prende tutte le informazioni che gli servono.

    Per quanto riguarda le domande ti rispondo in ordine:

    1) Puoi mostrare quante immagini vuoi, almeno finchè Rpg Maker riesce a tenerle, poi dipende anche dal PC su cui gire Rpg Maker credo.

    2) Si, puoi usare la funzione blt e stretch_blt della classe bitmap, ti consiglio di guardartele sulla guida di Rpg Maker perchè io spiego da cane.

    3) Io non conosco la funzione wait, conosco la funzione sleep che ti stoppa l'esecuzione per n secondi, il wait degli eventi invece è un aggiornamento "a vuoto" dell'evento, nel senso che aggiorna l'evento senza fargli eseguire le operazioni listate al suo interno.

    4) Cosa intendi per salvare la variabile? Cioè se vuoi salvare un oggetto su file usa il metodo

    Marhsal.dump(oggetto, file)

    e poi per caricarlo usa il metodo

    ogetto = Marshal.load(file)

    La pressione di F9 mostra semplicemente i valori delle switch e delle variabili facendo riferimento a

    $game_switches e $game_variables, non serializza nulla.

  4. vai in Game_Party, dovresti trovare questo:

      def gain_item(item, n, include_equip = false)	number = item_number(item)	case item	when RPG::Item	  @items[item.id] = [[number + n, 0].max, 99].min	when RPG::Weapon	  @weapons[item.id] = [[number + n, 0].max, 99].min	when RPG::Armor	  @armors[item.id] = [[number + n, 0].max, 99].min	end	n += number	if include_equip and n < 0	  for actor in members		while n < 0 and actor.equips.include?(item)		  actor.discard_equip(item)		  n += 1		end	  end	end  end

    Cambia i 99 con ciò che vuoi.

    I negozi però ti venderanno sempre 99 ogetti al massimo, per cambiare vai per prima cosa in Window_ShopBuy

    e cambia il 99 all'interno di questo codice con il numero da te deciso.

    enabled = (item.price <= $game_party.gold and number < 99)

    Successivamente vai in Scene_Shop e cambia i 99 che trovi qui nel numero scelto

      def update_buy_selection	@status_window.item = @buy_window.item	if Input.trigger?(Input::B)	  Sound.play_cancel	  @command_window.active = true	  @dummy_window.visible = true	  @buy_window.active = false	  @buy_window.visible = false	  @status_window.visible = false	  @status_window.item = nil	  @help_window.set_text("")	  return	end	if Input.trigger?(Input::C)	  @item = @buy_window.item	  number = $game_party.item_number(@item)	  if @item == nil or @item.price > $game_party.gold or number == 99		Sound.play_buzzer	  else		Sound.play_decision		max = @item.price == 0 ? 99 : $game_party.gold / @item.price		max = [max, 99 - number].min		@buy_window.active = false		@buy_window.visible = false		@number_window.set(@item, max, @item.price)		@number_window.active = true		@number_window.visible = true	  end	end  end

  5. In Game_Battler 3 sostituisci

    atk = [attacker.atk - self.pdef / 2, 0].max
    self.damage = atk * (20 + attacker.str) / 20

    con

    self.damage = ((attacker.str / 100) - (self.pdef / 100) + 6) / 2 * 100

    L'arrotondamento è per difetto in quanto considera solo la parte intera del numero.

  6. Non ti ho mica capito?

    Roba tipo

    ((attacker.str / 100) - (self.pdef / 100) + 6) / 2 - (attacker.str / 100) - 1

    Sono giusti?(attacker è l'attaccante, self è il difensore, pdef è la difesa fisica e str è la forza)

    Altrimenti spiega un po meglio i calcoli da fare.

  7. Perchè non implementate un evidenziatore di sintassi?(Tipo questo)

    Secondo me sarebbe molto comodo, oltre a rendere la vita un po più facile agli scripter potrebbe essere utile per un bug fixing rapido, del tipo:

    "Aiuto mi da errore alla linea 666"

    lo scripter guarda il codice tutto bello colorato e trova la linea da sistemare, e se è una cosa rapida la sistema in un nanosecondo. Inoltre fa molto cool & profescional :sisi:

  8. Fatto in 5 minuti

     

    #==============================================================================
    # ** Custom Selection Cursor
    #------------------------------------------------------------------------------
    #  Autore: The Sleeping Leonhart
    #  Versione: 1.0
    #  Data di rilascio: 28/03/2009
    #------------------------------------------------------------------------------
    #  Descrzione:
    #	Questo script serve per customizzare il cursore delle finestre selezionabili
    #------------------------------------------------------------------------------
    #  Versione:
    #	1.0 (28/03/2009): Versione Base.
    #------------------------------------------------------------------------------
    #  Istruzioni:
    #	Per personalizzare lo script andate nella sezione Configurazione.
    #==============================================================================
    
    #==============================================================================
    # Configurazione
    #==============================================================================
    module Custom_Selection_Cursor
     #=========================================================================
     # Speed: Imposta la velocità dell'animazione.
     #-------------------------------------------------------------------------
     # Sintassi:
     #   Speed = speed
     # Parametri:
     #   speed: velocità dell'animazione del cursore espressa in frame.
     #=========================================================================
     Speed = 5
     #=========================================================================
     # CursorName: Imposta il nome del file del cursore.
     #-------------------------------------------------------------------------
     # Sintassi:
     #   CursorName = name
     # Parametri:
     #   name: nome del file del cursore, il file deve essere situato in Pictures.
     #=========================================================================
     CursorName = "Selection Cursor"
     #=========================================================================
     # Allignment: Imposta l'allineamento orizzontale del cursore.
     #-------------------------------------------------------------------------
     # Sintassi:
     #   Allignment = type
     # Parametri:
     #   type: 0 Allineato a sinistra
     #		 1 Allineato a destra
     #		 2 Centrato
     #=========================================================================
     Allignment = 0
     #=========================================================================
     # Adjustment: Imposta la correzione delle coordinate del cursore.
     #-------------------------------------------------------------------------
     # Sintassi:
     #   Adjustment = [x, y]
     # Parametri:
     #   x: correzione della coordinata x.
     #   y: correzione della coordinata y.
     #=========================================================================
     Adjustment = [0, 0]
    end
    
    class Window_Selectable
     #--------------------------------------------------------------------------
     # * Inizializza la classe
     #--------------------------------------------------------------------------
     alias tslcstmslctncrsr_wndwslctbl_init initialize
     def initialize(x, y, width, height)
    tslcstmslctncrsr_wndwslctbl_init(x, y, width, height)
    @cursor = Sprite.new
    @cursor.visible = false
    @cursor.bitmap = RPG::Cache.picture(Custom_Selection_Cursor::CursorName)
    @cursor.z = self.z + 1
    @cursor.src_rect.width = @cursor.bitmap.height
    @cursor_frame = 0
    @cursor_count = 0
     end
     #--------------------------------------------------------------------------
     # * Effettua il dispose della finestra
     #--------------------------------------------------------------------------
     def dispose
    super
    @cursor.bitmap.dispose
    @cursor.dispose
     end
     #--------------------------------------------------------------------------
     # * Aggiorna il contenuto della finestra
     #--------------------------------------------------------------------------
     alias tslcstmslctncrsr_wndwslctbl_pdt update
     def update
    tslcstmslctncrsr_wndwslctbl_pdt
    @cursor.visible = (self.visible && self.active) if @cursor.visible != (self.visible && self.active)
    update_cursor_frame
    @cursor.x = self.cursor_rect.x + self.x + 16 + adjustment
    @cursor.y = self.cursor_rect.y + self.y + 16 + Custom_Selection_Cursor::Adjustment[1]
    if self.z + 1 != @cursor.z
      @cursor.z = self.z + 1
    end
     end
     #--------------------------------------------------------------------------
     # * Calcola la correzione orizzontale del cursore
     #--------------------------------------------------------------------------
     def adjustment
    adjustment = Custom_Selection_Cursor::Adjustment[0]
    case Custom_Selection_Cursor::Allignment
    when 0
      adjustment -= @cursor.bitmap.height
    when 1
      adjustment += self.cursor_rect.width
    when 2
      adjustment += (self.cursor_rect.width - @cursor.bitmap.height) / 2
    end
    return adjustment
     end
     #--------------------------------------------------------------------------
     # * Aggiorna i frame del cursore
     #--------------------------------------------------------------------------
     def update_cursor_frame
    @cursor_count = (@cursor_count + 1) % Custom_Selection_Cursor::Speed
    if @cursor_count == 0
      @cursor_frame = (@cursor_frame + 1) % (@cursor.bitmap.width / @cursor.bitmap.height)
    end
    @cursor.src_rect.x = @cursor_frame * @cursor.bitmap.height
     end
    end

     

    Se non vuoi il rettangolo di selezione standard cancellalo dalla windowskin.

    Ogni frame del cursore deve stare in un quadrato la cui larghezza deve essere pari all'altezza totale dell'immagine,

    il resto è quasi tutto configurabile.

  9. Con calma xD non sto mica sempre davanti al pc.

    Ho preso la demo del Takentai XP e ci ho fatto sopra questa versione, vedi se funziona:

     

    #==============================================================================
    # ** Aeon System SBS Takentai Version
    #------------------------------------------------------------------------------
    # Autore: The Sleeping Leonhart
    # Versione: 3.0
    # Data di rilascio: 28/03/2009
    #------------------------------------------------------------------------------
    # Descrizione:
    # Questo script permette di evocare degli Eoni che sostituiscono il party per tutta
    # la loro permanenza. Se gli Eoni muoiono il Party torna in battaglia.
    #------------------------------------------------------------------------------
    # Istruzioni:
    # Create delle Skill che serviranno per richiamare gli Eoni.
    # Per personalizzare lo script andate nella sezione Configurazione.
    #==============================================================================
    
    #==============================================================================
    # Configurazione
    #==============================================================================
    
    module Aeon_System
     #=========================================================================
     # Aeon_Skill: Imposta le skill che evocano gli Eoni.
     #-------------------------------------------------------------------------
     # Sintassi:
     # Aeon_Skill = {Skill_ID => [[Actor_ID, ...], Turn, Type],...}
     # Parametri:
     # Skill_ID: Id della skill nel database
     # Actor_ID: Id dell'eroe nel database
     # Turn: Numeri di turni in cui l'eone resta in battaglia, se 0 resta fino al ritiro.
     # Type: 1:Evoca solo l'Eone;
     # 2:Evoca l'eone e l'invocatore;
     # 3:Sostituisce l'evocatore con l'eone.
     #=========================================================================
     Aeon_Skill = {47=>[[3,4],2,1],61=>[[3,4],2,1]}
     #=========================================================================
     # Return_Skill: Imposta la skill che richiama gli Eoni.
     #-------------------------------------------------------------------------
     # Sintassi:
     # Return_Skill= Skill_ID
     # Parametri:
     # Skill_ID: Id della skill nel database
     #=========================================================================
     Return_Skill = 81
     #=========================================================================
     # Transition: Imposta la transizione visualizzata durante l'evocazione.
     #-------------------------------------------------------------------------
     # Sintassi:
     # Transition = String
     # Parametri:
     # String: Nome della Transizione
     #=========================================================================
     Transition = "001-Blind01"
     #=========================================================================
     # BGM: Imposta la musica eseguita durante i truni dell'evocazione.
     #-------------------------------------------------------------------------
     # Sintassi:
     # BGM = {Skill_ID => String}
     # Parametri:
     # Skill_ID: Id della skill nel database che richiama l'eone
     # String: Nome della musica presente nella cartella BGM, se nil la musica non cambia
     #=========================================================================
     BGM = {57 => "005-Boss01"}
     #=========================================================================
     # BGM.default: Imposta la musica per gli Eoni non dichiarati in BGM.
     #-------------------------------------------------------------------------
     # Sintassi:
     # BGM.default = String
     # Parametri:
     # String: Nome della musica presente nella cartella BGM, se nil la musica non cambia
     #=========================================================================
     BGM.default = nil
     #=========================================================================
     # Experience: Imposta se gli Eoni prendono esperienza
     #-------------------------------------------------------------------------
     # Sintassi:
     # Experience = Boolean
     # Parametri:
     # Boolean: Se true gli Eoni prendono esperienza, altrimenti no
     #=========================================================================
     Experience = true
    end
    
    $tsl_script = [] if $tsl_script == nil
    $tsl_script.push("Aeon System")
    
    class Scene_Battle
     #--------------------------------------------------------------------------
     # * Main Processing
     #--------------------------------------------------------------------------
     alias tslaeons_scenebattle_main main
     def main
    @old_party = []
    @aeon_turn = 0
    @turn_passed = 0
    @evocated = false
    tslaeons_scenebattle_main
     end
     #--------------------------------------------------------------------------
     # * Determine Battle Win/Loss Results
     #--------------------------------------------------------------------------
     alias tslaeons_scene_battle_judge judge
     def judge
    if $game_party.all_dead? and @evocated
      call_old_party
    end
    # Call old Method
    tslaeons_scene_battle_judge
     end
     #--------------------------------------------------------------------------
     # * Action End
     #--------------------------------------------------------------------------
     alias tslaeons_scenebattle_action_end action_end
     def action_end
    tslaeons_scenebattle_action_end
    skill_id = @action_battler.current_action.skill_id
    if @aeon_turn != 0
      if ($game_temp.battle_turn - @turn_called) == @aeon_turn and @evocated
    	call_old_party
      end
    end
    if @action_battler.current_action.kind == 1
      a = true
      for enemy in $game_troop.enemies
    	if enemy.exist?
    	  a = false
    	end
      end
      call_aeon(skill_id) if Aeon_System::Aeon_Skill.include?(skill_id) and a == false and !@evocated
      call_old_party if Aeon_System::Return_Skill == skill_id and @evocated
    end
     end
     #--------------------------------------------------------------------------
     # * Call an Aeon
     #--------------------------------------------------------------------------
     def call_aeon(skill_id)
    @atb_meters.dispose if METERS
    @atb_bars.dispose if BARS
    @old_party = $game_party.actors.dup
    new_party = []
    aeon = Aeon_System::Aeon_Skill[skill_id]
    for i in aeon[0]
      new_party.push($game_actors[i])
      $game_actors[i].evocated = true
    end
    case aeon[2]
    when 2
      new_party.push($game_actors[@active_battlers.id])
    when 3
      for actor in $game_party.actors
    	new_party.push($game_actors[actor.id])
      end
      new_party.delete($game_actors[@active_battlers.id])
    end
    if Aeon_System::Transition != nil
      Graphics.freeze
      $game_temp.transition_processing = true
      $game_temp.transition_name = Aeon_System::Transition
    end
    $game_party.actors = new_party.dup
    @aeon_escape = $game_temp.battle_can_escape
    $game_temp.battle_can_escape = false
    @aeon_turn = aeon[1]
    @turn_called = $game_temp.battle_turn
    @evocated = true
    bgm = Aeon_System::BGM
    Audio.bgm_play("Audio/BGM/" + bgm[skill_id], 100, 100) if bgm.include?(skill_id) and bgm[skill_id] != nil
    @old_current_battler = []
    for battler in @current_battler
      if battler.is_a?(Game_Actor)
    	@old_current_battler.push(battler)
    	@current_battler.delete(battler)
      end
    end
    @spriteset.refresh_actor_sprites
    @status_window.refresh
    @atb_meters = Atb_Meters.new if N01::METERS
    @atb_bars = Atb_Bars.new if N01::BARS
     end
     #--------------------------------------------------------------------------
     # * Call the old Party
     #--------------------------------------------------------------------------
     def call_old_party
    if Aeon_System::Transition != nil
      Graphics.freeze
      $game_temp.transition_processing = true
      $game_temp.transition_name = Aeon_System::Transition
    end
    @atb_meters.dispose if METERS
    @atb_bars.dispose if BARS
    $game_party.actors = @old_party.dup
    $game_system.bgm_play($game_system.battle_bgm)
    $game_temp.battle_can_escape = @aeon_escape
    for battler in @current_battler
      @current_battler.delete(battler) if battler.is_a?(Game_Actor)
    end
    for battler in @old_current_battler
      @current_battler.push(battler)
    end
    @spriteset.refresh_actor_sprites
    @status_window.refresh
    @atb_meters = Atb_Meters.new if N01::METERS
    @atb_bars = Atb_Bars.new if N01::BARS
    @evocated = false
     end
     #--------------------------------------------------------------------------
     # * Start After Battle Phase
     #--------------------------------------------------------------------------
     alias tslaeons_scenebattle_start_phase5 start_phase5
     def start_phase5
    if @evocated
      call_old_party
    end
    if Aeon_System::Experience
      exp = 0
      for enemy in $game_troop.enemies
    	unless enemy.hidden
    	  exp += enemy.exp
    	end
      end
      for i in 1...$data_actors.size
    	actor = $game_actors[i]
    	if actor.cant_get_exp? == false
    	  if actor.evocated == true
    		last_level = actor.level
    		actor.exp += exp
    		actor.evocated = false
    	  end
    	end
      end
    end
    # Call old Method
    tslaeons_scenebattle_start_phase5
     end
    end
    
    class Spriteset_Battle
     def refresh_actor_sprites
    for sprite in @actor_sprites
      sprite.dispose
    end
    @actor_sprites.clear
    for i in 0...$game_party.actors.size
      @actor_sprites.push(Sprite_Battler.new(@viewport2, $game_party.actors[i]))
    end
     end
     
     alias tslaeon_sprtstbttl_st_stnd_b_ctn set_stand_by_action
     def set_stand_by_action(actor, index)
    return if actor && @actor_sprites[index] == nil
    return if !actor && @enemy_sprites[index] == nil
    tslaeon_sprtstbttl_st_stnd_b_ctn(actor, index)
     end
    end
    
    class Game_Actor < Game_Battler
     #--------------------------------------------------------------------------
     # * Public Instance Variables
     #--------------------------------------------------------------------------
     attr_accessor :evocated
     #--------------------------------------------------------------------------
     # * Object Initialization
     # actor_id : actor ID
     #--------------------------------------------------------------------------
     alias tslaeons_game_actor_initialize initialize
     def initialize(actor_id)
    super()
    @evocated = false
    # Call old Method
    tslaeons_game_actor_initialize(actor_id)
     end
    end
    
    class Game_Party
     #--------------------------------------------------------------------------
     # * Public Instance Variables
     #--------------------------------------------------------------------------
     attr_accessor :actors # actors
    end

     

    Va messo sotto lo script dell'ATB, non l'ho testato con gli overdrive e tutti quegli altri ammenicoli, non mi andava, troppa roba.

  10.  

    module RPG
     class Sprite < ::Sprite
    def damage(value, critical)
      dispose_damage
      if value.is_a?(Numeric)
    	damage_string = value.abs.to_s
      else
    	damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
    	bitmap.font.color.set(176, 255, 144)
      else
    	bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
    	bitmap.font.size = 20
    	bitmap.font.color.set(0, 0, 0)
    	bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
    	bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
    	bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
    	bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
    	bitmap.font.color.set(255, 255, 255)
    	bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new(self.viewport)
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80
      @_damage_sprite.oy = 20
      @_damage_sprite.x = self.x
      @_damage_sprite.y = self.y - self.oy / 2
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
     end
    end

     

    Preso direttamente dall'help, cambia il valore di @_damage_sprite.y e ti sistemi la y come vuoi.

    Incollalo sopra tutti gli script, credo che dovrebbe andare

  11. MMM vediamo, per prima cosa cambia

    attr_reader :licenseboard

    in

    attr_accessor :licenseboard

    poi usa

    grid = GridPanel.new
    grid.type = "Skill"
    grid.value = IDSKILLDAAPPRENDERE
    grid.ap = COSTOINLP
    $game_party.actors[POSIZIONEMEMBROPARTY].licenseboard[1][NUMEROLICENZA] = grid

    Le scritte in maiuscolo sono i valori che devi mettere tu.

    POSIZIONEMEMBROPARTY parte da 0 e non da 1

  12. Ti crei una condizione con Limitazione

    Non Può agire

    e in Condizioni di Recupero metti

    3 Turni dopo si recupera al 100%

    Poi fai che la skill Time Stop infligge quella condizione.

    Per capirci:

    http://img293.imageshack.us/img293/7836/hrsfdgs.png

    Niente script xD

  13. Aaaaallora in Scene_LBoard aggiungi a def initialize(actor)

    questo

    @index = @actor.index

    devi metterlo sotto @actor = actor

    Poi in def update_command_selection aggiungi

      if Input.trigger?(Input::L)	  $game_system.se_play($data_system.cursor_se)	  @index = (@index + $game_party.actors.size - 1) % $game_party.actors.size	  $scene = Scene_LBoard.new($game_party.actors[@index])	  return	end		if Input.trigger?(Input::R)	  $game_system.se_play($data_system.cursor_se)	  @index = (@index + 1) % $game_party.actors.size	  $scene = Scene_LBoard.new($game_party.actors[@index])	  return	end

    Dovrebbe funzionare ;)

  14. License Board System

     

    Descrizione


    Mero copia/incolla del topic della versione VX.
    Questo script simula il sistema di licenze di Final Fantasy XII.


    Autore


    The Sleeping Leonhart


    Allegati


    Demo


    Script

     

     

     

    #==============================================================================
    # ** License Board
    #------------------------------------------------------------------------------
    # Autore: The Sleeping Leonhart
    # Versione: 1.0
    # Data di rilascio: 20/03/2009
    #------------------------------------------------------------------------------
    # Descrzione:
    # Questo script simula il sistema di licenze di Final Fantasy XII.
    #------------------------------------------------------------------------------
    # Versione:
    # 1.0 (20/03/2009): Versione Base.
    #------------------------------------------------------------------------------
    # Istruzioni:
    # Inserire il file BoardSystem in System.
    # Per far apparire la scacchiera delle licenze usare:
    # $scene = Scene_LBoard.new(eroe)
    # Per personalizzare lo script andate nella sezione Configurazione.
    #==============================================================================
    #==============================================================================
    # Configurazione
    #=============================================================================
    module License_Board
    	#=========================================================================
    	# Board: Imposta la License Board per gli eroi.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# Board = {actor_id => gridfile, ...}
    	# Parametri:
    	# actor_id: id dell'eroe
    	# gridfile: nome del file della License Board
    	#=========================================================================
    	Board = {1 => "Grid1"}
    	#=========================================================================
    	# Board.default: Imposta la License Board per gli eroi non definiti.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# Board.default = gridfile
    	# Parametri:
    	# gridfile: nome del file della License Board
    	#=========================================================================
    	Board.default = "Grid1"
    	#=========================================================================
    	# PreUnlockedPanel: Imposta le caselle gia sbloccate.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# PreUnlockedPanel = {actor_id => [panel, ...], ...}
    	# Parametri:
    	# actor_id: id dell'eroe
    	# panel: numero del pannello da sbloccare
    	#=========================================================================
    	PreUnlockedPanel = {1 => [11], 2 =>[6, 11], 3 => [1], 4 => [1, 16]}
    	#=========================================================================
    	# Icon: Imposta le icone visualizzate per i parametri.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# Icon = {param => icon_name, ...}
    	# Parametri:
    	# param: nome del parametro. I parametri possono essere:
    	# "Hp", "Mp", "Atk", "Def", "Int", "Agi"
    	# icon_index: nome dell'icona mostrata
    	#=========================================================================
    	Icon = { "Hp" => "021-Potion01",
    	"Mp" => "022-Potion02",
    	"Atk" => "048-Skill05",
    	"Dex" => "048-Skill05",
    	"Int" => "048-Skill05",
    	"Agi" => "048-Skill05"
    	}
    	#=========================================================================
    	# Animation_Id: Imposta l'animazione mostrata allo sblocco di una casella.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# Animation_Id = animation_id
    	# Parametri:
    	# animation_id: id dell'animazione, inserire nil se non si vuole mostrare
    	#=========================================================================
    	Animation_Id = 22
    	#=========================================================================
    	# EnemyLP: Imposta gli LP ricevuti dai nemici.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# EnemyLP = {enemy_id => lp, ...}
    	# Parametri:
    	# enemy_id: id del nemico
    	# lp: numero di lp ricevuti
    	#=========================================================================
    	EnemyLP = {1=> 10}
    	#=========================================================================
    	# EnemyLP.default: Imposta gli LP ricevuti dai nemici non definiti.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# EnemyLP.default = lp
    	# Parametri:
    	# lp: numero di lp ricevuti
    	#=========================================================================
    	EnemyLP.default = 40
    	#=========================================================================
    	# LPName: Imposta il nome degli lp.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# LPName = string
    	# Parametri:
    	# string: nome degli lp
    	#=========================================================================
    	LPName = "Lp"
    	#=========================================================================
    	# Background: Imposta il background per la License Board.
    	#-------------------------------------------------------------------------
    	# Sintassi:
    	# Background = string
    	# Parametri:
    	# string: nome del file di background(situato in system), inserire nil
    	# per non mostrare il background
    	#=========================================================================
    	Background = "LicenseBG"
    end
    class GridPanel
    	attr_accessor :type
    	attr_accessor :value
    	attr_accessor :ap
    	def initialize
    		@type = ""
    		@value = 0
    		@ap = 0
    	end
    end
    class Game_Actor
    	attr_accessor :license
    	attr_accessor :licenselearned
    	attr_accessor :lp
    	attr_accessor :class
    	attr_reader :licenseboard
    	alias tsllcnsbrdsstm_gmctr_ntzlz initialize
    	def initialize(actor_id)
    		@class = $data_classes[$data_actors[actor_id].class_id].clone
    		tsllcnsbrdsstm_gmctr_ntzlz(actor_id)
    		@license = {}
    		if License_Board::PreUnlockedPanel[actor_id] != nil
    			for i in License_Board::PreUnlockedPanel[actor_id]
    				@license[i] = true
    			end
    		end
    		@license.default = false
    		@licenselearned = []
    		@licenseboard = load_data("Data/" + License_Board::Board[actor_id] + ".rxdata")
    		@lp = 0
    	end
    	def equippable?(item)
    		if item.is_a?(RPG::Weapon)
    			if @class.weapon_set.include?(item.id)
    				return true
    			end
    		end
    		if item.is_a?(RPG::Armor)
    			if @class.armor_set.include?(item.id)
    				return true
    			end
    		end
    		return false
    	end
    	alias tsllcnsbrdsstm_gmctr_clss_d class_id
    	def class_id=(class_id)
    		tsllcnsbrdsstm_gmctr_clss_d
    		if $data_classes[class_id] != nil
    			@class = $data_classes[class_id].clone
    		end
    	end
    end
    class Game_Enemy
    	attr_reader :lp
    	alias tsllcnsbrdsstm_gmnm_ntzlz initialize
    	def initialize(troop_id, member_index)
    		tsllcnsbrdsstm_gmnm_ntzlz(troop_id, member_index)
    		@lp = License_Board::EnemyLP[@enemy_id]
    	end
    end
    class Window_LicenseHelp < Window_Base
    	def initialize
    		super(0, 416 - 80, 640, 96)
    		self.contents = Bitmap.new(width - 32, height - 32)
    	end
    	def set_text(text, align = 0)
    		if text != @text or align != @align
    			self.contents.clear
    			self.contents.font.color = system_color
    			self.contents.draw_text(4, 0, self.width - 40, 24, text[0].to_s, align)
    			self.contents.font.color = normal_color
    			self.contents.draw_text(4, 24, self.width - 40, 24, text[1].to_s, align)
    			@text = text
    			@align = align
    		end
    	end
    end
    class Window_LicenseB < Window_Selectable
    	def initialize(actor)
    		super(0, 0, 640, 480)
    		@actor = actor
    		@item_max = @actor.licenseboard[0][0] * @actor.licenseboard[0][1]
    		@column_max = @actor.licenseboard[0][1]
    		self.contents = Bitmap.new([width - 32, (@column_max - 1) * 24].max, [height - 32, row_max * 24].max)
    		@system = RPG::Cache.picture("BoardSystem")
    		create_cursor
    		refresh
    		self.opacity = 0
    		self.index = 0
    	end
    	def create_cursor
    		@cursor = RPG::Sprite.new
    		@cursor.z = self.z + 4
    		@cursor.bitmap = Bitmap.new(24, 24)
    		@cursor.bitmap.blt(0, 0, @system, Rect.new(24, 0, 24, 24))
    	end
    	def item_rect(index)
    		rect = Rect.new(0, 0, 0, 0)
    		rect.width = 24
    		rect.height = 24
    		rect.x = 4 + index % @column_max * 24
    		rect.y = 12 + index / @column_max * 24
    		return rect
    	end
    	def show_animation(id)
    		return if id == nil
    		@cursor.animation($data_animations[id], false)
    	end
    	def refresh
    		self.contents.clear
    		board = @actor.licenseboard
    		for i in 0...@item_max
    			next if board[1][i].type == ""
    			draw_panel(i)
    		end
    	end
    	def update
    		super
    		@cursor.update
    	end
    	def draw_panel(i)
    		rect = item_rect(i)
    		sr = Rect.new(0, (((rect.x + rect.y) / 24) % 2) * 24, 24, 24)
    		self.contents.blt(rect.x, rect.y, @system, sr)
    		if @actor.license[i] == true
    			panel = @actor.licenseboard[1][i]
    			if panel.type == "Skill"
    				icon = $data_skills[panel.value].icon_name
    			elsif panel.type == "Weapon"
    				icon = $data_weapons[panel.value[0]].icon_name
    			elsif panel.type == "Armor"
    				icon = $data_armors[panel.value[0]].icon_name
    			else
    				icon = License_Board::Icon[panel.type]
    			end
    			bitmap = RPG::Cache.icon(icon)
    			self.contents.blt(rect.x, rect.y, bitmap, Rect.new(0, 0, 24, 24), @actor.licenselearned.include?(i) ? 255 : 128)
    			self.contents.font.size = 12
    			self.contents.draw_text(rect.x, rect.y + 6, 24, 24, panel.ap.to_s)
    		end
    	end
    	def dispose
    		super
    		@cursor.bitmap.dispose
    		@cursor.dispose
    	end
    	def update_cursor_rect
    		self.cursor_rect.set(0, 0, 0, 0)
    		rect = item_rect(index)
    		ix = rect.x - (256 * (index % @column_max) / (@column_max / 2)) - 4
    		ix = 0 if ix < 0
    		self.ox = ix
    		@cursor.x = self.x + 16 + rect.x - self.ox
    		@cursor.y = self.y + 16 + rect.y - self.oy
    	end
    	def update_help
    		panel = @actor.licenseboard[1][index]
    		return @help_window.set_text("") if panel.type == "" || !@actor.license[self.index]
    		if panel.type == "Skill"
    			skill = $data_skills[panel.value]
    			@help_window.set_text([skill.name, skill.description])
    		elsif panel.type == "Weapon"
    			text = ""
    			for i in panel.value
    				weapon = $data_weapons[i]
    				text += weapon.name + " | "
    			end
    			@help_window.set_text(["Armi", text])
    		elsif panel.type == "Armor"
    			text = ""
    			for i in panel.value
    				armor = $data_armors[i]
    				text += armor.name + " | "
    			end
    			@help_window.set_text(["Armature", text])
    		else
    			param = panel.type
    			h = {"Hp" => $data_system.words.hp, "Mp" => $data_system.words.sp, "Atk" => $data_system.words.str,
    			"Dex" => $data_system.words.dex, "Int" => $data_system.words.int, "Agi" => $data_system.words.agi}
    			@help_window.set_text([h[param], sprintf("Incrementa di %s.", panel.value)])
    		end
    	end
    end
    class Window_ActorLicensePoint < Window_Base
    	def initialize(actor)
    		super(640 - 160, 0, 160, 96)
    		self.contents = Bitmap.new(width - 32, height - 32)
    		@actor = actor
    		refresh
    	end
    	def refresh
    		self.contents.clear
    		draw_actor_graphic(@actor, 0, 0)
    		draw_actor_name(@actor, 0, 0)
    		self.contents.font.color = system_color
    		self.contents.draw_text(64, 40, 128, 24, License_Board::LPName)
    		self.contents.font.color = normal_color
    		self.contents.draw_text(64, 40, 96, 24, @actor.lp.to_s, 1)
    	end
    end
    class Window_BattleResultLp < Window_Base
    	def initialize(ap)
    		super(160, 208, 320, 64)
    		self.contents = Bitmap.new(width - 32, height - 32)
    		self.y = 160 - height / 2
    		self.back_opacity = 160
    		self.visible = false
    		@ap = ap
    		refresh
    	end
    	def refresh
    		self.contents.clear
    		self.contents.font.color = normal_color
    		cx = contents.text_size(@ap.to_s).width
    		self.contents.draw_text(4, 0, cx, 32, @ap.to_s)
    		self.contents.font.color = system_color
    		self.contents.draw_text(cx + 8, 0, 128, 32, License_Board::LPName)
    	end
    end
    class Scene_Battle
    	alias tslaps_scenebattle_start_phase5 start_phase5
    	def start_phase5
    		tslaps_scenebattle_start_phase5
    		lp = 0
    		for enemy in $game_troop.enemies
    			unless enemy.hidden
    				lp += enemy.lp
    			end
    		end
    		for i in 0...$game_party.actors.size
    			actor = $game_party.actors[i]
    			actor.lp += lp
    		end
    		@result_window.visible = true if @result_window.visible != nil
    		loop do
    			Graphics.update
    			Input.update
    			break if Input.trigger?(Input::C)
    		end
    		@result_window.dispose if @result_window.visible != nil
    		@result_window = Window_BattleResultLp.new(lp)
    		@phase5_wait_count = 10
    	end
    end
    class Scene_LBoard
    	def initialize(actor)
    		@actor = actor
    	end
    	def main
    		if License_Board::Background != nil
    			@background = Sprite.new
    			@background.bitmap = RPG::Cache.picture(License_Board::Background)
    		end
    		@command_window = Window_LicenseB.new(@actor)
    		@help_window = Window_LicenseHelp.new
    		@command_window.help_window = @help_window
    		@stat_window = Window_ActorLicensePoint.new(@actor)
    		main_update
    		terminate
    	end
    	def main_update
    		Graphics.transition
    		loop do
    			Graphics.update
    			Input.update
    			update
    			if $scene != self
    				break
    			end
    		end
    		Graphics.freeze
    	end
    	def terminate
    		if License_Board::Background != nil
    			@background.bitmap.dispose
    			@background.dispose
    		end
    		@command_window.dispose
    		@help_window.dispose
    		@stat_window.dispose
    	end
    	def update
    		@command_window.update
    		if @command_window.item_rect(@command_window.index).y < 240
    			@help_window.y = 480 - @help_window.height
    			@stat_window.y = 0
    		else
    			@help_window.y = 0
    			@stat_window.y = 480 - @stat_window.height
    		end
    		if @command_window.item_rect(@command_window.index).x < 320
    			@stat_window.x = 640 - @stat_window.width
    		else
    			@stat_window.x = 0
    		end
    		if @command_window.active
    			update_command_selection
    		end
    	end
    	def update_command_selection
    		if Input.trigger?(Input::B)
    			$game_system.se_play($data_system.cancel_se)
    			$scene = Scene_Map.new
    		elsif Input.trigger?(Input::C)
    			panel = @actor.licenseboard[1][@command_window.index]
    			return if panel.type == ""
    			return $game_system.se_play($data_system.buzzer_se) if @actor.lp < panel.ap
    			if @actor.license[@command_window.index] && !@actor.licenselearned.include?(@command_window.index)
    				$game_system.se_play($data_system.decision_se)
    				lic = @actor.license[@command_window.index + 1]
    				@actor.license[@command_window.index - 1] = true if @command_window.index > 0 && (@command_window.index % @actor.licenseboard[0][1]) != 0
    				@actor.license[@command_window.index + 1] = true if (@command_window.index % @actor.licenseboard[0][1]) < @actor.licenseboard[0][1]
    				@actor.license[@command_window.index - @actor.licenseboard[0][1]] = true if @command_window.index > (@actor.licenseboard[0][1] - 1)
    				@actor.license[@command_window.index + @actor.licenseboard[0][1]] = true if @command_window.index < @actor.licenseboard[0][0] * @actor.licenseboard[0][1]
    				if panel.type == "Skill"
    					@actor.learn_skill(panel.value)
    				elsif panel.type == "Weapon"
    					for i in panel.value
    						@actor.class.weapon_set.push(i)
    					end
    					@actor.class.weapon_set.uniq!
    				elsif panel.type == "Armor"
    					for i in panel.value
    						@actor.class.armor_set.push(i)
    					end
    					@actor.class.armor_set.uniq!
    				else
    					case panel.type
    					when "Hp"
    						@actor.maxhp += panel.value
    					when "Mp"
    						@actor.maxsp += panel.value
    					when "Atk"
    						@actor.str += panel.value
    					when "Dex"
    						@actor.dex += panel.value
    					when "Int"
    						@actor.int += panel.value
    					when "Agi"
    						@actor.agi += panel.value
    					end
    				end
    				@command_window.show_animation(License_Board::Animation_Id)
    				@actor.licenselearned.push(@command_window.index)
    				@actor.lp -= panel.ap
    				@command_window.refresh
    				@stat_window.refresh
    			end
    		end
    	end
    end
    

     

     

     

    Istruzioni per l'uso


    Inserire il file BoardSystem in Pictures(gia incluso nella demo)
    Per far apparire la scacchiera delle licenze usare:

    $scene = Scene_LBoard.new(eroe)
    

    Bugs e Conflitti Noti


    N/A


    Altri Dettagli


    Non ho messo la possibilità di dover comprare le licenze prima di poterle usare, mi stavo un po antipatica come cosa se volete però l'aggiungo come possibilità. Scusate la pesantezza del file me un exe in ruby compilato occupa uno sproposito.

  15. Ho aggiornato lo script poichè avevo trovato uno stupido bug, comunque di quelli segnalati io ho provato in tutti i modi ma non li ho trovati, se mi dite le condizioni precise in cui vi sono usciti magari riesco a trovarli.

     

    @Narutofan: Per capire cosa sono le licenze guarda QUI (uno dei primi risultati di google che spiegano cosa sono le licenze).

    Inoltre ho provato a spiegarlo un po anche nella guida che sta nella demo.

  16. License Board System

    Descrizione

    Questo script simula il sistema di licenze di Final Fantasy XII.

     

    Autore

    The Sleeping Leonhart

     

    Allegati

     

    Script

    #==============================================================================
    # ** License Board
    #------------------------------------------------------------------------------
    #  Autore: The Sleeping Leonhart
    #  Versione: 1.1
    #  Data di rilascio: 20/03/2009
    #------------------------------------------------------------------------------
    #  Descrzione:
    #	Questo script simula il sistema di licenze di Final Fantasy XII.
    #------------------------------------------------------------------------------
    #  Versione:
    #	1.0 (19/03/2009): Versione Base.
    #	1.1 (20/03/2009): BugFix.
    #------------------------------------------------------------------------------
    #  Istruzioni:
    #	Inserire il file BoardSystem in System.
    #	Per incrementare gli lp di un eroe usare:
    #	  $game_actors[id].lp += NumeroLP
    #	Per far apparire la scacchiera delle licenze usare:
    #	  $scene = Scene_LBoard.new(eroe)
    #	Per personalizzare lo script andate nella sezione Configurazione.
    #==============================================================================
    
    #==============================================================================
    #  Configurazione
    #=============================================================================
    module License_Board
     #=========================================================================
     #  Board: Imposta la License Board per gli eroi.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	Board = {actor_id => gridfile, ...}
     #  Parametri:
     #	actor_id: id dell'eroe
     #	gridfile: nome del file della License Board
     #=========================================================================
     Board = {1 => "Grid1"}
     #=========================================================================
     #  Board.default: Imposta la License Board per gli eroi non definiti.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	Board.default = gridfile
     #  Parametri:
     #	gridfile: nome del file della License Board
     #=========================================================================
     Board.default = "Grid1"
     #=========================================================================
     #  PreUnlockedPanel: Imposta le caselle gia sbloccate.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	PreUnlockedPanel = {actor_id => [panel, ...], ...}
     #  Parametri:
     #	actor_id: id dell'eroe
     #	panel: numero del pannello da sbloccare
     #=========================================================================
     PreUnlockedPanel = {1 => [11], 2 =>[6, 11], 3 => [1], 4  => [1, 16]}
     #=========================================================================
     #  Icon: Imposta le icone visualizzate per i parametri.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	Icon = {param => icon_index, ...}
     #  Parametri:
     #	param: nome del parametro. I parametri possono essere: 
     #		   "Hp", "Mp", "Atk", "Def", "Int", "Agi"
     #	icon_index: indice dell'icona mostrata
     #=========================================================================
     Icon = { "Hp" => 64,
    	   "Mp" => 65,
    	   "Atk" => 120,
    	   "Def" => 121,
    	   "Int" => 122,
    	   "Agi" => 123 
    	   }
     #=========================================================================
     #  Animation_Id: Imposta l'animazione mostrata allo sblocco di una casella.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	Animation_Id = animation_id
     #  Parametri:
     #	animation_id: id dell'animazione, inserire nil se non si vuole mostrare
     #=========================================================================
     Animation_Id = 39
     #=========================================================================
     #  EnemyLP: Imposta gli LP ricevuti dai nemici.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	EnemyLP = {enemy_id => lp, ...}
     #  Parametri:
     #	enemy_id: id del nemico
     #	lp: numero di lp ricevuti
     #=========================================================================
     EnemyLP = {1=> 1}
     #=========================================================================
     #  EnemyLP.default: Imposta gli LP ricevuti dai nemici non definiti.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	EnemyLP.default = lp
     #  Parametri:
     #	lp: numero di lp ricevuti
     #=========================================================================
     EnemyLP.default = 40
     #=========================================================================
     #  LPName: Imposta il nome degli lp.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	LPName = string
     #  Parametri:
     #	string: nome degli lp
     #=========================================================================
     LPName = "Lp"
     #=========================================================================
     #  Background: Imposta il background per la License Board.
     #-------------------------------------------------------------------------
     #  Sintassi:
     #	Background = string
     #  Parametri:
     #	string: nome del file di background(situato in system), inserire nil
     #			per non mostrare il background
     #=========================================================================
     Background = "LicenseBG"
    end
    
    class GridPanel
     attr_accessor :type
     attr_accessor :value
     attr_accessor :ap
     def initialize
    @type = ""
    @value = 0
    @ap = 0
     end
    end
    
    class Game_Actor
     attr_accessor :license
     attr_accessor :licenselearned
     attr_accessor :lp
     attr_reader :licenseboard
     alias tsllcnsbrdsstm_gmctr_ntzlz initialize
     def initialize(actor_id)
    @class = $data_classes[$data_actors[actor_id].class_id].clone
    tsllcnsbrdsstm_gmctr_ntzlz(actor_id)
    @license = {}
    if License_Board::PreUnlockedPanel[actor_id] != nil
      for i in License_Board::PreUnlockedPanel[actor_id]
    	@license[i] = true
      end
    end
    @license.default = false
    @licenselearned = []
    @licenseboard = load_data("Data/" + License_Board::Board[actor_id] + ".rvdata")
    @lp = 0
     end
     
     def class
    if @class_id != $data_classes[@class_id].id
      @class = $data_classes[@class_id].clone
    end
    return @class
     end
    end
    
    class Game_Enemy
     attr_reader :lp
     alias tsllcnsbrdsstm_gmnm_ntzlz initialize
     def initialize(index, enemy_id)
    @lp = License_Board::EnemyLP[enemy_id]
    tsllcnsbrdsstm_gmnm_ntzlz(index, enemy_id)
     end
    end
    
    class Window_LicenseHelp < Window_Base
     def initialize
    super(0, 416 - 80, 544, 80)
     end
     def set_text(text, align = 0)
    if text != @text or align != @align
      self.contents.clear
      self.contents.font.color = system_color
      self.contents.draw_text(4, 0, self.width - 40, WLH, text[0], align)
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 24, self.width - 40, WLH, text[1], align)
      @text = text
      @align = align
    end
     end
    end
    
     
    class Window_LicenseB < Window_Selectable
     def initialize(actor)
    super(0, 0, 544, 416)
    @actor = actor
    @item_max = @actor.licenseboard[0][0] * @actor.licenseboard[0][1]
    @column_max = @actor.licenseboard[0][1]
    @system = Cache.system("BoardSystem")
    create_cursor
    refresh
    self.opacity = 0
    self.index = 0
     end
     
     def create_contents
    self.contents.dispose
    self.contents = Bitmap.new([width - 32, (@column_max - 1) * 24].max, [height - 32, row_max * 24].max)
     end
    
     
     def create_cursor
    @cursor = Sprite_Base.new
    @cursor.z = self.z + 1
    @cursor.bitmap = Bitmap.new(24, 24)
    @cursor.bitmap.blt(0, 0, @system, Rect.new(24, 0, 24, 24))
     end
     
     def item_rect(index)
    rect = Rect.new(0, 0, 0, 0)
    rect.width = 24
    rect.height = 24
    rect.x = 4 + index % @column_max * 24
    rect.y = 12 + index / @column_max * 24
    return rect
     end
     
     def show_animation(id)
    return if id == nil
    @cursor.start_animation($data_animations[id], false)
     end
     
     def refresh
    self.contents.clear
    board = @actor.licenseboard
    for i in 0...@item_max
      next if board[1][i].type == ""
      draw_panel(i)
    end
     end
     
     def update
    super
    @cursor.update
     end
     
     def draw_panel(i)
    rect = item_rect(i)
    sr = Rect.new(0, (((rect.x + rect.y) / 24) % 2) * 24, 24, 24)
    self.contents.blt(rect.x, rect.y, @system, sr)
    if @actor.license[i] == true
      panel = @actor.licenseboard[1][i]
      if panel.type == "Skill"
    	icon = $data_skills[panel.value].icon_index
      elsif panel.type == "Weapon"
    	icon = $data_weapons[panel.value[0]].icon_index
      elsif panel.type == "Armor"
    	icon = $data_armors[panel.value[0]].icon_index
      else
    	icon = License_Board::Icon[panel.type]
      end
      draw_icon(icon, rect.x, rect.y, @actor.licenselearned.include?(i) )
      self.contents.font.size = 12
      self.contents.draw_text(rect.x, rect.y + 6, 24, 24, panel.ap)
    end
     end
    
     def dispose
    super
    @cursor.bitmap.dispose
    @cursor.dispose
     end
     
     def update_cursor
    super
    self.cursor_rect.set(0, 0, 0, 0)
    rect = item_rect(index)
    ix = rect.x - (256 * (index % @column_max) / (@column_max / 2)) - 4
    ix = 0 if ix < 0
    self.ox = ix
    @cursor.x = self.x + 16 + rect.x - self.ox
    @cursor.y = self.y + 16 + rect.y - self.oy 
     end
     
     def update_help
    panel = @actor.licenseboard[1][index]
    return @help_window.set_text("") if panel.type == "" || !@actor.license[self.index]
    if panel.type == "Skill"
      skill = $data_skills[panel.value]
      @help_window.set_text([skill.name, skill.description])
    elsif panel.type == "Weapon"
      text = ""
      for i in panel.value
    	weapon = $data_weapons[i]
    	text += weapon.name + " | "
      end
      @help_window.set_text(["Armi", text])
    elsif panel.type == "Armor"
      text = ""
      for i in panel.value
    	armor = $data_armors[i]
    	text += armor.name + " | "
      end
      @help_window.set_text(["Armature", text])
    else
      param = panel.type
      h = {"Hp" => Vocab.hp, "Mp" => Vocab.mp, "Atk" => Vocab.atk,
    	   "Def" => Vocab.def, "Int" => Vocab.spi, "Agi" => Vocab.agi}
      @help_window.set_text([h[param], sprintf("Incrementa di %s.", panel.value)])
    end
     end
    end
    
    class Window_ActorLicensePoint < Window_Base
     def initialize(actor)
    super(544 - 160, 0, 160, 96)
    @actor = actor
    refresh
     end
     
     def refresh
    self.contents.clear
    draw_actor_face(@actor, 0, 0, 64)
    draw_actor_name(@actor, 0, 0)
    self.contents.font.color = system_color
    self.contents.draw_text(64, 40, 128, 24, License_Board::LPName)
    self.contents.font.color = normal_color
    self.contents.draw_text(64, 40, 96, 24, @actor.lp.to_s, 1)
     end
    end
    
    class Scene_Battle
     alias tsllcnsbrdsstm_scnbttl_dspl_xp_gld display_exp_and_gold
     def display_exp_and_gold
    tsllcnsbrdsstm_scnbttl_dspl_xp_gld
    lp = 0
    for enemy in $game_troop.members
      lp += enemy.lp
    end
    for actor in $game_party.members
      actor.lp += lp
    end
    if lp > 0
      text = sprintf("Hai ricevuto %s %s!", lp, License_Board::LPName)
      $game_message.texts.push('\.' + text)
    end
    wait_for_message
     end
    end
    
    class Scene_LBoard < Scene_Base
     def initialize(actor)
    @actor = actor
     end
     
     def start
    super
    create_menu_background
    if License_Board::Background != nil
      @background = Sprite.new
      @background.bitmap = Cache.system(License_Board::Background)
    end
    @command_window = Window_LicenseB.new(@actor)
    @help_window = Window_LicenseHelp.new
    @command_window.help_window = @help_window
    @stat_window = Window_ActorLicensePoint.new(@actor)
     end
    
     def terminate
    super
    dispose_menu_background
    if License_Board::Background != nil
      @background.bitmap.dispose
      @background.dispose
    end
    @command_window.dispose
    @help_window.dispose
    @stat_window.dispose
     end
    
     def update
    super
    update_menu_background
    @command_window.update
    if @command_window.item_rect(@command_window.index).y < 160
      @help_window.y = 416 - @help_window.height
      @stat_window.y = 0
    else
      @help_window.y = 0
      @stat_window.y = 416 - @stat_window.height
    end
    if @command_window.item_rect(@command_window.index).x < 240
      @stat_window.x = 544 - @stat_window.width
    else
      @stat_window.x = 0
    end
    if @command_window.active
      update_command_selection
    end
     end
    
     def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)   
      panel = @actor.licenseboard[1][@command_window.index]
      return if panel.type == ""
      return Sound.play_buzzer if @actor.lp < panel.ap
      if @actor.license[@command_window.index] && !@actor.licenselearned.include?(@command_window.index)
    	Sound.play_decision
    	lic = @actor.license[@command_window.index + 1]
    	@actor.license[@command_window.index - 1] = true if @command_window.index > 0 && (@command_window.index % @actor.licenseboard[0][1]) != 0
    	@actor.license[@command_window.index + 1] = true if (@command_window.index % @actor.licenseboard[0][1]) < @actor.licenseboard[0][1]
    	@actor.license[@command_window.index - @actor.licenseboard[0][1]] = true if @command_window.index > (@actor.licenseboard[0][1] - 1)
    	@actor.license[@command_window.index + @actor.licenseboard[0][1]] = true if @command_window.index < @actor.licenseboard[0][0] * @actor.licenseboard[0][1]
    	if panel.type == "Skill"
    	  @actor.learn_skill(panel.value)
    	elsif panel.type == "Weapon"
    	  for i in panel.value
    		@actor.class.weapon_set.push(i)
    	  end
    	  @actor.class.weapon_set.uniq! 
    	elsif panel.type == "Armor"
    	  for i in panel.value
    		@actor.class.armor_set.push(i)
    	  end
    	  @actor.class.armor_set.uniq! 
    	else
    	  case panel.type
    	  when "Hp"
    		@actor.maxhp += panel.value
    	  when "Mp"
    		@actor.maxmp += panel.value
    	  when "Atk"
    		@actor.atk += panel.value
    	  when "Def"
    		@actor.def += panel.value
    	  when "Int"
    		@actor.spi += panel.value
    	  when "Agi"
    		@actor.agi += panel.value
    	  end
    	end
    	@command_window.show_animation(License_Board::Animation_Id)
    	@actor.licenselearned.push(@command_window.index)
    	@actor.lp -= panel.ap
    	@command_window.refresh
    	@stat_window.refresh
      end
    end
     end
    end

     

    Istruzioni per l'uso

    Inserire il file BoardSystem in System(gia incluso nella demo)

    Per far apparire la scacchiera delle licenze usare:

    $scene = Scene_LBoard.new(eroe)

     

    Bugs e Conflitti Noti

    N/A

     

    Altri Dettagli

    Non ho messo la possibilità di dover comprare le licenze prima di poterle usare, mi stavo un po antipatica come cosa se volete però l'aggiungo come possibilità. Scusate la pesantezza del file me un exe in ruby compilato occupa uno sproposito.

×
×
  • Create New...