¡Bienvenido a Universo Maker!
¿Es esta la primera vez que visitas el foro? Si es así te recomendamos que te registres para tener completo acceso a todas las áreas y secciones del foro, así también podrás participar activamente en la comunidad. Si ya tienes una cuenta, conectate cuanto antes.
Iniciar Sesión Registrarme

No estás conectado. Conéctate o registrate

Ver el tema anterior Ver el tema siguiente Ir abajo Mensaje [Página 1 de 1.]

#1 KRumors XP el Sáb Sep 01, 2018 8:25 am

Reputación del mensaje :100% (2 votos)

kyonides

avatar
















KRUMORS XP
RPG Maker XP
¿Querían una forma extraña de organizar sus rumores? ¡Pues aquí la van a encontrar! Opalo Hola
Sobre el Script:
Este sencillo script trata sobre cómo "administrar" los rumores que los héroes más perezosos de tu equipo pueden llegar a buscar o descubrir durante sus andanzas por tierras lejanas.
Imágenes:

Aquí están las cuatro capturas de pantalla, no las posteé antes porque las reglas del foro me impidieron postear o editar el tema con todo y los enlaces hasta que pasaran 7 condenados días...  Opalo Enojado
Instrucciones:
♦️ Paso 1: Pegue los script Audio Base Add-Ons, Image Add-Ons y KRumors XP en el editor, esas secciones deben quedar arriba de Main. (No importa si Audio Base Add-Ons o Image Add-Ons va primero o si los pegan a una misma sección para ahorrar espacio.)
♦️ Paso 2: En KRumors XP personalice los valores de las Constantes, sí, esas que van en mayúsculas.
♦️ Paso 3: Descripcion3
♦️ Paso 4: Descripcion4
Código:


Código:
# * Audio Base Add-Ons

module Audio
  module_function
  syst = load_data('Data/System.rxdata')
  @buzzer = syst.buzzer_se
  @cancel = syst.cancel_se
  @cursor = syst.cursor_se
  @ok = syst.decision_se
  @shop = syst.shop_se
  @equip = syst.equip_se
  @se = 'Audio/SE/'
  syst = nil
  def play_buzzer() se_play(@se + @buzzer.name,@buzzer.volume,@buzzer.pitch) end
  def play_cancel() se_play(@se + @cancel.name,@cancel.volume,@cancel.pitch) end
  def play_cursor() se_play(@se + @cursor.name,@cursor.volume,@cursor.pitch) end
  def play_decision() se_play(@se + @ok.name, @ok.volume, @ok.pitch) end
  def play_shop() se_play(@se + @shop.name, @shop.volume, @shop.pitch) end
  def play_equip() se_play(@se + @equip.name, @equip.volume, @equip.pitch) end
  def play_se(se) se_play(@se + se.name, se.volume, se.pitch) end
end

Código:
# * Image Add-Ons
#   2018-09-02

module RPG::Cache
  def self.face(face_name) load_bitmap('Graphics/Faces/', face_name) end
end

module SpriteDispose
  def dispose
    bitmap.dispose rescue nil
    super
  end
end

class Sprite
  def toggle_visible() self.visible = !self.visible end
end

class RPG::Sprite
  include SpriteDispose
end

class HeaderSprite < Sprite
  BLACK = Color.new(0, 0, 0)
  WHITE = Color.new(255, 255, 255)
  RED = Color.new(255, 80, 0)
  GREEN = Color.new(0, 255, 80)
  attr_writer :font_name
  def initialize(title, bar_height=40, fill_color=0)
    super(nil)
    @title = title
    @bar_height = bar_height
    @bg_color = case fill_color
    when 0 then nil
    when 1 then BLACK
    when 2 then WHITE
    when 3 then RED
    when 4 then GREEN
    end
    self.bitmap = Bitmap.new(640, @bar_height)
  end

  def refresh
    bitmap.clear
    bitmap.fill_rect(0, 0, 640, @bar_height, @bg_color) if @bg_color
    bitmap.font.name = @font_name
    bitmap.font.size = 30
    bitmap.back_color = Color.new(255, 80, 0)
    bitmap.outline(0, 8, 640, @bar_height - 8, @title, 1)
  end
end

class Bitmap
  attr_writer :back_color, :fore_color
  def outline_colors(back_color, fore_color)
    @back_color, @fore_color = back_color, fore_color
  end

  def outline(x, y, width, height, text, align=0)
    text = text.to_s
    font.color = @back_color || Color.new(0, 0, 0)
    draw_text(x - 1, y - 1, width, height, text, align)
    draw_text(x - 1, y + 1, width, height, text, align)
    draw_text(x + 1, y + 1, width, height, text, align)
    draw_text(x + 1, y - 1, width, height, text, align)
    font.color = @fore_color || Color.new(255, 255, 255)
    draw_text(x, y, width, height, text, align)
  end
end

Código:
# * KRumors XP
#  Scripter : Kyonides-Arkanthes
#  2018-09-07

#  Free for Non Commercial Games, You got to pay a fee for including them in
#  Commercial Games.

#  Warning!

#  Some of Scene_Title and Scene_Menu methods were modified!
#  Rumors the heroes have heard during their travels include stories. They are
#  Arrays of Strings, 1 slot per story page.

# * Script Calls *

#  $scene = KRumorScene.new
#  $game_party.add_rumor_location(Location_ID)
#  $game_party.remove_reserve(Actor_ID)

# To prevent a Hero from collecting Rumors
#  KRumors.clones[Actor_ID].gossip_hater!
#  KRumors.clones[Actor_ID].rumors_state = nil

module KRumors
  MAX_RUMORS_PER_ATTEMPT = 3
  BACKDROP = 'bg quest menu'
  RUMOR_BACKDROP = 'scroll horz'
  STAGE_CURSOR = 'gem ruby mini'
  HERO_CURSOR = 'archery target mini'
  LOCATE_CURSOR = 'gem aquamarine mini'
  RUMOR_CURSOR = 'gem amethyst mini'
  LIST_TITLE_ICON = 'title label mini'
  UPDATE_WARNING_PIC = 'inactive quest label'
  LIST_BACKDROP = 'vintage scroll'
  FAILED_PICTURE = 'failed medium'
  TITLE = 'Gossip Central'
  RUMOR_LVL = 'EXP LVL'
  STATUS = 'Status'
  STATUSES = { :idle => 'Idle', :travel => 'Travelling', :return => 'Returned' }
  STAGES = ['Lazy Heroes', 'Travelers', 'Rumors Found']
  RIGHT_GUESS = 'Right Guesses'
  FALSE_RUMORS = 'False Rumors'
  DESTINATION = 'Destination'
  NO_DESTINATION = 'No Destination'
  UNKNOWN_DESTINATION = 'Unknown'
  ETA_LABEL = 'Returns in'
  UPDATE_WARNING = 'Updating Lists...'
  RUMORS = 'Rumors'
  TOTAL_RUMORS = 'Rumors Found'
  STORY_LABEL = 'The story so far...'
  BLACK = Color.new(0, 0, 0)
  BROWN = Color.new(90, 45, 0)
  class Location
    attr_reader :id, :name, :map_id, :time
    attr_writer :ready
    def initialize(new_id, name, map_id, time)
      @id = new_id
      @name = name
      @map_id = map_id
      @time = (time * 60 * Graphics.frame_rate).to_i
    end

    def update
      return if @ready or @time == 0
      @time -= 1
      @ready = @time == 0
    end
    def ready?() @ready end
  end

  class Level
    attr_reader :final_level, :basis, :inflation
    def initialize(level, basis, inflation)
      @final_level, @basis, @inflation = level, basis, inflation
    end
  end

  class Rumor
    attr_reader :accuracy, :sources_total, :sources, :locations, :story, :state
    attr_accessor :title, :caption
    def initialize(level, number, sources, locations)
      @accuracy = level
      @sources_total = number
      @sources = sources || []
      @locations = locations || []
      @story = []
      @title = ''
      @caption = ''
      @state = :pending
    end
    def true?() @state == :confirm end
    def false?() @state == :reject end
    def reject!() @state = :reject end
    def confirm!() @state = :confirm end
  end

  class ActorClones
    def initialize() @data = {} end
    def [](pos) @data[pos] ||= ActorClone.new(pos) end
    def []=(pos, clone) @data[pos] ||= clone end
  end

  class << self
    attr_accessor :clones, :idle_heroes, :travelers, :collectors, :rumors
    attr_reader :locations, :levels
  end
  module_function
  def group_empty?(index)
    case index
    when 0 then @idle_heroes.empty?
    when 1 then @travelers.empty?
    when 2 then @collectors.empty?
    end
  end

  def retrieve_groups
    @idle_heroes = $game_party.idle_heroes
    @travelers = $game_party.travelers
    @collectors = $game_party.rumor_heroes
    [@idle_heroes, @travelers, @collectors]
  end

  def clear_groups
    @idle_heroes.clear
    @travelers.clear
    @collectors.clear
  end

  def hear_rumors(dest_id)
    hot_news = []
    rumors = @rumors[dest_id]
    (rand(MAX_RUMORS_PER_ATTEMPT) + 1).times do
      hot_news << rumors.delete_at(rand(rumors.size))
      break if rumors.empty?
    end
    hot_news.compact
  end
  def make_new_clones() @clones = ActorClones.new end
  def fetch_rumors() @rumors = @all_rumors.dup end
  def [](rumor_id) @rumors[rumor_id] end
  @locations = load_data('Data/KRumorsLocations.rxdata')
  @levels = load_data('Data/KRumorsLevels.rxdata')
  @all_rumors = load_data('Data/KRumors.rxdata') rescue {}
end

class ActorClone
  attr_accessor :rumors_state, :rumor_level, :destination
  attr_accessor :right_guesses, :false_rumors
  attr_reader :id, :heard_rumors, :rumors
  def initialize(actor_id)
    @id = actor_id
    @rumors_state = :idle
    @right_guesses = @rumor_level = @rumor_exp = @false_rumors = 0
    @rumor_dest_id = 0
    @rumor_exp_list = Array.new(101)
    @rumors = []
    clear_destination
    make_rumor_exp_list
  end

  def make_rumor_exp_list
    rum_level = KRumors.levels[@id]
    final_level = rum_level.final_level
    basis = rum_level.basis
    @rumor_exp_list[0] = 0
    pow_i = 2.4 + rum_level.inflation / 100.0
    1.upto(100) do |i|
      if i > final_level
        @rumor_exp_list[i] = 0
      else
        n = basis * ((i + 3) ** pow_i) / (5 ** pow_i)
        @rumor_exp_list[i] = @rumor_exp_list[i-1] + n.to_i
      end
    end
  end

  def rumor_exp=(new_exp)
    @rumor_exp = [[new_exp, 9999999].min, 0].max
    @level += 1 while @level < 100 and @rumor_exp >= @rumor_exp_list[@level]
    @rumor_exp
  end

  def update
    @destination.update
    return if @heard_rumors
    @heard_rumors = @destination.ready?
    return unless @heard_rumors
    $game_party.gossipers << self
    $game_party.gossipers_found += 1
  end

  def process_rumors
    @rumors_state = :return
    @destination.ready = @heard_rumors = nil
    @rumors += KRumors.hear_rumors(@destination.id)
  end

  def clear_destination
    @destination = KRumors::Location.new(0, KRumors::UNKNOWN_DESTINATION, 0, 0)
  end
  def no_rumors?() @rumors.empty? end
  def rumors_state?(status) @rumors_state == status end
  def gossip_hater!() @rumors_state = nil end
end

class Game_System
  def update
    @timer -= 1 if @timer_working and @timer > 0
    update_other_timers
  end

  def update_other_timers
    $game_party.clones.each {|twin| twin.update }
  end
end

class Game_Actor
  def save_character() [@character_name, @character_hue] end
end

class Game_Party
  attr_reader :clones, :reserves, :rumor_locations, :gossipers
  attr_accessor :gossipers_found
  alias kyon_rumors_gm_party_init initialize
  def initialize
    kyon_rumors_gm_party_init
    @reserves = []
    @clones = []
    @gossipers = []
    @location_ids = []
    @rumor_locations = []
    @gossipers_found = 0
  end

  def process_rumors
    @gossipers.each{|g| g.process_rumors }
    @gossipers.clear
    @gossipers_found = 0
  end

  def add_rumor_location(locate_id)
    location = KRumors.locations[locate_id].dup
    return if @location_ids.include?(locate_id)
    @location_ids << locate_id
    @rumor_locations << location
  end

  def add_actor(actor_id)
    actor = $game_actors[actor_id]
    if @actors.size < 4 and !@actors.include?(actor)
      @actors << actor
      $game_player.refresh
    else
      add_reserve(actor_id, actor)
    end
  end

  def add_reserve(actor_id, actor)
    ids = @reserves.map{|r| r.id }
    return if ids.include?(actor_id)
    @clones << KRumors.clones[actor_id]
    @reserves << actor
  end

  def remove_reserve(actor_id)
    @clones.delete(actor_id)
    @reserves.delete($game_actors[actor_id])
  end

  def rehash_clones(mode)
    @clones = mode == :save ? @clones.map{|c| c.id } : get_clones
  end
  def has_reserve?(actor_id) @reserves.include?($game_actors[actor_id]) end
  def get_clones() @clones.map{|c| KRumors.clones[c] } end
  def idle_heroes() @clones.select{|c| c.rumors_state?(:idle) } end
  def travelers() @clones.select{|c| c.rumors_state?(:travel) } end
  def rumor_heroes() @clones.select{|c| c.rumors_state?(:return) } end
  def non_collectors() @clones.select{|c| c.rumors_state == nil } end
  def any_gossipers?() @gossipers_found > 0 end
end

class PleaseWaitSprite < Sprite
  include SpriteDispose
  def initialize(new_x, new_y, new_z)
    super(nil)
    self.x = new_x
    self.y = new_y
    self.z += new_z
    bmap = RPG::Cache.picture(KRumors::UPDATE_WARNING_PIC).dup
    self.bitmap = Bitmap.new(bmap.width, bmap.height)
    bitmap.blt(0, 0, bmap, bmap.rect)
    bitmap.font.size = 28
    bitmap.font.color = Color.new(90, 45, 0)
    bitmap.outline(0, 14, bmap.width - 44, 28, KRumors::UPDATE_WARNING, 1)
    bmap.dispose
  end
end

class RumorBackdropSprite < Sprite
  include SpriteDispose
  def initialize(viewport, high, color)
    super(viewport)
    update_height(high)
  end

  def update_height(high)
    @content_height = high
    refresh
  end

  def refresh
    bitmap.dispose if self.bitmap
    rect = viewport.rect
    widt = rect.width
    bitmap_height = [@content_height, rect.height].min
    self.bitmap = Bitmap.new(widt, bitmap_height)
    bm = RPG::Cache.picture(KRumors::LIST_BACKDROP).dup
    bm_rect = Rect.new(0, bm.height - bitmap_height, widt, bitmap_height)
    bitmap.blt(0, 0, bm, bm_rect)
    bm.dispose
  end
end

class RumorLocateSprite < Sprite
  include SpriteDispose
  def initialize(vp, data)
    super(vp)
    self.visible = false
    self.x = data.delete(:x)
    self.y = data.delete(:y)
    new_color = data.delete(:color)
    w = vp.rect.width - 12
    self.bitmap = Bitmap.new(w, 24)
    bitmap.back_color = new_color if new_color
    bitmap.outline(0, 0, w, 24, data[:name])
  end
end
 
class RumorFaceSprite < Sprite
  include SpriteDispose
  attr_writer :face_name
  def initialize(new_x, new_y, face_name, view=true)
    super(nil)
    self.x = new_x
    self.y = new_y
    self.visible = view
    @face_name = face_name
    refresh if face_name
  end

  def refresh
    bitmap.dispose rescue nil
    self.bitmap = RPG::Cache.face(@face_name).dup
  end
end

