Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # ** Eye/Lens of Truth for Essentials **
- # by Drimer
- #===============================================================================
- # Events with '#EOT' on their names will be affected by this script.
- # If you want to hide an event appent the tag 'HIDE' or 'SHOW' to... show it!
- #
- # You can also add a third tag which must be a number and will be used as
- # the event limit opacity (to show or hide)
- #
- # Examples:
- # #EOT HIDE
- # #EOT HIDE 100
- # #EOT SHOW
- # #EOF SHOW 100
- #
- # The item must use the constant 'LENSOFTRUTH' (Don't forget to define it!)
- # You can use the format below to define it in PBS/items.txt
- #
- # XXX,LENSOFTRUTH,Lens of Truth,Lens of Truth,8,0,"Description",2,0,6,
- #===============================================================================
- module LensOfTruth
- # Time in seconds
- DURATION = 10
- # Range, max is 4
- RANGE = 4
- end
- class Scene_Map
- attr_accessor :eye_of_truth_time
- def initialize
- @eye_of_truth_time = 0
- end
- end
- class Game_Event
- attr_accessor :event, :opacity, :through, :character_hue
- alias _update_lens update
- def update
- if self.name[/#EOT/]
- if self.name[/HIDE/]
- if InRange?(self.event, LensOfTruth::RANGE%5) &&
- ($scene.is_a?(Scene_Map) ? $scene.eye_of_truth_time > 0 : false)
- opacity = self.name[/(\d+)/] ? $1.to_i : 0
- self.through = true
- self.opacity -= 25.5 if self.opacity > opacity
- else
- if !onEvent?
- self.through = false
- end
- self.opacity += 25.5 if self.opacity < 255
- end
- elsif self.name[/SHOW/]
- if InRange?(self.event, LensOfTruth::RANGE%5) &&
- ($scene.is_a?(Scene_Map) ? $scene.eye_of_truth_time > 0 : false)
- opacity = self.name[/(\d+)/] ? $1.to_i : 255
- if !onEvent?
- self.through = false
- end
- self.opacity += 25.5 if self.opacity < opacity
- else
- self.through = true
- self.opacity -= 25.5 if self.opacity > 0
- end
- end
- end
- _update_lens
- end
- end
- module LenteVerdad
- @eye_graphic = Sprite.new
- @eye_graphic.z = 3
- @mask = Sprite.new
- @mask.z = 1
- @effect = Sprite.new
- @effect.z = 2
- def self.create
- @eye_graphic.bitmap = BitmapCache.load_bitmap("Graphics/Pictures/Lens/truth_circle")
- @eye_graphic.ox = @eye_graphic.bitmap.width/2
- @eye_graphic.oy = @eye_graphic.bitmap.height/2
- @eye_graphic.x = Graphics.width/2
- @eye_graphic.y = Graphics.height/2
- @eye_graphic.opacity = 0
- @mask.bitmap = BitmapCache.load_bitmap("Graphics/Pictures/Lens/mask")
- @mask.ox = @mask.bitmap.width/2
- @mask.oy = @mask.bitmap.height/2
- @mask.x = Graphics.width/2
- @mask.y = Graphics.height/2
- @mask.opacity = 0
- @effect.bitmap = BitmapCache.load_bitmap("Graphics/Pictures/Lens/wave")
- @effect.ox = @effect.bitmap.width/2
- @effect.oy = @effect.bitmap.height/2
- @effect.x = Graphics.width/2
- @effect.y = Graphics.height/2
- @effect.zoom_x = @effect.zoom_y = 0
- @created = true
- end
- def self.show
- self.create if !@created
- end
- def self.update
- return if !@created
- return if $game_temp && $game_temp.in_menu
- if $scene.is_a?(Scene_Map) && $scene.eye_of_truth_time > 0
- @effect.visible = true if !@effect.visible
- @mask.x = @eye_graphic.x = @effect.x = $game_player.x
- @mask.y = @eye_graphic.y = @effect.y = $game_player.y
- $scene.eye_of_truth_time -= 1
- if @eye_graphic.opacity < 255
- @eye_graphic.opacity += 25.5
- @mask.opacity += 25.5
- end
- if @effect.zoom_x < 1.0
- @effect.zoom_x = @effect.zoom_y += 0.025
- else
- if @effect.opacity > 0
- @effect.opacity -= 51
- else
- @effect.zoom_x = @effect.zoom_y = 0
- @effect.opacity = 255
- end
- end
- @eye_graphic.angle += 1
- else
- if @eye_graphic.opacity > 0
- @eye_graphic.angle += 1
- @eye_graphic.opacity -= 25.5
- @mask.opacity -= 25.5
- @effect.visible = false
- @effect.opacity = 255
- @effect.zoom_x = @effect.zoom_y = 0
- end
- end
- #--------------------
- end
- def InRange?(event, distance)
- return false if distance<=0
- rad = (Math.hypot((event.x - $game_player.x),(event.y - $game_player.y))).abs
- return true if (rad <= distance)
- return false
- end
- end
- module Graphics
- class << self
- alias _update_eye_update update
- def update
- _update_eye_update
- end
- end
- end
- def pbLensOfTruth
- if ($scene.eye_of_truth_time == 0)
- return true
- else
- Kernel.pbMessage(_INTL("The item is already in use."))
- return false
- end
- end
- ItemHandlers::UseInField.add(:LENSOFTRUTH,proc{|item|
- Kernel.pbMessage(_INTL("\\PN used the Lens of Truth!"))
- waves = []
- @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
- @star["star"]=Sprite.new(@viewport)
- @star["star"].z = 2
- @star["star"].bitmap=RPG::Cache.load_bitmap("Graphics/Pictures/Lens/","part")
- @star["star"].ox = @star.bitmap.width/2
- @star["star"].oy = @star.bitmap.height/2
- @star["star"].x = $game_player.screen_x
- @star["star"].y = $game_player.screen_y
- @star["star"].zoom_x = star.zoom_y = 0
- count = 0
- 10.times do
- s = Sprite.new
- s.z = 1
- s.bitmap = BitmapCache.load_bitmap("Graphics/Pictures/Lens/wave")
- s.zoom_x = s.zoom_y = 0
- s.x = $game_player.screen_x
- s.y = $game_player.screen_y
- s.ox = s.bitmap.width/2
- s.oy = s.bitmap.height/2
- waves.push(s)
- end
- pbSEPlay("shiny")
- 15.times do
- Graphics.update
- @star["star"].zoom_x = @star["star"].zoom_y += 1.0/15.0
- @star["star"].angle += 3
- end
- pbSEPlay("Saint6")
- 30.times do
- Graphics.update
- @star["star"].angle += 3
- count += 1
- for i in 0...waves.length
- next if !waves[i].visible
- if waves[i].zoom_x >= 1.0
- waves[i].visible = false
- end
- waves[i].zoom_x = waves[i].zoom_y += 0.01*i
- end
- end
- 5.times do
- Graphics.update
- for i in 0...waves.length
- next if !waves[i].visible
- if waves[i].zoom_x >= 1.0
- waves[i].visible = false
- end
- waves[i].zoom_x = waves[i].zoom_y += 0.01*i
- waves[i].opacity -= 255/5
- end
- @star["star"].zoom_x = star["star"].zoom_y -= 1.0/5.0
- @star["star"].angle += 3
- end
- waves.each{|i| i.dispose}
- @star["star"].dispose
- $scene.eye_of_truth_time = LensOfTruth::DURATION * Graphics.frame_rate if $scene.is_a?(Scene_Map)
- })
- ItemHandlers::UseFromBag.add(:LENSOFTRUTH,proc{|item|
- if pbLensOfTruth
- next 2
- else
- next 0
- end
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement