Jump to content
Ginolamantino

Gino Reflecting Mirror

Recommended Posts

Gino Reflecting Mirror 2.0

ginolamantino

 

Introduction

This script allows you to create reflecting surfaces (mirrors) wherever you want. Even in the middle of the World Map, why not?

 

Features

-Makes mirror creation easy and fast

-Will make your maps more lively.

-Makes vampire's hunting easier!

 

Screenshots

Coming Soon

 

How to Use

 

Insert this script under Materials and above Main.

 

There are many options in "module GINOMIRROR"

 

REFMODE lets you choose between ReflectAllBut and ReflectNoneBut modes:

 

-REFMODE = 1 ===> ReflectAllBut Mode

In ReflectAllBut mode, the system makes reflections for all events except

those with the string "noref" in their name.

 

-REFMODE = 2 ===> ReflectNoneBut Mode

In ReflectNoneBut mode, the system makes reflection only for events with

the string "reflect" in their name.

Note that this option only apply for events.

 

You must set two differents region_id:

-MIRRORID for the reflecting surface.

-EFFECTAREAID for the area whose events will be reflected.

 

By using the two Region IDs you can create your mirrors.

Once you get a hold of the system, it's easy!

13 is the mirror and 17 the reflected area:

 

(13)

(17)

(17)

(17)

(17)

 

With this structure you can have as much mirrors ad you want (till lag!)

 

MAXOPA stands for the maximum opacity your reflections will reach,

when the event stands right in front of the mirror. [0-255]

 

MAXDIST is the maximum distance where events can be reflected from.

 

PLAYREF toggles Player's reflection ON/OFF (true = on)

 

FOLREF toggles Followers reflection ON/OFF (true = on)

 

VEIREF toggles Vehicles reflection ON/OFF (true = on)

 

Demo

As the system can be hard to understand at glance, I created a simple demo to show how things work. You can download the demo HERE.

 

Script

 

 

 

################################################################################
#
# GINO REFLECTING MIRRORS 2.0 - FOR RPG MAKER VX ACE - 13/03/2011
#
################################################################################
#
# GINO IS THE BEST. WHEN HE'S ALONE.
#
################################################################################
#
# INSTRUCTIONS
#
# There are many options in "module GINOMIRROR"
#
# REFMODE lets you choose between ReflectAllBut and ReflectNoneBut modes:
#   -REFMODE = 1 ===> ReflectAllBut Mode
#   In ReflectAllBut mode, the system makes reflections for all events except
#	 those with the string "noref" in their name.
#   -REFMODE = 2 ===> ReflectNoneBut Mode
#   In ReflectNoneBut mode, the system makes reflection only for events with
#	 the string "reflect" in their name.
# Note that this option only apply for events.
#
# You must set two differents region_id:
# MIRRORID for the reflecting surface.
# EFFECTAREAID for the area whose events will be reflected.
#
# By using the two Region IDs you can create your mirrors.
# Once you get a hold of the system, it's easy!
#  13 is the mirror and 17 the reflected area:
#
#  (13)
#  (17)
#  (17)
#  (17)
#  (17)
#
# With this structure you can have as much mirrors ad you want (till lag!)
#
# MAXOPA stands for the maximum opacity your reflections will reach,
#		 when the event stands right in front of the mirror. [0-255]
#
# MAXDIST is the maximum distance where events can be reflected from.
#
# PLAYREF toggles Player's reflection ON/OFF (true = on)
#
# FOLREF toggles Followers reflection ON/OFF (true = on)
#
# VEIREF toggles Vehicles reflection ON/OFF (true = on)
#
################################################################################
#
#   If you want to meet gino you either die or you go to:
#   http://www.rpgmakervxace.net/
#
################################################################################
#
#   CREDITS:
#   -Many scripters who thaught me some cool moves.
#
#   Don't you dare to credit me in whatever project you will use this script.
#   The use of my name in credits its strictly forbidden.
#
################################################################################

module GRM

 #Switch beetween ReflectAllBut(1) and ReflectNoneBut(2) modes
 REFMODE = 1

 #Region ID for the surface of the mirror
 MIRRORID = 13

 #Region ID for the reflected area
 EFFECTAREAID = 17

 #Maximum opacity on the reflecting surface
 MAXOPA = 160

 #Maximum reflecting distance (in squares)
 MAXDIST = 4

 #Toggles Player's reflection ON/OFF (true = on)
 PLAYREF = true

 #Toggles Followers reflection ON/OFF (true = on)
 FOLREF = true

 #Toggles Vehicles reflection ON/OFF (true = on)
 VEIREF = true

