Help - Search - Members - Calendar
Full Version: NPC fadeout
RPG RPG Revolution Forums > Scripting > Event Emporium
AphidRuin
In some good RMXP games (Like Blizzard's Lexima Legends IV), when there is a boss monster in the cutscene, when the battle is over, they will have this nice redish fadeout animation before they disappear into thin air. So how are we able to do this? It just look very simple but I can't figure out how can I do this.

Help is very much appreciated as I will be needing this fadeout thing, right now immediately in my project. Thanks. smile.gif
Redd
What game maker are you needing help with?
AphidRuin
Sorry. Forgot to mention the engine I am using. I am using RPG Maker XP.
brewmeister
I assume you mean a fade-out on the map like the fade-out in battle??

There is no graceful way to do it with event commands alone.
There is a built-in 'collapse' command on the RPG::Sprite class, but it's pretty quick.

Best I can think of is to extend the Game_Character & Sprite_Character classes, and implement our own 'collapse' method.

Paste this script in a new script above Main, event instructions included...

CODE
#======================================================================
========
# ** Collapse Enemy Sprite
#------------------------------------------------------------------------------
# Modify the Game_Character & Sprite_Character classes to enable
# "collapse" effect on a map sprite
# to call from an enemy event:
# @> Script: $game_map.events[@event_id].collapse = true
# @> Wait:127 frame(s)
# @> Control Self Switch: A = ON
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :collapse

alias collapse_init initialize

def initialize
collapse_init
@collapse = false
end
end

class Sprite_Character
alias collapse_init initialize
alias collapse_update update
def initialize(viewport, character = nil)
@collapse_duration = 0
collapse_init(viewport, character)
end
def update
collapse_update
if @character.collapse
collapse
@character.collapse = false
end
if @collapse_duration > 0
@collapse_duration -= 1
self.opacity = @collapse_duration * 2
if @collapse_duration == 0
@character.transparent = true
end
end
end
def collapse
self.blend_type = 1
self.color.set(255, 0, 0, 127)
@collapse_duration = 127
end

end
Lurvid
Uh, wouldn't it be easier just to make a spriteset of the enemy fading out and have the event switch to that spriteset? It would also give you control of what the color of their fadeout would be.
stripe103
The script brewmeister posted can do that as well, it just to change the colors to variables instead and they can be changed throughout the game as well. You can use the normal RMXP variables, or you can use ruby variables ( such as $red = 15 or $color = ([160, 0, 255]) )
brewmeister
Lurvid, sometimes we can't see the forest for the trees. Good suggestion.

If it's a limited application, You could make the whole effect into an animation, Play the animation & change the event to transparent.
(If you need more frames)
AphidRuin
QUOTE (brewmeister @ Mar 30 2011, 02:01 AM) *
I assume you mean a fade-out on the map like the fade-out in battle??

There is no graceful way to do it with event commands alone.
There is a built-in 'collapse' command on the RPG::Sprite class, but it's pretty quick.

Best I can think of is to extend the Game_Character & Sprite_Character classes, and implement our own 'collapse' method.

Paste this script in a new script above Main, event instructions included...

CODE
#======================================================================
========
# ** Collapse Enemy Sprite
#------------------------------------------------------------------------------
# Modify the Game_Character & Sprite_Character classes to enable
# "collapse" effect on a map sprite
# to call from an enemy event:
# @> Script: $game_map.events[@event_id].collapse = true
# @> Wait:127 frame(s)
# @> Control Self Switch: A = ON
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :collapse

alias collapse_init initialize

def initialize
collapse_init
@collapse = false
end
end

class Sprite_Character
alias collapse_init initialize
alias collapse_update update
def initialize(viewport, character = nil)
@collapse_duration = 0
collapse_init(viewport, character)
end
def update
collapse_update
if @character.collapse
collapse
@character.collapse = false
end
if @collapse_duration > 0
@collapse_duration -= 1
self.opacity = @collapse_duration * 2
if @collapse_duration == 0
@character.transparent = true
end
end
end
def collapse
self.blend_type = 1
self.color.set(255, 0, 0, 127)
@collapse_duration = 127
end

end


Wow thanks for all your kind replies. Anyway, I am now trying out the script. I will post the results later. Thanks! smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.