Versus Popup

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
Versus Popup
Version: 1.0
Author: modern algebra
Date: August 27, 2009

Version History


  • <Version 1.0> 08.27.2009 - Original Release

Description


This script allows you to show a brief versus screen at the beginning of the battle that takes the face of the first actor and the battler of the first enemy of the troop and shows them before the battle begins, with an image of your choosing between them.

Features

  • Shows a simple and clean versus screen before battle
  • Easy to change the important feature of the script, such as the SE that plays and the amount of time the versus screen is shown
  • You can choose the image that you want for the Versus graphic easily

Screenshots



Instructions

In order for this script to work, you MUST have an image (of arbitrary size) in the System folder of graphics called "Versus". This is the image that will be displayed between the actor face and the enemy battler. A sample image is attached to this post, but you can make your own image for this and it can be any size.

If you wish to change the amount of time the versus screen is up for, or the SE that plays, or if you are using faces that are non-standard size, than see the Editable Region at line 42 to receive instructions on how to configure those options.

Place this script above Main and below Materials.

Script


Code: [Select]
#==============================================================================
#    Versus Popup
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: August 27, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to show a brief versus screen at the beginning of
#   the battle that takes the face of the first actor and the battler of the
#   first enemy and shows them before the battle begins, with an image of your
#   choosing between them.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    In order for this script to work, you MUST have an image (of arbitrary
#   size) in the System folder of graphics called "Versus". This is the image
#   that will be displayed between the actor face and the enemy battler.
#
#    If you wish to change the amount of time the versus screen is up for, the
#   opacity of the background, the SE that plays, or if you are using faces
#   that are non-standard size, than see the Editable Region at line 42 to
#   receive instructions on how to configure those options.
#
#    Place this script above Main and below Materials.
#==============================================================================

#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constants - MAVP_POPUP_FRAMES, MAVP_FACE_SIZE, MAVP_SE,
#      MAVP_BACK_OPACITY
#    aliased method - process_battle_start
#    new method - create_versus_images
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * CONSTANTS
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  #  EDITABLE REGION
  #``````````````````````````````````````````````````````````````````````````
  #  The constants do the following:
  #    MAVP_POPUP_FRAMES - the number of frames the versus screen remains up
  #      for. Note that there are 60 frames in a second.
  #    MAVP_FACE_SIZE - the face size of your faces. Note that the default
  #      face size is 96. This should not be changed unless you are using
  #      faces that are either larger or smaller than RTP.
  #    MAVP_SE - You can set an SE to play when the versus screen first shows
  #      up. The format for this is:
  #          MAVP_SE = ["filename", volume, pitch]
  #      If you do not fill in volume or pitch, they default to 100 each. If
  #      you leave the array empty (MAVP_SE = []), then no SE will play.
  #    MAVP_BACK_OPACITY - The opacity of the grey background that hides the
  #      battle scene. The value can be 0-255, where 0 is fully transparent
  #      and 255 is fully opaque
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  MAVP_POPUP_FRAMES = 120
  MAVP_FACE_SIZE = 96
  MAVP_SE = ["Battle2"]
  MAVP_BACK_OPACITY = 128
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Process Start Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malg_asbsh_vs_popup_prcs_stbtl_7jc2 process_battle_start
  def process_battle_start (*args)
    create_dimming_bg
    create_face_window
    create_enemy_battler
    create_versus_image
    # Play SE if set
    RPG::SE.new (*MAVP_SE).play unless MAVP_SE.empty?
    # Make versus popup
    wait (MAVP_POPUP_FRAMES)
    # Dispose versus images
    @dimbg_sprite.bitmap.dispose
    @dimbg_sprite.dispose
    @versus_sprite.dispose
    @actor_window.dispose
    @battler_sprite.dispose
    $game_temp.background_bitmap.dispose
    # Run Original Method
    malg_asbsh_vs_popup_prcs_stbtl_7jc2 (*args)
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Dimming BG
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_dimming_bg
    # Create Background
    @dimbg_sprite = Sprite.new
    @dimbg_sprite.bitmap = Bitmap.new (Graphics.width, Graphics.height)
    @dimbg_sprite.bitmap.fill_rect (@dimbg_sprite.bitmap.rect, Color.new (16, 16, 16, MAVP_BACK_OPACITY))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Face Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_face_window
    # Create Face images
    @actor_window = Window_Base.new (16, (Graphics.height - 160 - MAVP_FACE_SIZE) / 2, 32 + MAVP_FACE_SIZE, 128)
    @actor_window.opacity = 0
    @actor_window.draw_actor_face ($game_party.members[0], 0, 0, MAVP_FACE_SIZE) unless $game_party.members.empty?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Enemy Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_enemy_battler
    # Create Battler Image
    @battler_sprite = Sprite_Base.new
    unless $game_troop.members.empty?
      enemy = $game_troop.members[0]
      @battler_sprite.bitmap = Cache.battler (enemy.battler_name, enemy.battler_hue)
      @battler_sprite.x = Graphics.width - 32 - @battler_sprite.bitmap.width
      @battler_sprite.y = (Graphics.height - 128 - @battler_sprite.bitmap.height) / 2
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Versus Image
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_versus_image
    # Create versus image
    @versus_sprite = Sprite_Base.new
    @versus_sprite.z = 200
    @versus_sprite.bitmap = Cache.system ("Versus")
    @versus_sprite.x = @actor_window.x + @actor_window.width - 16
    @versus_sprite.x += (@battler_sprite.x - @versus_sprite.x - @versus_sprite.width) / 2
    @versus_sprite.y = (Graphics.height - 128 - @versus_sprite.bitmap.height) / 2
  end
