The RPG Maker Resource Kit

RMRK RPG Maker Creation => VX => VX Scripts Database => Topic started by: modern algebra on March 14, 2008, 04:28:33 AM

Title: Extra Event Pictures
Post by: modern algebra on March 14, 2008, 04:28:33 AM
Extra Event Pictures
Version: 1.1
Author: modern algebra
Date: May 7, 2011

Version History



Description


For complicated Picture eventing, it is quite clear that 20 pictures is not enough. This script allows you to use more, albeit in a slightly non-intuitive way

Features


Screenshots

Not really necessary - I could make a bunch of pictures show up on the screen, but that wouldn't be particularly difficult even without the script as I could just merge all the pictures together in Paint. Just try it out in a new project or something to see it.

Instructions

See inside the script for instructions.

Script


Code: [Select]
#==============================================================================
#    Extra Event Pictures
#    Author: modern algebra (rmrk.net)
#    Version: 1.1
#    Date: May 7, 2011
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    For complicated Picture eventing, it is quite clear that 20 pictures is
#   not enough. This script allows you to use more, albeit in a non-intuitive
#   way
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#    Place this script above Main and below Materials.
#
#    It is quite simple: to use a picture that has a greater label than 20, all
#   that is required is that you set an in-game variable (that you choose below
#   at line 44) to the number that you want, say 21 or 22 or 105. Then set up
#   the Picture command directly below it. If you have EP_AUTORESET at line 46
#   set to true, the variable is then cleared and so every time you want to
#   handle the picture you have to re-set that variable to the number you want.
#   If it is false, then that does not happen and so you have to remember to
#   set it back to 0 when you are finished operating on that picture. You also
#   must set a maximum number of pictures at line 43.
#
#  EXAMPLE:
#    So, a line to do this would be:
#      @> Control Variable: [XXXX: Picture Label] = Y
#      @> Show Picture: 1, 'Avatar', Upper Left (0, 0), (100%, 100%), 255, Normal
#
#   That would make a picture with number Y. It is important to remember that
#   the variable [XXXX: Picture Number] is set back to 0 after every picture
#   command (if you use EP_AUTORESET), so if you wanted to then move the
#   picture, the event must have another Control Variable, like so:
#
#      @> Control Variable: [XXXX: Picture Number] = Y
#      @> Show Picture: 1, 'Avatar', Upper Left (0, 0), (100%, 100%), 255, Normal
#      @> Control Variable: [XXXX: Picture Number] = Y
#      @> Move Picture: 2, Upper Left (105, 0), (100%, 100%), 255, Normal, @60, Wait     
#==============================================================================
# * Global Constants
#==============================================================================
EP_PIC_LIMIT = 50   # The maximum number of pictures useable
EP_PIC_VARIABLE = 1 # The ID of the variable you set to operate on extra pics
# Whether to automatically reset the variable to 0 after each operation
EP_AUTORESET = true

#==============================================================================
# ** Game_Screen
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - clear
#==============================================================================

class Game_Screen
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Clear
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modera_extrapictr_clr_4fx2 clear
  def clear (*args)
    modera_extrapictr_clr_4fx2 (*args) # Run original method
    # Add extra pictures
    for i in 21..EP_PIC_LIMIT
      @pictures.push (Game_Picture.new (i))
    end
  end
end

#==============================================================================
# ** Spriteset_Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - create_pictures
#==============================================================================

class Spriteset_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Picture Sprite
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias modrn_expictur_createbtl_9ic2 create_pictures
  def create_pictures (*args)
    modrn_expictur_createbtl_9ic2 (*args) # Run original method
    # Create Extra Pictures
    for i in 21..EP_PIC_LIMIT
      @picture_sprites.push(Sprite_Picture.new(@viewport2,
        $game_troop.screen.pictures[i]))
    end
  end
end

#==============================================================================
# ** Spriteset_Map
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased method - create_pictures
#==============================================================================

class Spriteset_Map
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Picture Sprite
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias mala_extrpics_create_5th1 create_pictures
  def create_pictures (*args)
    mala_extrpics_create_5th1 (*args) # Run original method
    # Create Extra Pictures
    for i in 21..EP_PIC_LIMIT
      @picture_sprites.push(Sprite_Picture.new(@viewport2,
        $game_map.screen.pictures[i]))
    end
  end
end

#==============================================================================
# ** Game_Interpreter
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    aliased methods - command_231, _232, _233, _234, _235
#==============================================================================

class Game_Interpreter
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Picture Operations
  #    231 => Show; 232 => Move; 233 => Rotate; 234 => Tint; 235 => Erase
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [:command_231, :command_232, :command_233, :command_234, :command_235].each { |method|
    alias_method ("ma_extrpics_#{method}_7xa7".to_sym, method)
    define_method (method) { |*args|
      # If the label is within the proper set of numbers
      if $game_variables[EP_PIC_VARIABLE] > 20 && $game_variables[EP_PIC_VARIABLE] <= EP_PIC_LIMIT
        @params[0] = $game_variables[EP_PIC_VARIABLE]
      end
      # Run Original Method
      self.send ("ma_extrpics_#{method}_7xa7".to_sym, *args)
      $game_variables[EP_PIC_VARIABLE] = 0 if EP_AUTORESET # Reset Variable
    }
  }
end

Credit



Support


Just post in this topic if you have any questions

