The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: cozziekuns on August 01, 2010, 07:25:44 PM

Title: Glow in the Dark Sprites
Post by: cozziekuns on August 01, 2010, 07:25:44 PM
Glow in the Dark Sprites
Version: 1.0
Author: cozziekuns
Date: August 1st, 2010

Version History



Planned Future Versions


Description


This script allows for sprites that change their tone depending on the screen tone. Essentially for making glow-in-the-dark sprites, however has a smoother transition from Dark to Bright than other light effect scripts.

Features


Screenshots

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi32.tinypic.com%2F2jam0ck.png&hash=1e06292c1f195fa503a816915c79938fce87696f)

Ignore the sloppy HUD.

Instructions

See header.

Script


Code: [Select]
#===============================================================================

# Cozziekuns Glow in the Dark Sprites
# Last Date Updated: 08/01/2010
#
# This script allows for sprites that change their tone depending on the screen
# tone. Essentially for making Glow in the Dark Sprites, which is tortologius to
# the title.
#
#===============================================================================
# Updates
# -----------------------------------------------------------------------------
# o 08/01/10 - Created Script.
#===============================================================================
# What's to come?
# -----------------------------------------------------------------------------
# o Nothing! Suggest something.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# To make a sprite glow in the dark, just add this comment to an event:
#
# \glow_in_the_dark (CaSe InSenSitIve)
#
# The lag this script will induce depends on the amount you set for your frames.
# The higher the number, the less laggy the script. Each frame lasts for 1/60th
# of as second, so the default (15 frames) refreshes each 1/4 of a second.
# 0 frames would mean that the sprite never refreshes.
#===============================================================================

$imported = {} if $imported == nil
$imported["CozGlowInTheDarkSprites"] = true

module COZZIEKUNS
  module BOKTAI
    module GINDS
      FRAMES = 15 # Amount of frames waited before refreshing the sprites tone.
    end
  end
end

#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :glow_in_the_dark
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias coz_ginds_gc_initialize initialize
  def initialize
    coz_ginds_gc_initialize
    @glow_in_the_dark = false
  end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
#  This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
  #--------------------------------------------------------------------------
  # * Setup
  #--------------------------------------------------------------------------
  alias coz_ginds_ge_setup setup
  def setup(new_page)
    coz_ginds_ge_setup(new_page)
    unless @page == nil
      i = 0
      comment = ''
      while [108].include?(@page.list[i].code)
        comment += @page.list[i].parameters[0]
        i += 1
      end
      if comment[/\\GLOW_IN_THE_DARK/i] != nil
        @glow_in_the_dark = true
      end
    end
  end
end

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display characters. It observes a instance of the
# Game_Character class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     viewport  : viewport
  #     character : character (Game_Character)
  #--------------------------------------------------------------------------
  alias coz_ginds_sc_initialize initialize
  def initialize(viewport, character = nil)
    @frames = 0
    coz_ginds_sc_initialize(viewport, character)
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias coz_boktai_gs_sc_update update
  def update
    coz_boktai_gs_sc_update
    if @character.glow_in_the_dark and @frames == COZZIEKUNS::BOKTAI::GINDS::FRAMES
      self.tone.red = $game_map.screen.tone.red < 0 ? 0 - $game_map.screen.tone.red : 0
      self.tone.blue = $game_map.screen.tone.blue < 0 ? 0 - $game_map.screen.tone.blue : 0
      self.tone.green = $game_map.screen.tone.green < 0 ? 0 - $game_map.screen.tone.green : 0
      @frames = 0
    end
    @frames += 1
  end
end

Credit



Thanks


Support


Just post down below.

Known Compatibility Issues

Can't say right now.

Author's Notes


Pinch and a punch for the first day of the month.

Restrictions

:ccby: (http://creativecommons.org/licenses/by/3.0/au/)
Title: Re: Glow in the Dark Sprites
Post by: Underking on August 03, 2010, 10:10:16 PM
Cool, I always wondered why no-one made this :D Great for time scripts and fires, lamps, ghost, and why not the runes on a giant obelisk?
Title: Re: Glow in the Dark Sprites
Post by: Fizzly on August 04, 2010, 04:07:23 PM
Nice one. I see this for a lanterns! :)
Title: Re: Glow in the Dark Sprites
Post by: modern algebra on August 11, 2010, 05:44:18 PM
Looks good cozzie!