class RumorDataSprite < Sprite
  include SpriteDispose
  attr_writer :show_rumor_max
  def initialize(new_x, new_y, actor, view=true, show_rumor_max=nil)
    super(nil)
    self.x = new_x
    self.y = new_y
    self.visible = view
    @gossiper = actor
    @show_rumor_max = show_rumor_max
    self.bitmap = Bitmap.new(300, 100)
    refresh
  end

  def refresh
    bitmap.clear
    bitmap.back_color = Color.new(90, 45, 0)
    bitmap.outline(0, 0, 120, 24, $game_actors[@gossiper.id].name)
    bitmap.back_color = Color.new(0, 0, 0)
    bitmap.outline(132, 0, 128, 24, KRumors::RIGHT_GUESS)
    bitmap.outline(0, 24, 100, 24, KRumors::RUMOR_LVL)
    bitmap.outline(132, 24, 128, 24, KRumors::FALSE_RUMORS)
    bitmap.outline(0, 48, 100, 24, KRumors::DESTINATION)
    status = KRumors::STATUSES[@gossiper.rumors_state]
    bitmap.back_color = Color.new(255, 80, 0)
    bitmap.outline(268, 0, 128, 24, @gossiper.right_guesses.to_s)
    bitmap.outline(268, 24, 128, 24, @gossiper.false_rumors.to_s)
    bitmap.outline(88, 24, 60, 24, @gossiper.rumor_level.to_s)
    bitmap.outline(104, 48, 132, 24, @gossiper.destination.name)
    return unless @show_rumor_max
    bitmap.back_color = Color.new(0, 0, 0)
    bitmap.outline(0, 72, 136, 24, KRumors::TOTAL_RUMORS)
    bitmap.back_color = Color.new(255, 80, 0)
    rumor_max = @gossiper.rumors.size
    bitmap.outline(144, 72, 64, 24, rumor_max.to_s)
    return if rumor_max > 0
    bmap = RPG::Cache.picture(KRumors::FAILED_PICTURE).dup
    bitmap.blt(8, 4, bmap, bmap.rect)
    bmap.dispose
  end
end

class RumorTimeSprite < Sprite
  include SpriteDispose
  def initialize(new_x, new_y, hero, view=true)
    super(nil)
    self.x = new_x
    self.y = new_y + 72
    self.visible = view
    @destination = hero.destination
    self.bitmap = Bitmap.new(240, 24)
    refresh
  end

  def refresh
    time = @destination.time / Graphics.frame_rate
    bitmap.clear
    bitmap.back_color = Color.new(0, 0, 0)
    bitmap.outline(0, 0, 100, 24, KRumors::ETA_LABEL)
    bitmap.back_color = Color.new(255, 80, 0)
    remaining_time = sprintf("%02d:%02d", time / 60, time % 60)
    bitmap.outline(104, 0, 132, 24, remaining_time)
    @last_time = time
  end
end

class RumorInfoSprite < Sprite
  include SpriteDispose
  def initialize(view)
    super(view)
    self.bitmap = Bitmap.new(560, 432)
  end

  def rumor=(new_rumor)
    @rumor = new_rumor
    refresh
  end

  def refresh
    bitmap.clear
    bitmap.font.size = 30
    bitmap.font.name = 'Rudelsberg'
    bitmap.back_color = KRumors::BROWN
    bitmap.outline(0, 0, 560, 30, @rumor.title, 1)
    bitmap.font.size = 26
    bitmap.outline(0, 34, 560, 26, @rumor.caption, 1)
    bitmap.font.size = 24
    bitmap.back_color = KRumors::BLACK
    bitmap.outline(28, 70, 240, 26, KRumors::STORY_LABEL)
    bitmap.font.size = 22
    @rumor.story.each_with_index do |line, n|
      bitmap.outline(28, 104 + n * 24, 504, 26, line)
    end
  end
end

class RumorSet
  attr_writer :base_x, :base_y, :show_rumor_max
  def initialize
    @sprites = []
    @timer_sprites = []
    @group = []
    @base_x = 160
    @base_y = 56
  end

  def update_group(new_group, shown)
    @show = shown
    @group = new_group
    @group.size.times {|n| add_set(n) }
  end

  def add_set(y_index)
    @hero = @group[y_index]
    hero_id = @hero.id
    face_name = $game_actors[hero_id].character_name
    @hero = KRumors.clones[hero_id]
    place = @hero.destination
    ox = @base_x + 112
    oy = @base_y + y_index * 104
    @sprites << RumorFaceSprite.new(@base_x, oy, face_name, @show)
    @sprites << rds = RumorDataSprite.new(ox, oy, @hero, @show, @show_rumor_max)
    return if @show_rumor_max
    @sprites << spr = RumorTimeSprite.new(ox, oy, @hero, @show)
    @timer_sprites << spr
  end

  def update
    return if @hero == nil or @show_rumor_max
    @timer_sprites.each{|sprite| sprite.refresh }
  end

  def dispose
    @sprites.each {|sprite| sprite.dispose }
    @sprites.clear
    @timer_sprites.clear
    @show_rumor_max = @group = @hero = nil
  end
  def visible=(boolean) @sprites.each {|sprite| sprite.visible = boolean } end
  def z() @sprites[0].z rescue 0 end
end