Known Compatibility Issues

No known compatibility issues.


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
Title: Re: Extra Event Pictures
Post by: HEast on May 31, 2008, 03:42:56 PM
Script takes getting used to but its working fine.

MAII, you forgot to say that the Script has got to been put above Main.

Show Picture: Working
Move Picture: Working
Tint Picture: Working

Title: Re: Extra Event Pictures
Post by: modern algebra on May 31, 2008, 05:44:53 PM
I suppose I did. All scripts have to be put above Main though :P
Title: Re: Extra Event Pictures
Post by: Nessiah on May 08, 2011, 02:52:28 AM
I found out that Rotate Picture doesn't work with this ;v;
To be exact: I used a show picture #1 and made it rotate...It won't rotate.
I haven't tested it yet with binded into variable tho so I'm going to try that one out too.

EDIT: Ok it seems that I have to bind my picture numbers in variable for it to rotate :o
Adding attachment~ I just find it funny it's not above 20 and it won't rotate :) I'll have to get used to it I guess! But I thought I should bring it up.
Title: Re: Extra Event Pictures
Post by: modern algebra on May 08, 2011, 03:53:10 AM
Oops! That's an error. I will fix it immediately.


EDIT::

Alright, I updated the script to 1.1. You can get it from the first post.
Title: Re: Extra Event Pictures
Post by: Nessiah on May 08, 2011, 05:57:00 AM
Thank you Modern Algebra <3

Edit: Suddenly it's not compatible with woratanas picture below character XD

Code: [Select]
#===============================================================
# ? [VX] ? Pictures under Characters ? ?
# * Show pictures under characters on map but above map tiles *
#--------------------------------------------------------------
# ? by Woratana [woratana@hotmail.com]
# ? Thaiware RPG Maker Community
# ? Released on: 22/02/2009
# ? Version: 1.0
#--------------------------------------------------------------
# ? Update:
#--------------------------------------------------------------
# ? Version 1.0 (22/02/2009)
# - Unlimited numbers of picture under characters
#
#--------------------------------------------------------------
# ? Compatibility:
#--------------------------------------------------------------
# ? This script will rewrite 0 method(s):
#
#
# ? This script will alias 2 method(s):
#     Spriteset_Map.create_pictures
#     Sprite_Picture.update
#
# ? This script should work with most scripts
#
#--------------------------------------------------------------
# ? Installation:
#--------------------------------------------------------------
# 1) This script should be placed JUST AFTER ? Materials.
#
# ? Like this:
# ? Materials
# *Pictures under Characters
# ...
# ...
# ? Main Process
# Main
#
# 2) Setup this script in Setup Part below.
#
#--------------------------------------------------------------
# ? How to use:
#--------------------------------------------------------------
# ? Place this script and setup in the setup part.
#
#=================================================================

class Spriteset_Map

  #=================================================================
  # ++ Setup Part
  #-----------------------------------------------------------------
  FIRST_PICBELOW_ID = 80 # First ID of picture that will show below characters
  LAST_PICBELOW_ID = 99 # Last ID of picture that will show below characters

  #   For example, if you set FIRST to 10 and LAST to 15, picture ID 10-15
  # will show below characters on map.
  #=================================================================

  alias wora_picbelow_sprsetmap_crepic create_pictures

  #--------------------------------------------------------------------------
  # * Create Picture Sprite
  #--------------------------------------------------------------------------
  def create_pictures(*args)
    wora_picbelow_sprsetmap_crepic(*args)
    for pic_id in FIRST_PICBELOW_ID..LAST_PICBELOW_ID
      @picture_sprites[pic_id - 1].dispose
      # Create picture below player in viewport1, so it can show just below player
      @picture_sprites[pic_id - 1] = Sprite_Picture.new(@viewport1,
    $game_map.screen.pictures[pic_id])
    end
  end
end

class Sprite_Picture < Sprite
  alias wora_picbelow_sprpic_upd update

  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update(*args)
    wora_picbelow_sprpic_upd(*args)
    self.z = $game_player.screen_z - 1 if @picture.number >=
  Spriteset_Map::FIRST_PICBELOW_ID and @picture.number <= Spriteset_Map::LAST_PICBELOW_ID
  end
end
Title: Re: Extra Event Pictures
Post by: modern algebra on May 08, 2011, 02:19:57 PM
Err.. maybe when you recopied it you didn't set the PIC_LIMIT in my script back up to whatever you had it before? The default is only 50.
Title: Re: Extra Event Pictures
Post by: Nessiah on May 09, 2011, 02:16:13 AM
That's weird, I set it back to 100, I'll just use the old version for now I guess :)
Title: Re: Extra Event Pictures
Post by: modern algebra on May 09, 2011, 02:19:56 AM
Oh, and was Extra Event Pictures above the Fix Pictures script? If not, then that would cause that error.
Title: Re: Extra Event Pictures
Post by: Nessiah on May 09, 2011, 03:06:56 AM
I have it above fix picture yeah, but I put the woratana script below it and increase my pic limit higher, I guess my pic limit was the problem? Woops sorry about that X'D
Title: Re: Extra Event Pictures
Post by: modern algebra on May 09, 2011, 03:53:23 AM
So it's working now?
Title: Re: Extra Event Pictures
Post by: Nessiah on May 09, 2011, 04:26:13 AM
Yes! Don't worry >v<)//