end

Credit


  • modern algebra

Thanks

  • ashbash361, for requesting this script

Support


Please post here for support.

Known Compatibility Issues

No known compatibility issues, though it won't work with some exotic CBSes, particularly ones that occur outside of Scene_Battle


Creative Commons License
This script by modern algebra is licensed under a Creative Commons Attribution-Non-Commercial-Share Alike 2.5 Canada License.
« Last Edit: February 11, 2010, 09:48:33 PM by Modern Algebra »

*
Rep:
Level 102
2014 Best Non-RM Creator2014 Biggest Forum Potato2014 Biggest Narcissist Award2013 Best IRC Chatterbox2013 Best Game Creator (Non-RM)Participant - GIAW 112012 Best Use Of Avatar and Signature space2012 Funniest Member2012 Most Successful Troll2012 Best IRC ChatterboxSecret Santa 2012 ParticipantProject of the Month winner for November 2009For being a noted contributor to the RMRK Wiki2010 Best IRC Chatterbox2010 Biggest Forum Couch Potato2010 Most Successful Troll
I don't know what it is about you and the color red for battle fonts, but it doesn't look very good. ._.

*
Rep:
Level 97
2014 Best RPG Maker User - Engine2014 Most Unsung Member2013 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best RPG Maker User (Scripting)2011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best Use of Avatar and Signature Space2010 Favourite Staff Member2010 Most Mature Member
I don't know what it is about you and the color red for battle fonts, but it doesn't look very good. ._.

Well, it's just a sample image. I would hope that people who use this script make their own. And for Damage Popups, people can change that if they want to; HP Damage colour is configurable in the script.


Also, one thing that I've noticed - exceptionally large battlers like EvilKing make this script look awful, so I am considering cutting or stretching exceptionally large battlers. If anyone would like me to, just tell me.
« Last Edit: August 28, 2009, 01:31:50 AM by modern algebra »

*
Rep:
Level 102
2014 Best Non-RM Creator2014 Biggest Forum Potato2014 Biggest Narcissist Award2013 Best IRC Chatterbox2013 Best Game Creator (Non-RM)Participant - GIAW 112012 Best Use Of Avatar and Signature space2012 Funniest Member2012 Most Successful Troll2012 Best IRC ChatterboxSecret Santa 2012 ParticipantProject of the Month winner for November 2009For being a noted contributor to the RMRK Wiki2010 Best IRC Chatterbox2010 Biggest Forum Couch Potato2010 Most Successful Troll
Yeah, I know it's all configurable. I was just making an observation. ;d