end #module GINOMIRROR

################################################################################

class Sprite_Reflect < Sprite_Base

 attr_accessor :character

 def initialize(viewport, character = nil)
super(viewport)
@character = character
update
 end

 def update
super
self.visible = false
return if @character.region_id != GRM::EFFECTAREAID
update_bitmap
update_src_rect
update_position
update_other
 end

 def tileset_bitmap(tile_id)
Cache.tileset($game_map.tileset.tileset_names[5 + tile_id / 256])
 end

 def update_bitmap
if graphic_changed?
  @tile_id = @character.tile_id
  @character_name = @character.character_name
  @character_index = @character.character_index
  if @tile_id > 0
	set_tile_bitmap
  else
	set_character_bitmap
  end
end
 end

 def graphic_changed?
@tile_id != @character.tile_id ||
@character_name != @character.character_name ||
@character_index != @character.character_index
 end

 def set_tile_bitmap
sx = (@tile_id / 128 % 2 * 8 + @tile_id % 8) * 32;
sy = @tile_id % 256 / 8 % 16 * 32;
self.bitmap = tileset_bitmap(@tile_id)
self.src_rect.set(sx, sy, 32, 32)
self.ox = 16
self.oy = 32
 end

 def set_character_bitmap
self.bitmap = Cache.character(@character_name)
sign = @character_name[/^[\!\$]./]
if sign && sign.include?('$')
  @cw = bitmap.width / 3
  @ch = bitmap.height / 4
else
  @cw = bitmap.width / 12
  @ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
 end

 def update_src_rect
if @tile_id == 0
  index = @character.character_index
  pattern = @character.pattern < 3 ? @character.pattern : 1
  ref_direction = @character.direction
  if ref_direction == 2
	ref_direction = 8
  elsif ref_direction == 8
	ref_direction = 2
  end
  sx = (index % 4 * 3 + pattern) * @cw
  sy = (index / 4 * 4 + (ref_direction - 2) / 2) * @ch
  self.src_rect.set(sx, sy, @cw, @ch)
end
 end

 def update_position
self.x = @character.x * 32 + 16
for i in (@character.y - GRM::MAXDIST)...(@character.y)
  if $game_map.region_id(@character.x, i) == GRM::MIRRORID
	self.y = i * 32 + 32
	break
  end
end
self.z = @character.screen_z - 10
 end

 def update_other
subt = GRM::MAXOPA / GRM::MAXDIST
distance = (@character.screen_y - self.y) / 32
distance -= 1
self.opacity = GRM::MAXOPA - subt * distance
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.direction == 4 || @character.direction == 6
  self.visible = !@character.transparent && !@character.moving?
else
  self.visible = !@character.transparent
end
 end

end #class Sprite_Reflect < Sprite_Base

################################################################################

class Spriteset_Map

 def create_characters
@character_sprites = []
@reflection_sprites = []

$game_map.events.values.each do |event|
  @character_sprites.push(Sprite_Character.new(@viewport1, event))
  if (GRM::REFMODE == 1 && !event.name.include?("noref")) ||
	(GRM::REFMODE == 2 && event.name.include?("reflect"))
	@reflection_sprites.push(Sprite_Reflect.new(@viewport1, event))
  end
end

$game_map.vehicles.each do |vehicle|
  @character_sprites.push(Sprite_Character.new(@viewport1, vehicle))
  if GRM::VEIREF == true
	@reflection_sprites.push(Sprite_Reflect.new(@viewport1, vehicle))
  end
end

$game_player.followers.reverse_each do |follower|
  @character_sprites.push(Sprite_Character.new(@viewport1, follower))
  if GRM::FOLREF == true
	@reflection_sprites.push(Sprite_Reflect.new(@viewport1, follower))
  end
end

@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
if GRM::PLAYREF == true
  @reflection_sprites.push(Sprite_Reflect.new(@viewport1, $game_player))
end
@map_id = $game_map.map_id

 end

 def dispose_reflections
@reflection_sprites.each {|sprite| sprite.dispose }
 end

 def dispose
dispose_tilemap
dispose_parallax
dispose_characters
dispose_reflections
dispose_shadow
dispose_weather
dispose_pictures
dispose_timer
dispose_viewports
 end

 def update
update_tileset
update_tilemap
update_parallax
update_characters
update_reflections
update_shadow
update_weather
update_pictures
update_timer
update_viewports
 end

 def update_reflections