class RumorSpriteset
  attr_reader :rumor_backdrop_ready
  attr_accessor :anime_mode
  def initialize
    @sprites = []
    @cursors = []
    @locate_sprites = []
    @rumor_sprites = []
    @rumor_backdrops = []
    @locate_max = $game_party.rumor_locations.size
    @brown = Color.new(90, 45, 0)
    @sprites << @bg = Sprite.new
    @bg.bitmap = RPG::Cache.picture(KRumors::BACKDROP).dup
    @sprites << @header = HeaderSprite.new(KRumors::TITLE, 40, 0)
    @header.font_name = 'Rudelsberg'
    @header.refresh
    make_viewports
    make_stage_sprites
    make_cursors
    make_lists
    make_location_sprites
    make_rumor_backdrop
  end

  def make_viewports
    @list_viewport = Viewport.new(268, 66, 180, 312)
    @list_viewport.z = 1000
    @rumor_backdrop_vp = [Viewport.new(0, 0, 320, 480)]
    @rumor_backdrop_vp << Viewport.new(320, 0, 320, 480)
    @rumor_backdrop_vp << Viewport.new(40, 24, 560, 432)
    @rumor_backdrop_vp[2].z = 2000
  end

  def make_stage_sprites
    stages = KRumors::STAGES
    @stage_sprites = []
    3.times do |n|
      @stage_sprites << sprite = Sprite.new
      sprite.x = 28
      sprite.y = 60 + n * 24
      sprite.bitmap = bitmap = Bitmap.new(160, 24)
      bitmap.back_color = @brown
      bitmap.outline(0, 0, 160, 24, stages[n])
    end
  end

  def make_cursors
    @cursors << @stage_cursor = RPG::Sprite.new
    @stage_cursor.x = 4
    @stage_cursor.y = 60
    @stage_cursor.blink_on
    @stage_cursor.bitmap = RPG::Cache.icon(KRumors::STAGE_CURSOR).dup
    @cursors << @hero_cursor = RPG::Sprite.new
    @hero_cursor.x = 160
    @hero_cursor.y = @base_hero_cursor_y = 124
    @hero_cursor.visible = false
    @hero_cursor.bitmap = RPG::Cache.picture(KRumors::HERO_CURSOR).dup
    @sets = [RumorSet.new, RumorSet.new, RumorSet.new]
    update_group_members(true)
    @hero_cursor.z = @sets[0].z + 5
    @cursors << @locate_cursor = RPG::Sprite.new
    @locate_cursor.x = lx = 242
    @locate_cursor.y = @base_cursor_y = 66
    @locate_cursor.z = lz = 1000
    @locate_cursor.visible = false
    @locate_cursor.bitmap = RPG::Cache.icon(KRumors::LOCATE_CURSOR).dup
    @cursors << @rumor_cursor = RPG::Sprite.new
    @rumor_cursor.x = lx
    @rumor_cursor.y = @base_cursor_y
    @rumor_cursor.z = lz
    @rumor_cursor.visible = false
    @rumor_cursor.bitmap = RPG::Cache.icon(KRumors::RUMOR_CURSOR).dup
  end

  def make_lists
    semi_black = Color.new(0, 0, 0, 220)
    @sprites << @dest_label_sprite = Sprite.new
    @dest_label_sprite.x = dx = 266
    @dest_label_sprite.y = dy = 36
    @dest_label_sprite.z = dz = 1000
    @dest_label_sprite.visible = false
    @dest_label_sprite.bitmap = bitmap = Bitmap.new(192, 32)
    backdrop = RPG::Cache.picture(KRumors::LIST_TITLE_ICON).dup
    bitmap.blt(0, 0, backdrop, backdrop.rect)
    bitmap.back_color = Color.new(200, 180, 0)
    bitmap.outline(0, 0, 192, 32, KRumors::DESTINATION + 's', 1)
    @sprites << @rumor_label_sprite = Sprite.new
    @rumor_label_sprite.x = dx
    @rumor_label_sprite.y = dy
    @rumor_label_sprite.z = dz
    @rumor_label_sprite.visible = false
    @rumor_label_sprite.bitmap = bitmap = Bitmap.new(192, 32)
    backdrop = RPG::Cache.picture(KRumors::LIST_TITLE_ICON).dup
    bitmap.blt(0, 0, backdrop, backdrop.rect)
    bitmap.back_color = Color.new(200, 180, 0)
    bitmap.outline(0, 0, 192, 32, KRumors::RUMORS, 1)
    high = @locate_max == 0 ? 1 : @locate_max
    high = 12 + high * 24
    @backdrop_sprite = RumorBackdropSprite.new(@list_viewport, high, semi_black)
    @backdrop_sprite.visible = false
    @rumor_list_sprite = RumorBackdropSprite.new(@list_viewport, 36, semi_black)
    @rumor_list_sprite.visible = false
    @sprites << @backdrop_sprite << @rumor_list_sprite
  end

  def make_location_sprites
    @sprites << @update_sprite = PleaseWaitSprite.new(147, 220, 1500)
    @update_sprite.visible = false
    $game_party.rumor_locations.each_with_index do |place, n|
      data = { :x => 12, :y => n * 24, :name => place.name, :color => @brown }
      @locate_sprites << RumorLocateSprite.new(@list_viewport, data)
    end
    return if @locate_max > 0
    data = { :x => 12, :y => 0, :name => KRumors::NO_DESTINATION }
    @locate_sprites << RumorLocateSprite.new(@list_viewport, data)
  end

  def make_rumor_backdrop
    2.times do |n|
      @rumor_backdrop_vp[n].z = 2000
      @rumor_backdrops << sprite = Sprite.new(@rumor_backdrop_vp[n])
      sprite.x = n == 0 ? 260 : -260# sprite.z = 2000
      sprite.visible = false
      sprite.bitmap = RPG::Cache.picture(KRumors::RUMOR_BACKDROP).dup
      sprite.src_rect.set(n * 320, 0, 320, 480)
    end
    @sprites << @rumor_sprite = RumorInfoSprite.new(@rumor_backdrop_vp[2])
    @rumor_sprite.visible = false
  end

  def refresh_rumor_list(rumors)
    @rumor_list_sprite.update_height(16 + rumors.size * 24)
    rumors.each_with_index do |rumor, n|
      data = { :x => 12, :y => n * 24, :name => rumor.title, :color => @brown }
      @rumor_sprites << RumorLocateSprite.new(@list_viewport, data)
    end
    toggle_rumors
  end

  def clear_rumors
    @rumor_sprites.each {|sprite| sprite.dispose }
    @rumor_sprites.clear
  end

  def refresh_groups
    update_group_members
    @sets[@index].visible = true
  end

  def update_group_members(skip=nil)
    @sets.each {|set| set.dispose } unless skip
    set1, @travel_set, set3 = @sets
    set1.update_group(KRumors.idle_heroes, @index == 0)
    @travel_set.update_group(KRumors.travelers, @index == 1)
    set3.show_rumor_max = true
    set3.update_group(KRumors.collectors, @index == 2)
  end

  def update_stage_cursor() @stage_cursor.update end
  def update_hero_cursor() @hero_cursor.update end
  def reset_hero_cursor(n) @hero_cursor.y = @base_hero_cursor_y + n * 104 end
  def reset_locate_cursor(n) @locate_cursor.y = @base_cursor_y + n * 24 end
  def reset_rumor_cursor(n) @rumor_cursor.y = @base_cursor_y + n * 24 end
  def refresh_rumor_data(rumor) @rumor_sprite.rumor = rumor end
  def update_set() @travel_set.update end
  def show_sets() 3.times {|n| @sets[n].visible = n == @index } end
  def toggle_wait() @update_sprite.toggle_visible end
  def toggle_rumor_backdrop() @rumor_backdrops.each {|s| s.toggle_visible } end
  def toggle_this_rumor() @rumor_sprite.toggle_visible end

  def update_stage(new_index)
    @index = new_index
    @stage_cursor.y = 60 + @index * 24
    @hero_cursor.y = @base_hero_cursor_y
    show_sets
  end

  def update_rumor_backdrop
    if @anime_mode == :open
      @rumor_backdrops[0].x -= 20
      rbx = @rumor_backdrops[1].x += 20
      @rumor_backdrop_ready = rbx == 0
    else
      @rumor_backdrops[0].x += 20
      rbx = @rumor_backdrops[1].x -= 20
      @rumor_backdrop_ready = rbx == -260
    end
  end

  def refresh_rumor_stage
    @anime_mode == :open ? toggle_this_rumor : toggle_rumor_backdrop
  end

  def show_hero_cursor
    @stage_cursor.blink_off
    @hero_cursor.blink_on
    @hero_cursor.visible = true
  end

  def hide_hero_cursor
    @stage_cursor.blink_on
    @hero_cursor.blink_off
    @hero_cursor.visible = false
  end

  def toggle_locations
    @show_locations = !@show_locations
    @show_locations ? @hero_cursor.blink_off : @hero_cursor.blink_on
    @locate_cursor.toggle_visible
    @dest_label_sprite.toggle_visible
    @backdrop_sprite.toggle_visible
    @locate_sprites.each {|s| s.toggle_visible }
  end

  def toggle_rumors
    @show_rumors = !@show_rumors
    @show_rumors ? @hero_cursor.blink_off : @hero_cursor.blink_on
    @rumor_cursor.toggle_visible
    @rumor_label_sprite.toggle_visible
    @rumor_list_sprite.toggle_visible
    @rumor_sprites.each {|s| s.toggle_visible }
  end

  def dispose
    (@sprites + @stage_sprites + @rumor_backdrops).each do |sprite|
      sprite.bitmap.dispose
      sprite.dispose
    end
    (@cursors + @locate_sprites + @rumor_sprites).each {|sp| sp.dispose }
    @sets.each {|set| set.dispose }
    @rumor_backdrop_vp.each {|vp| vp.dispose }
    @list_viewport.dispose
    @sprites.clear
    @stage_sprites.clear
    @bg = @header = @stages = @sets = nil
    @list_viewport = @locate_cursor = @stage_cursor = @hero_cursor = nil
  end
end

class KRumorScene
  def main
    @kind_index = @group_index = @locate_index = 0
    @rumor_index = @destination_timer = 0
    @stage = :main
    @locate_max = $game_party.rumor_locations.size
    $game_system.update
    @groups = KRumors.retrieve_groups
    @spriteset = RumorSpriteset.new
    @spriteset.update_stage(0)
    @spriteset.refresh_groups
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      break if $scene != self
    end
    Graphics.freeze
    @spriteset.dispose
    KRumors.clear_groups
  end

  def update
    $game_system.update
    @spriteset.update_set
    if @anime_active
      @spriteset.update_rumor_backdrop
      if @spriteset.rumor_backdrop_ready
        @spriteset.refresh_rumor_stage
        @anime_active = nil
      end
      return
    end
    case @stage
    when :rumors then update_hot_news
    when :main then update_main
    when :select then update_select
    when :route then update_destination
    when :review then update_rumor_collectors
    when :rumor then update_review_rumor
    end
  end

  def update_hot_news
    if @delay_enabled
      @timer -= 1
      if @timer == 0
        @stage = @last_stage
        @delay_enabled = @last_stage = nil
        @spriteset.toggle_wait
      end
      return
    end
    @timer = Graphics.frame_rate * 12 / 10
    $game_party.process_rumors
    @groups = KRumors.retrieve_groups
    @group_max = @groups[@kind_index].size
    @spriteset.refresh_groups
    if @kind_index == 1
      @group_index = @group_max - 1 if @group_index >= @group_max - 1
      @spriteset.reset_hero_cursor(@group_index)
      if @group_max == 0
        @spriteset.hide_hero_cursor
        @last_stage = :main
      end
    end
    @delay_enabled = true
  end

  def update_main
    @spriteset.update_stage_cursor
    if $game_party.any_gossipers?
      #if @first_gossiper @temp_timer = Graphics.frame_rate / 2
      Audio.play_shop
      @spriteset.toggle_wait
      @last_stage = @stage
      return @stage = :rumors
    end
    if Input.trigger?(Input::B)
      Audio.play_cancel
      return $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      return Audio.play_buzzer if KRumors.group_empty?(@kind_index)
      Audio.play_decision
      @spriteset.show_hero_cursor
      @group = @groups[@kind_index]
      @group_max = @group.size
      return @stage = :select
    elsif Input.trigger?(Input::UP)
      Audio.play_cursor
      @kind_index = (@kind_index - 1) % 3
      @spriteset.update_stage(@kind_index)
      return
    elsif Input.trigger?(Input::DOWN)
      Audio.play_cursor
      @kind_index = (@kind_index + 1) % 3
      @spriteset.update_stage(@kind_index)
    end
  end

  def update_select
    @spriteset.update_hero_cursor
    if Input.trigger?(Input::B)
      Audio.play_cancel
      @group_index = 0
      @spriteset.hide_hero_cursor
      @spriteset.reset_hero_cursor(@group_index)
      return @stage = :main
    elsif Input.trigger?(Input::C)
      return Audio.play_buzzer if @kind_index == 1
      Audio.play_decision
      if @kind_index == 0
        @spriteset.toggle_locations
        return @stage = :route
      end
      @rumors = @group[@group_index].rumors
      @rumor_max = @rumors.size
      @spriteset.refresh_rumor_list(@rumors)
      return @stage = :review
    elsif Input.trigger?(Input::UP)
      return Audio.play_buzzer if @group_max < 2
      Audio.play_cursor
      @group_index = (@group_index + @group_max - 1) % @group_max
      @spriteset.reset_hero_cursor(@group_index)
      return
    elsif Input.trigger?(Input::DOWN)
      return Audio.play_buzzer if @group_max < 2
      Audio.play_cursor
      @group_index = (@group_index + 1) % @group_max
      @spriteset.reset_hero_cursor(@group_index)
    end
  end

  def update_destination
    if @destination_timer > 0
      @destination_timer -= 1
      @spriteset.toggle_wait if @destination_timer == 0
      return
    end
    if Input.trigger?(Input::B)
      Audio.play_cancel
      @spriteset.toggle_locations
      @locate_index = 0
      @group = nil
      return @stage = :select
    elsif Input.trigger?(Input::C)
      location = KRumors.locations[@locate_index + 1]
      return Audio.play_buzzer if KRumors[location.id].size == 0
      return Audio.play_buzzer if @locate_max == 0 or @group_max == 0
      Audio.play_decision
      @spriteset.toggle_wait
      @stage = :select #if @kind_index == 0
      @destination_timer = Graphics.frame_rate / 2
      @spriteset.toggle_locations
      @group_max -= 1
      hero = KRumors.idle_heroes[@group_index]
      hero.rumors_state = :travel
      hero.destination = location.dup
      @groups = KRumors.retrieve_groups
      @spriteset.refresh_groups
      @group_index = [@group_index, @group_max - 1].min
      @spriteset.reset_hero_cursor(@group_index)
      if @group_max == 0
        @spriteset.hide_hero_cursor
        @destination_timer = 0
        @stage = :main
      end
      return
    elsif Input.trigger?(Input::UP)
      return Audio.play_buzzer if @locate_max < 2
      Audio.play_cursor
      @locate_index = (@locate_index + @locate_max - 1) % @locate_max
      @spriteset.reset_locate_cursor(@locate_index)
      return
    elsif Input.trigger?(Input::DOWN)
      return Audio.play_buzzer if @locate_max < 2
      Audio.play_cursor
      @locate_index = (@locate_index + 1) % @locate_max
      @spriteset.reset_locate_cursor(@locate_index)
    end
  end

  def update_rumor_collectors
    if Input.trigger?(Input::B)
      Audio.play_cancel
      @rumor_max = @rumor_index = 0
      @spriteset.toggle_rumors
      @spriteset.clear_rumors
      @spriteset.reset_rumor_cursor(@rumor_index)
      @rumors = nil
      return @stage = :select
    elsif Input.trigger?(Input::C)
      return Audio.play_buzzer if @rumors.empty?
      hero = KRumors.collectors[@rumor_index]
      if hero.no_rumors?
        Audio.play_buzzer
        @rumor_max -= 1
        hero.rumors_state = :idle
        hero.clear_destination
        @groups = KRumors.retrieve_groups
        @spriteset.refresh_groups
        @rumor_index = [@rumor_index, @rumor_max - 1].min
        return
      end
      Audio.play_decision
      @spriteset.toggle_rumor_backdrop
      @spriteset.refresh_rumor_data(@rumors[@rumor_index])
      @spriteset.anime_mode = :open
      @anime_active = true
      return @stage = :rumor
    elsif Input.trigger?(Input::UP)
      return Audio.play_buzzer if @rumor_max < 2
      Audio.play_cursor
      @rumor_index = (@rumor_index + @rumor_max - 1) % @rumor_max
      @spriteset.reset_rumor_cursor(@rumor_index)
      return
    elsif Input.trigger?(Input::DOWN)
      return Audio.play_buzzer if @rumor_max < 2
      Audio.play_cursor
      @rumor_index = (@rumor_index + 1) % @rumor_max
      @spriteset.reset_rumor_cursor(@rumor_index)
    end
  end

  def update_review_rumor
    if Input.trigger?(Input::B)
      Audio.play_cancel
      @spriteset.anime_mode = :close
      @spriteset.toggle_this_rumor
      @anime_active = true
      return @stage = :review
    end
   
  end
end

class Scene_Title
  alias kyon_rumors_scn_title_cng command_new_game
  def command_new_game
    KRumors.make_new_clones
    KRumors.fetch_rumors
    kyon_rumors_scn_title_cng
    KRumors.retrieve_groups
  end
end

class Scene_Menu
  def update
    $game_system.update
    @command_window.update
    @playtime_window.update
    @steps_window.update
    @gold_window.update
    @status_window.update
    update_stages
  end

  def update_stages
    if @command_window.active
      return update_command
    elsif @status_window.active
      return update_status
    end
  end
end

class Scene_Save
  def write_save_data(file)
    characters = []
    $game_party.actors.size.times do |i|
      actor = $game_party.actors[i]
      characters << actor.save_character
    end
    $game_party.rehash_clones(:save)
    Marshal.dump(characters, file)
    Marshal.dump(Graphics.frame_count, file)
    $game_system.save_count += 1
    $game_system.magic_number = $data_system.magic_number
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
    Marshal.dump(KRumors.clones, file) # KRumors' Actor Clones
    Marshal.dump(KRumors.rumors, file)
    $game_party.rehash_clones(:load)
  end
end

class Scene_Load
  def read_save_data(file)
    characters = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables    = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party        = Marshal.load(file)
    $game_troop        = Marshal.load(file)
    $game_map          = Marshal.load(file)
    $game_player        = Marshal.load(file)
    KRumors.clones      = Marshal.load(file) # KRumors' Actor Clones
    KRumors.rumors      = Marshal.load(file)
    $game_party.rehash_clones(:load)
    if $game_system.magic_number != $data_system.magic_number
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
    $game_party.refresh
  end
