RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[XP] Two Graphics for an Event at the Same Time? (fades between the two)

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 70
RMRK Junior
Every Event gets one Graphic.  I wrote a FADE EVENT script that allows an event to Fade In and Out.  What I want to do is to Transition a Graphic to Another Graphic, but the Event would basically have to have TWO GRAPHICS to "Dissolve" back and forth between the two.

Anyone have ANY idea how I could pull that off?  I was kind of thinking that in an Event Script I might be able to pull it out of my ass by using Sprite.

class Game_Event
def create_graphics
  main_graphic = Sprite.new
  next_graphic = Sprite.new

  main_graphic.fade(opacity = 0, duration = 30frames)
  next_graphic.fade(opacity = 255, duration = 30frames)
end

Would something like that possibly work?
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

***
Rep:
Level 57
Noun. The act of illuminating.
Contestant - GIAW 9
I will make this script as soon as I get into the program. I trying to download it on here (My laptop) now, but if it fails I will have to wait til tomorrow. One way or another, I will make you the script though.

***
Rep:
Level 70
RMRK Junior
Sounds good.  I appreciate it.  I'll probably be busy for the rest of the day anyway.

If you need to take a look at the source I already have, to reference my fade_event script, it is in the "Caterpillar" script.
http://www.775.net/~heretic/downloads/rmxp/cat.php
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

***
Rep:
Level 70
RMRK Junior
I need to add something critical to this.

The Event that is going to have TWO Graphics absolutely MUST MUST MUST perform exactly as the original Graphic does.  Reason being is that the "Transition" I am going to put together will take place as those Events are moving around, and following the player.  I intend to use it for a Transition to either a "Dead" version of that same Actors Graphic or (depending on who uses the script) something like a "Coffin" Graphic.

If you play with the link I put up above, the transition will occur as characters die off on the map, so just like they fade into a more "ghostly" state in the current version, I am hoping to accomplish a way for them to "dissolve" into that "alternate graphic".

Hopefully wont be too much to do, and you'll more than obviously get due credit as well, Illumination™!
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

***
Rep:
Level 57
Noun. The act of illuminating.
Contestant - GIAW 9
Sounds good broski. Gonna check it out tomorrow, my download just gets longer and longer here. Dunno what I did wrong.

***
Rep:
Level 57
Noun. The act of illuminating.
Contestant - GIAW 9
Ok, so I now read your thread again and see that I got it wrong. I made the events keep gliding between the two sprites on and on again, while you probably only wanted it to happen once and on a controlled trigger. Check this out though and tell me what I did wrong yourself so I don't make any further mistakes.

Code: [Select]
#==============================================================================
# ** 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
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :alt_bitmap
  attr_accessor :alt_opacity
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     map_id : map ID
  #     event  : event (RPG::Event)
  #--------------------------------------------------------------------------
  alias illuminate_initialize initialize
  def initialize(map_id, event)
    # Old
    illuminate_initialize(map_id, event)
    # Load custom graphics
    if event.pages[0].list[0].parameters[0] == "ALT_GRAPHICS"
      @alt_bitmap = Sprite.new
      @alt_bitmap.bitmap = Bitmap.new( "Graphics/Characters/" + event.pages[0].list[1].parameters[0] )
      @alt_bitmap.ox = (@alt_bitmap.bitmap.width / 4) / 2
      @alt_bitmap.oy = (@alt_bitmap.bitmap.height / 4)
      @alt_opacity = 0
      @alt_bitmap.z = 99997
      @alt_bitmap.src_rect.set(0, 0, 32, 48)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias illuminate_update update
  def update
    # Old
    illuminate_update
    # Change between graphics
    @alt_opacity += 2 if @alt_opacity != nil   
    # Set the opacity
    if @alt_opacity != nil
      @alt_bitmap.opacity = @alt_opacity
      @alt_bitmap.opacity = @alt_opacity - 255 if @alt_opacity > 255
      @alt_bitmap.opacity = 255 - @alt_bitmap.opacity if @alt_opacity > 255
      @alt_opacity = 0 if @alt_opacity > 500
      # Set coordinates
      @alt_bitmap.x = self.screen_x
      @alt_bitmap.y = self.screen_y
      # Source
      @cw = @alt_bitmap.bitmap.width / 4
      @ch = @alt_bitmap.bitmap.height / 4
      sx = @pattern * @cw
      sy = (@direction - 2) / 2 * @ch
      @alt_bitmap.src_rect.set(sx, sy, @cw, @ch)
    end
  end
end

#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display the character.It observes the Game_Character
#  class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias illuminate_update update
  def update
    # Old illuminate_update
    illuminate_update
    # Set opacity according to character
    if @character.instance_of?(Game_Event) && @character.alt_opacity != nil
      # Set the opacity
      self.opacity = 255 - @character.alt_bitmap.opacity
    end
  end
end

Put this in a new script obviously, and to make an event have a second graphics, add a comment with the following as the FIRST command on the FIRST page of the event, looking like this:

Code: [Select]
ALT_GRAPHICS
001-Fighter01

***
Rep:
Level 70
RMRK Junior
(*deleted*)
« Last Edit: March 31, 2012, 04:20:59 AM by Heretic86 »
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!

***
Rep:
Level 70
RMRK Junior
Nevermind.  I got it.  Based on Illumination's code, but got something working that is pretty damn cool here!
« Last Edit: March 31, 2012, 04:21:37 AM by Heretic86 »
Heretic's Vehicles XP (Boat and Magic Carpet)

Heretic's Collection XP Ver 2.3 - Updated to include Dynamic Lighting, Moving Platforms, Vehicles, and much much more!