refresh_reflections if @map_id != $game_map.map_id
@reflection_sprites.each {|sprite| sprite.update }
 end

 def refresh_reflections
dispose_reflections
create_reflections
 end

end #class Spriteset_Map

################################################################################

class Game_Event < Game_Character

def name
  return @event.name
end

end #class Game_Event < Game_Character

 

 

 

FAQ

Q:

A:

 

Credit and Thanks

- ginolamantino

- All great scripters who inspired me:

-Yanfly

-Mr Bubble

-BulletXt

-Kylock

 

Author's Notes

Do NOT credit me if you use my script. ginolamantino is just a meaningless name. You can as well credit your Hamster.

Edited by ginolamantino

Share this post


Link to post
Share on other sites

This is very cool! but my only beef is the obvious fact that its not reflecting, its copying. Im not sure exactly how you are drawing the "mirrored" sprite, but wouldnt it be possible to check if facing up, show down, if facing down, show up?

 

Regardless, awesome script, and i love that you allowed customized distance area and per event reflection :D

Share this post


Link to post
Share on other sites

This is very cool! but my only beef is the obvious fact that its not reflecting, its copying. Im not sure exactly how you are drawing the "mirrored" sprite, but wouldnt it be possible to check if facing up, show down, if facing down, show up?

 

Regardless, awesome script, and i love that you allowed customized distance area and per event reflection :D

 

You got the point. In fact there are many things that must be improved and feedback is something I care for. I focused on getting the copy effect for now. Next version coming up soon.

Share this post


Link to post
Share on other sites

You got the point. In fact there are many things that must be improved and feedback is something I care for. I focused on getting the copy effect for now. Next version coming up soon.

 

If you wanted, you could even add options for "copy" or "mirror" per mirror using different regions? Just an idea, who knows what some people might want :P

Edited by Kalez

Share this post


Link to post
Share on other sites

Ok, new version on. I'm quite satisfied about its features, but it still needs more. For example it should be configurable in-game too.

About the "copy" "mirror" modes I'm not sure it would be of some use.

I was thinking about flipping option for reflections under characters. Like the reflection on a water surface.

I was also concerned about how suddenly the reflections disappear when you walk horizontally by the mirror.

And also, it would be nice having different mirrors with different options in the same map.

Edited by ginolamantino

Share this post


Link to post
Share on other sites

Really neat piece of work here! How would I go about turning off and on the toggle to reflect the player's reflection in like a script event or something? It's got me thinking of stuff like some funhouse-like dungeon with some mirrors that reflect you and some that don't, or perhaps your character is turned into a vampire and loses their reflection.

Share this post


Link to post
Share on other sites

Yet to be implemented. But if you simply want some mirror to reflect and some not to reflect (and they don't change dinamically), you simply don't put the two regions ID in front of the mirrors which are not reflecting.

I'll try and fix missing features now. Wait for news cyborgmermaid!

Share this post


Link to post
Share on other sites

Can't wait to see a screen shot!

I wonder can you add it to water or a pond, so that when you approach you can see a reflection?

Share this post


Link to post
Share on other sites

Can't wait to see a screen shot!

I wonder can you add it to water or a pond, so that when you approach you can see a reflection?

 

As for your request, a script already exists, you can find it in this very forum, here.

 

To be honest, I think that TDS's script is far better than mine (obviously, they do different things but the mechanics are similar). In fact, I was thinking that by modifying his script you could get the same result of mine.

Edited by Ginolamantino

Share this post


Link to post
Share on other sites

I'm not sure if its just me, but i cant figure out how to make this work. Well it does work, but the mirrors seem to reflect everything thats in its max distance. EXample, someone is looking as the mirror and i walk behind them, i can see that person and me with my opacity being lower.

Share this post


Link to post
Share on other sites

Demo download doesn't work, can anyone help me? Also TDS' script isn't valid for commercial games and has few issues (such as reflections not being tinted along with screen), so developing your own water script would be good idea.

Share this post


Link to post
Share on other sites

Just thought you might want to know mate:

 

For unknown reasons (at least to me), Ginolamantino is banned, and nobody's written in this thread in ages.

 

(If anyone knows the story behind Ginolamantino's banning, I'd very much like to know, I've been curious)

Share this post


Link to post
Share on other sites

Wow. Not only is he banned but the script he posted isn't there either. What a shame. I could used a script like this.

Edited by Animebryan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted