Main Menu
  • Welcome to The RPG Maker Resource Kit.

[RESOLVED] Illumino - picture above picture

Started by Lysop, October 08, 2011, 07:31:31 PM

0 Members and 2 Guests are viewing this topic.

Lysop

Hello,

My Request:
I am interested in this script to add an additional function:
The Illumino images can be optionally displayed above a Picture.
In this example, it is a new line to decide between True and
False, whether the picture is above or below it.
It could be a new row in the comment.

Another way would be that it is permanently above all pictures.
Could it be sth. like that?
$illumino.z = 704

Well, I don't know :-\ .

It would help me very much!


CODE
#==============================================================================#
#                                                                              #
#                   # ###                   /               ###                #
#                 /  /###                 #/                 ###               #
#                /  /  ###                ##                  ##               #
#               /  ##   ###               ##                  ##               #
#              /  ###    ###              ##                  ##               #
#             ##   ##     ## ###  /###    ##  /##      /##    ##               #
#             ##   ##     ##  ###/ #### / ## / ###    / ###   ##               #
#             ##   ##     ##   ##   ###/  ##/   /    /   ###  ##               #
#             ##   ##     ##   ##    ##   ##   /    ##    ### ##               #
#             ##   ##     ##   ##    ##   ##  /     ########  ##               #
#              ##  ##     ##   ##    ##   ## ##     #######   ##               #
#               ## #      /    ##    ##   ######    ##        ##               #
#                ###     /     ##    ##   ##  ###   ####    / ##               #
#                 ######/      ###   ###  ##   ### / ######/  ### /            #
#                   ###         ###   ###  ##   ##/   #####    ##/             #
#                                                                              #
#                         #####    ##         ###   ###                        #
#                      ######  /  #### /       ###   ###                       #
#                     /#   /  /   ####/         ##    ##                       #
#                    /    /  /    # #           ##    ##                       #
#                        /  /     #             ##    ##                       #
#                       ## ##     #      /##    ##    ##                       #
#                       ## ##     #     / ###   ##    ##                       #
#                       ## ########    /   ###  ##    ##                       #
#                       ## ##     #   ##    ### ##    ##                       #
#                       ## ##     ##  ########  ##    ##                       #
#                       #  ##     ##  #######   ##    ##                       #
#                          /       ## ##        ##    ##                       #
#                      /##/        ## ####    / ##    ##                       #
#                     /  #####      ## ######/  ### / ### /                    #
#                    /     ##           #####    ##/   ##/                     #
#                    #                                                         #
#                     ##                                                       #
#                                                   __                         #
#              .-----.----.-----.-----.-----.-----.|  |_.-----.                #
#              |  _  |   _|  -__|__ --|  -__|     ||   _|__ --|                #
#              |   __|__| |_____|_____|_____|__|__||____|_____|                #
#              |__|                                                            #
#                                                                              #
#==============================================================================#

#==============================================================================#
#                    _____ _ _                 _                               #
#                    \_   \ | |_   _ _ __ ___ (_)_ __   ___                    #
#                     / /\/ | | | | | '_ ` _ \| | '_ \ / _ \                   #
#                  /\/ /_ | | | |_| | | | | | | | | | | (_) |                  #
#                  \____/ |_|_|\__,_|_| |_| |_|_|_| |_|\___/                   #
#                                                                              #
#==============================================================================#
#                                   Illumino                                   #
#------------------------------------------------------------------------------#
#                   Lässt ein Bild über einem Event entstehen                  #
#------------------------------------------------------------------------------#
#                          Version : 1.2b – 05.08.09                           #
#                     Created by : hellMinor aka Onkel Hell                    #
#                   Do NOT redistribute without my permission                  #
#                                www.rpgvx.net                                 #
#                             hellminor@rpgvx.net                              #
#==============================================================================#

#==============================================================================#
# LE-Comment Template                                                          #
#------------------------------------------------------------------------------#
# LE-Name                                                                      #
# x:0 y:0 op:150 zx:1.0 zy:1.0 bt:1 flicker:30                                 #
#------------------------------------------------------------------------------#
# LE-Name :   Name der Grafik die angezeigt werden soll                        #
# x:          x-korrekturwert, verschiebt die LE um x                          #
# y:          y-korrekturwert, verschiebt die LE um y                          #
# op:         opacity, sichtbarkeit der LE                                     #
# zx:         x-achsen-zoom, zoomt die LE um zx                                #
# zy:         y-achsen-zoom, zoomt die LE um zy                                #
# bt:         Blendtyp - 0 = normal, 1 = add, 2 = sub                          #
# flicker:    Stärke des Flacker-Effekts                                       #
#------------------------------------------------------------------------------#
#     Durch die erneute Änderung sind die einzelnen Kommentar-Parameter nun    #
#    optional , im Script selbst wird gecheckt ob der entsprechende Paramter   #
#                vorhanden ist und dann wird der Wert übernommen               #
#------------------------------------------------------------------------------#
# Die Bilder kommen ALLE in /Graphics/Illumino                                 #
#==============================================================================#

#==============================================================================#
#                                Script anfang                                 #
#==============================================================================#
class Sprite_Character
#==============================================================================#
  def initialize(viewport, character = nil)   
    super(viewport)
    @character = character
    @balloon_duration = 0
    create_customs
    update
  end
#------------------------------------------------------------------------------#
  def create_customs
    check_lightsources
  end
#------------------------------------------------------------------------------#
  alias dispose_light_adds dispose
  def dispose
    for light in @lights
      light.dispose
    end
    dispose_light_adds
  end
#------------------------------------------------------------------------------#
  def check_lightsources
    @lightsources = []
    @lights = []
    for event in $game_map.events.values
      next if event.list == nil
      for page in event.event.pages
        if page.list[0].code == 108
          if @character == event
            begin
              @lights.push(Sprite_Light.new(event))
            rescue
              next
            end
          end
        end
      end
    end
  end
#------------------------------------------------------------------------------#
  alias update_light_add update
  def update
    update_light_add
    for light in @lights
      light.update
    end
  end
#------------------------------------------------------------------------------#
end

#==============================================================================#
class Sprite_Light < Sprite
#==============================================================================#
  def initialize(lightsource)
    super(Viewport.new(0,0,544,416))
    @source = lightsource
    self.z = @source.screen_z + 1
    self.visible = true
    @last_hash = 0
    @flicker = 0
    update
  end
#------------------------------------------------------------------------------#
  def update
    begin
      self.bitmap = Cache.illumino(@source.list[0].parameters[0])
    rescue
      self.bitmap = nil
      return
    end
    self.ox = self.width / 2
    self.oy = self.height / 2 + 16
    @list = @source.list[1].parameters[0].split
    # Opacity anpassen
    temp = check_values("op")
    self.opacity = @list[temp[1]].gsub(/[op:]/, "").to_i if temp[0]
    # Flicker-Effekt anpassen
    temp = check_values("flicker")
    self.opacity  += rand(@list[temp[1]].gsub(/[flicker:]/, "").to_i) if temp[0]
    # x-Koordinate anpassen
    temp = check_values("x")
    self.x = (@source.screen_x)+ @list[temp[1]].gsub(/[x:]/, "").to_i if temp[0]
    # y-Koordinate anpassen
    temp = check_values("y")
    self.y = (@source.screen_y)+ @list[temp[1]].gsub(/[y:]/, "").to_i if temp[0]
    return if @last_hash == @source.list[0].parameters[0].hash +
                            @source.list[1].parameters[0].hash
    @last_hash = @source.list[0].parameters[0].hash +
                 @source.list[1].parameters[0].hash
    return if self.opacity <= 0
    # x-Zoom anpassen
    temp = check_values("zx")
    self.zoom_x = @list[temp[1]].gsub(/[zx:]/, "").to_f if temp[0]
    # y-Zoom anpassen
    temp = check_values("zy")
    self.zoom_y = @list[temp[1]].gsub(/[zy:]/, "").to_f if temp[0]
    # Blendtyp anpassen
    temp = check_values("bt")
    self.blend_type = @list[temp[1]].gsub(/[bt:]/, "").to_i if temp[0]
  end
#------------------------------------------------------------------------------#
  def check_values(string)
    for value in @list
      return [true,@list.index(value)] if value.include?(string)
    end
    return [false,-1]
  end
#------------------------------------------------------------------------------#
end

#==============================================================================#
class Game_Event
#==============================================================================#
  attr_reader   :event
#------------------------------------------------------------------------------#
end

#==============================================================================#
module Cache
#==============================================================================#
  def self.illumino(filename)
    load_bitmap("graphics/illumino/", filename)
  end
#------------------------------------------------------------------------------#
end
#==============================================================================#
#                                 Script ende                                  #
#==============================================================================#

modern algebra

Here, paste this into its own slot below the Illumino script:


class Sprite_Light
  alias ma_lysop_illumino_hm_abovepicupd_5rf2 update
  def update (*args)
    ma_lysop_illumino_hm_abovepicupd_5rf2 (*args)
    temp = check_values ("ap")
    self.viewport.z = 75 if temp[0]
  end
end


Now if you place ap in the line with all the other stats, it will show up above pictures. Otherwise it won't.

In other words, the following would be above pictures:

x:0 y:-32 op:150 zx:1.0 zy:1.0 bt:1 flicker:30 ap

And this wouldn't be:

x:0 y:-32 op:150 zx:1.0 zy:1.0 bt:1 flicker:30

Lysop

Thank you very much! (fast answer ;D)
It works fine!