**
Rep: +0/-0Level 71
RMRK Junior
i was just wondering if this script could be modified so it only activates the vs image when a switch is turned on. I'd like to use it just for my boss battles.

***
Rep:
Level 69
RESIDENT ADONKADONK
Modern, I would like it if you created a different version where the party leader(slot 1)'s sprite was used instead of a face.

I'm back.

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Zero to Hero2014 Best IRC Quote2014 Most Missed Member2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Replace line 104 with this:
Code: [Select]
    @actor_window.draw_actor_graphic ($game_party.members[0], 0, 0) unless $game_party.members.empty?
it's like a metaphor or something i don't know

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
i was just wondering if this script could be modified so it only activates the vs image when a switch is turned on. I'd like to use it just for my boss battles.

Here you go.

INSTRUCTIONS:
Just change MAVP_SWITCH (in the editable region) to the event switch you want to use.
And activate the switch before a battle you want to use it in.

Versus Pop-Up remains active as long as the event switch in ON.
So either switch it off after your boss battle, or keep it on if you still want to use it.


Code: [Select]
#==============================================================================
#    Versus Popup
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: August 27, 2009
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to show a brief versus screen at the beginning of
#   the battle that takes the face of the first actor and the battler of the
#   first enemy and shows them before the battle begins, with an image of your
#   choosing between them.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    In order for this script to work, you MUST have an image (of arbitrary
#   size) in the System folder of graphics called "Versus". This is the image
#   that will be displayed between the actor face and the enemy battler.
#
#    If you wish to change the amount of time the versus screen is up for, the
#   opacity of the background, the SE that plays, or if you are using faces
#   that are non-standard size, than see the Editable Region at line 42 to
#   receive instructions on how to configure those options.
#
#    Place this script above Main and below Materials.
#==============================================================================

#==============================================================================
# ** Scene Battle
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new constants - MAVP_POPUP_FRAMES, MAVP_FACE_SIZE, MAVP_SE,
#      MAVP_BACK_OPACITY
#    aliased method - process_battle_start
#    new method - create_versus_images
#==============================================================================

class Scene_Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * CONSTANTS
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  #  EDITABLE REGION
  #``````````````````````````````````````````````````````````````````````````
  #  The constants do the following:
  #
  #    MAVP_SWITCH - The switch id to activate the script, if you want to only
  #      use the pop-up when fighting a boss battle, activate the switch just
  #      before the fight. Otherwise, if you wish to use the versus pop-up
  #      the entire game, just activate the switch in your beginning scene.
  #      You deactivate the pop-up by turning off the switch.
  #
  #    MAVP_POPUP_FRAMES - the number of frames the versus screen remains up
  #      for. Note that there are 60 frames in a second.
  #
  #    MAVP_FACE_SIZE - the face size of your faces. Note that the default
  #      face size is 96. This should not be changed unless you are using
  #      faces that are either larger or smaller than RTP.
  #
  #    MAVP_SE - You can set an SE to play when the versus screen first shows
  #      up. The format for this is:
  #          MAVP_SE = ["filename", volume, pitch]
  #      If you do not fill in volume or pitch, they default to 100 each. If
  #      you leave the array empty (MAVP_SE = []), then no SE will play.
  #
  #    MAVP_BACK_OPACITY - The opacity of the grey background that hides the
  #      battle scene. The value can be 0-255, where 0 is fully transparent
  #      and 255 is fully opaque
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  MAVP_SWITCH = 122               #Event Switch ID
  MAVP_POPUP_FRAMES = 120
  MAVP_FACE_SIZE = 96
  MAVP_SE = ["Battle2"]
  MAVP_BACK_OPACITY = 128
  #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Process Start Battle
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  alias malg_asbsh_vs_popup_prcs_stbtl_7jc2 process_battle_start
  def process_battle_start (*args)
    unless $game_switches[MAVP_SWITCH]
       malg_asbsh_vs_popup_prcs_stbtl_7jc2 (*args)
   else
    create_dimming_bg
    create_face_window
    create_enemy_battler
    create_versus_image
    # Play SE if set
    RPG::SE.new (*MAVP_SE).play unless MAVP_SE.empty?
    # Make versus popup
    wait (MAVP_POPUP_FRAMES)
    # Dispose versus images
    @dimbg_sprite.bitmap.dispose
    @dimbg_sprite.dispose
    @versus_sprite.dispose
    @actor_window.dispose
    @battler_sprite.dispose
    $game_temp.background_bitmap.dispose
    # Run Original Method
    malg_asbsh_vs_popup_prcs_stbtl_7jc2 (*args)
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Dimming BG
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_dimming_bg
    # Create Background
    @dimbg_sprite = Sprite.new
    @dimbg_sprite.bitmap = Bitmap.new (Graphics.width, Graphics.height)
    @dimbg_sprite.bitmap.fill_rect (@dimbg_sprite.bitmap.rect, Color.new (16, 16, 16, MAVP_BACK_OPACITY))
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Face Window
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_face_window
    # Create Face images
    @actor_window = Window_Base.new (16, (Graphics.height - 160 - MAVP_FACE_SIZE) / 2, 32 + MAVP_FACE_SIZE, 128)
    @actor_window.opacity = 0
    @actor_window.draw_actor_face ($game_party.members[0], 0, 0, MAVP_FACE_SIZE) unless $game_party.members.empty?
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Enemy Battler
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_enemy_battler
    # Create Battler Image
    @battler_sprite = Sprite_Base.new
    unless $game_troop.members.empty?
      enemy = $game_troop.members[0]
      @battler_sprite.bitmap = Cache.battler (enemy.battler_name, enemy.battler_hue)
      @battler_sprite.x = Graphics.width - 32 - @battler_sprite.bitmap.width
      @battler_sprite.y = (Graphics.height - 128 - @battler_sprite.bitmap.height) / 2
    end
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Create Versus Image
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def create_versus_image
    # Create versus image
    @versus_sprite = Sprite_Base.new
    @versus_sprite.z = 200
    @versus_sprite.bitmap = Cache.system ("Versus")
    @versus_sprite.x = @actor_window.x + @actor_window.width - 16
    @versus_sprite.x += (@battler_sprite.x - @versus_sprite.x - @versus_sprite.width) / 2
    @versus_sprite.y = (Graphics.height - 128 - @versus_sprite.bitmap.height) / 2
  end
end
« Last Edit: February 01, 2012, 11:10:35 AM by diamondandplatinum3 »

*
Rep:
Level 82
'SWITCH' is a bad name to put into the global namespace because it's very likely another script would also think of using that and there'd be a conflict.

It either wants to be contained within a module, or add some garbage letters to the name to increase it's uniqueness. An example can be seen in the script:

malg_asbsh_vs_popup_prcs_stbtl_7jc2

The 7jc2 part at the end is a set of random letters that are added making the alias name very unique. It's incredibly unlikely that the same name will exist again.

My suggestion would be to follow the same format as the other constants in the script and precede 'SWITCH' with MAVP_ for MAVP_SWITCH. I'd also place that variable with the other 4 constants in Scene_Battle to further encapsulate the name.
(Why do I always feel like it's the end of the world and I'm the last man standing?)

*
*crack*
Rep:
Level 63
2012 Best Newbie2012 Most Unsung MemberFor frequently finding and reporting spam and spam bots
You're right.

I was trying to keep it simple for non-scripters, but I do see that it could cause problems.

Also the variable was out of the editable region because I like to have the event switch be the first thing I see in my scripts (It's a habit).

Fixed.