end

Código del Parser o Lector de Archivos de Texto para la Configurarción de mi Script
Código:
module Graphics
  def self.frame_rate() 40 end
end

module KRumors
  @rumors = {}
  class Location
    attr_reader :id, :name, :map_id, :time
    attr_writer :ready
    def initialize(new_id, name, map_id, time)
      @id = new_id
      @name = name
      @map_id = map_id
      @time = (time * 60 * Graphics.frame_rate).to_i
    end

    def update
      return if @ready or @time == 0
      @time -= 1
      @ready = @time == 0
    end
    def ready?() @ready end
  end

  class Level
    attr_reader :final_level, :basis, :inflation
    def initialize(level, basis, inflation)
      @final_level, @basis, @inflation = level, basis, inflation
    end
  end

  class Rumor
    attr_reader :accuracy, :sources_total, :sources, :locations, :story, :state
    attr_accessor :title, :caption
    def initialize(level, number, sources, locations)
      @accuracy = level
      @sources_total = number
      @sources = sources || []
      @locations = locations || []
      @story = []
      @title = ''
      @caption = ''
      @state = :pending
    end
    def true?() @state == :confirm end
    def false?() @state == :reject end
    def reject!() @state = :reject end
    def confirm!() @state = :confirm end
  end

  def self.parse_locations_levels
    @locations = [Location.new(0, '', 0, 0)]
    @levels = [Level.new(0, 0, 0)]
    lines = File.readlines('rumor locations.txt')
    loc_max = lines.size / 3
    loc_max.times do |n|
      name = lines.shift.gsub(/destination: /i, '').chop
      map_id = lines.shift.scan(/\d+/)[0].to_i
      time = lines.shift.scan(/\d+/)[0].to_i
      @locations << location = Location.new(n + 1, name, map_id, time)
    end
    lines = File.readlines('rumor levels.txt')
    lines.each do |line|
      hid, level, basis, inflation = line.scan(/\d+/).map{|i| i.to_i }
      @levels << Level.new(level, basis, inflation)
    end
    filename = 'Data/KRumorsLocations.rxdata'
    File.open(filename, 'wb'){|file| Marshal.dump(@locations, file) }
    filename = 'Data/KRumorsLevels.rxdata'
    File.open(filename, 'wb'){|file| Marshal.dump(@levels, file) }
  end
 
  def self.parse_file
    lines = File.readlines('rumors.txt') + ['']
    line_max = lines.size / 13
    line_max.times do |n|
      rumor_id = lines.shift.scan(/\d+/)[0].to_i
      @rumors[rumor_id] ||= []
      title = lines.shift.chomp
      caption = lines.shift.chomp
      level = lines.shift.scan(/\d+/)[0].to_i
      number = lines.shift.scan(/\d+/)[0].to_i
      sources = lines.shift.chomp
      sources.sub!(/some sources: /i, '')
      locations = lines.shift.chomp
      locations.sub!(/locations: /i, '')
      locations = locations.split(/, /i)
      rumor = Rumor.new(level, number, sources, locations)
      rumor.title = title.sub!(/title: /i, '')
      rumor.caption = caption.sub!(/caption: /i, '')
      lines.shift
      4.times { rumor.story << lines.shift.chomp }
      lines.shift
      @rumors[rumor_id] << rumor
      File.open('Data/KRumors.rxdata','wb'){|file| Marshal.dump(@rumors, file) }
    end
  end
  parse_locations_levels
  parse_file
  p "Total Locations: #{@locations.size}", "Total Levels: #{@levels.size}"
  p "Total Rumors Groups: #{@rumors.size}"
  @rumors.each {|id,rumors| p "Total Rumors: #{rumors.size}" }
end

Créditos:
A mí, Kyonides Arkanthes, por hacer el script porsupuesto.
A quien hizo las faces Ópalo Carcajada

#2 Re: KRumors XP el Sáb Sep 08, 2018 6:38 am

kyonides

avatar
Bueno ya he actualizado el tema con todo y scripts recientes y unas interesantes ilustraciones alegóricas a una era pasada.

Aquí aprovecharé para dejarles el demo cerrado para que hagan pruebas mientras me decido a terminar de hacerlo. (Es para estar seguro de que les servirá cuando vayan a distribuir su propio juego.)

Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje [Página 1 de 1.]

Permisos de este foro:
No puedes responder a temas en este foro.