• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Reminder: AI-generated content is not allowed on the forums per the Rules and Regulations. Please contact us if you have any questions!
VS Transitions for 1V1, 1V2, 2V1, 2V2

v21.1 VS Transitions for 1V1, 1V2, 2V1, 2V2 1.0.0

This resource pertains to version 21.1 of Pokémon Essentials.
Pokémon Essentials Version
v21.1 ✅
Also compatible with
  1. v21
Have you ever wanted to add more than just a 1v1 vs transition into your game?

Well, now you can! Thanks to the brilliant minds of Vendily and myself.



Simply add this script to your game files. The path in which I used was: Data > Scripts > 012_Overworld > 002_Battle Triggering > 002_Overworld_BattleIntroAnim
And I inserted the script at the bottom of the page just like so.

Ruby:
Expand Collapse Copy
#===============================================================================
# Play the Doubles VSTransition, edit by TheOnlyFelicity & Vendily
#===============================================================================
SpecialBattleIntroAnimations.register("alternate_vs_trainer_animation", 50,   # Priority 50
  proc { |battle_type, foe, location|   # Condition
    next false if battle_type.even?  # Trainer battle
    tr_type = foe[0].trainer_type
    next pbResolveBitmap("Graphics/Transitions/vsTrainer_#{tr_type}") &&
         pbResolveBitmap("Graphics/Transitions/vsBar_#{tr_type}")
  },
  proc { |viewport, battle_type, foe, location|   # Animation
    # Determine filenames of graphics to be used
    tr_type = foe[0].trainer_type
    trainer_bar_graphic = sprintf("vsBar_%s", tr_type.to_s) rescue nil
    trainer_graphic     = sprintf("vsTrainer_%s", tr_type.to_s) rescue nil
    player_tr_type = $player.trainer_type
    outfit = $player.outfit
    player_bar_graphic = sprintf("vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil
    if !pbResolveBitmap("Graphics/Transitions/" + player_bar_graphic)
      player_bar_graphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil
    end
    player_graphic = sprintf("vsTrainer_%s_%d", player_tr_type.to_s, outfit) rescue nil
    if !pbResolveBitmap("Graphics/Transitions/" + player_graphic)
      player_graphic = sprintf("vsTrainer_%s", player_tr_type.to_s) rescue nil
    end
    # check if there is a partner or second Trainer
    trainer1_graphic = nil
    if foe[1]
      tr1_type = foe[1].trainer_type
      if pbResolveBitmap("Graphics/Transitions/vsTrainer_#{tr1_type}")
        trainer1_graphic = sprintf("vsTrainer_%s", tr1_type.to_s) rescue nil
      end
    end
    partner_graphic = nil
    if $PokemonGlobal.partner
      partner_tr_type = $PokemonGlobal.partner[0]
      if pbResolveBitmap("Graphics/Transitions/vsTrainer_#{partner_tr_type}")
        partner_graphic = sprintf("vsTrainer_%s", partner_tr_type.to_s) rescue nil
      end
    end
    # Set up viewports
    viewplayer = Viewport.new(0, Graphics.height / 3, Graphics.width / 2, 128)
    viewplayer.z = viewport.z
    viewopp = Viewport.new(Graphics.width / 2, Graphics.height / 3, Graphics.width / 2, 128)
    viewopp.z = viewport.z
    viewvs = Viewport.new(0, 0, Graphics.width, Graphics.height)
    viewvs.z = viewport.z
    # Set up sprites
    fade = Sprite.new(viewport)
    fade.bitmap  = RPG::Cache.transition("vsFlash")
    fade.tone    = Tone.new(-255, -255, -255)
    fade.opacity = 100
    overlay = Sprite.new(viewport)
    overlay.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    pbSetSystemFont(overlay.bitmap)
    xoffset = ((Graphics.width / 2) / 10) * 10
    bar1 = Sprite.new(viewplayer)
    bar1.bitmap = RPG::Cache.transition(player_bar_graphic)
    bar1.x      = -xoffset
    bar2 = Sprite.new(viewopp)
    bar2.bitmap = RPG::Cache.transition(trainer_bar_graphic)
    bar2.x      = xoffset
    vs_x = Graphics.width / 2
    vs_y = Graphics.height / 2
    vs = Sprite.new(viewvs)
    vs.bitmap  = RPG::Cache.transition("vs")
    vs.ox      = vs.bitmap.width / 2
    vs.oy      = vs.bitmap.height / 2
    vs.x       = vs_x
    vs.y       = vs_y
    vs.visible = true
    flash = Sprite.new(viewvs)
    flash.bitmap  = RPG::Cache.transition("vsFlash")
    flash.opacity = 0
    # Animate bars sliding in from either side
    pbWait(0.25) do |delta_t|
      bar1.x = lerp(-xoffset, 0, 0.25, delta_t)
      bar2.x = lerp(xoffset, 0, 0.25, delta_t)
    end
    bar1.dispose
    bar2.dispose
    # Make whole screen flash white
    pbSEPlay("Vs flash")
    pbSEPlay("Vs sword")
    flash.opacity = 255
    # Replace bar sprites with AnimatedPlanes, set up trainer sprites
    bar1 = AnimatedPlane.new(viewplayer)
    bar1.bitmap = RPG::Cache.transition(player_bar_graphic)
    bar2 = AnimatedPlane.new(viewopp)
    bar2.bitmap = RPG::Cache.transition(trainer_bar_graphic)
    player = Sprite.new(viewplayer)
    player.bitmap = RPG::Cache.transition(player_graphic)
    player.x      = -xoffset
    partner = Sprite.new(viewplayer)
    partner.bitmap = RPG::Cache.transition(partner_graphic) if partner_graphic
    partner.x = -xoffset - 32
    trainer1 = Sprite.new(viewopp)
    trainer1.bitmap = RPG::Cache.transition(trainer1_graphic) if trainer1_graphic
    trainer1.x      = xoffset+32
    trainer1.tone   = Tone.new(-255, -255, -255)
    trainer = Sprite.new(viewopp)
    trainer.bitmap = RPG::Cache.transition(trainer_graphic)
    trainer.x      = xoffset
    trainer.tone   = Tone.new(-255, -255, -255)
    # Dim the flash and make the trainer sprites appear, while animating bars  
    player_end_x = (partner_graphic.nil?) ? 0 : -32
  trainer_end_x = (trainer1_graphic.nil?) ? 0 : -32
  pbWait(1.2) do |delta_t|
      flash.opacity = lerp(255, 0, 0.25, delta_t)
      bar1.ox = lerp(0, -bar1.bitmap.width * 3, 1.2, delta_t)
      bar2.ox = lerp(0, bar2.bitmap.width * 3, 1.2, delta_t)
      player.x = lerp(-xoffset, player_end_x, 0.25, delta_t - 0.6)
      partner.x = lerp(-xoffset, 64, 0.25, delta_t - 0.6)
      trainer.x = lerp(xoffset, trainer_end_x, 0.25, delta_t - 0.6)
      trainer1.x = lerp(xoffset+64, 64, 0.25, delta_t - 0.6)
    end
    player.x = player_end_x
    player.z = 1
    partner.x = 64
    partner.z = 10
    trainer.x = trainer_end_x
    trainer1.x = 64
    # Make whole screen flash white again
    flash.opacity = 255
    pbSEPlay("Vs sword")
    # Make the Vs logo and trainer names appear, and reset trainer's tone
    vs.visible = true
    trainer.tone = Tone.new(0, 0, 0)
    trainer1.tone = Tone.new(0, 0, 0)
    trainername = foe[0].name
    if foe[1]
      trainername = _INTL("{1} & {2}",foe[0].name,foe[1].name)
    end
    player_name = $player.name
    if $PokemonGlobal.partner
      player_name = _INTL("{1} & {2}",$player.name,$PokemonGlobal.partner[1])
    end
    textpos = [
      [player_name, Graphics.width / 4, (Graphics.height / 1.5) + 16, :center,
       Color.new(248, 248, 248), Color.new(72, 72, 72)],
      [trainername, (Graphics.width / 4) + (Graphics.width / 2), (Graphics.height / 1.5) + 16, :center,
       Color.new(248, 248, 248), Color.new(72, 72, 72)]
    ]
    pbDrawTextPositions(overlay.bitmap, textpos)
    # Fade out flash, shudder Vs logo and expand it, and then fade to black
    shudder_time = 1.75
    zoom_time = 2.5
    pbWait(2.8) do |delta_t|
      if delta_t <= shudder_time
        flash.opacity = lerp(255, 0, 0.25, delta_t)   # Fade out the white flash
      elsif delta_t >= zoom_time
        flash.tone = Tone.new(-255, -255, -255)   # Make the flash black
        flash.opacity = lerp(0, 255, 0.25, delta_t - zoom_time)   # Fade to black
      end
      bar1.ox = lerp(0, -bar1.bitmap.width * 7, 2.8, delta_t)
      bar2.ox = lerp(0, bar2.bitmap.width * 7, 2.8, delta_t)
      if delta_t <= shudder_time
        # +2, -2, -2, +2, repeat
        period = (delta_t / 0.025).to_i % 4
        shudder_delta = [2, 0, -2, 0][period]
        vs.x = vs_x + shudder_delta
        vs.y = vs_y - shudder_delta
      elsif delta_t <= zoom_time
        vs.zoom_x = lerp(1.0, 7.0, zoom_time - shudder_time, delta_t - shudder_time)
        vs.zoom_y = vs.zoom_x
      end
    end
    # End of animation
    player.dispose
    partner.dispose
    trainer.dispose
    trainer1.dispose
    flash.dispose
    vs.dispose
    bar1.dispose
    bar2.dispose
    overlay.dispose
    fade.dispose
    viewvs.dispose
    viewopp.dispose
    viewplayer.dispose
    viewport.color = Color.black   # Ensure screen is black
  })

And there you have it!
This code is also customisable so you can alter the X, Y and Z positions of the sprites it draws and you can turn on and off the VS graphic in your game. All images must be found as a VS sprite to work as any normal VS sprite would. No calling of the script necessary as the script works intuitively with your game to see how many sprites to call for any partners and enemies.

Not designed for any battles above 2v2 as we do not have them in Pokemon Repudiation.​
Credits
TheOnlyFelicity, Vendily, Pokemon Repudiation
Author
FelicityWivi
Views
491
First release
Last update

Ratings

5.00 star(s) 1 ratings

More resources from FelicityWivi

Latest updates

  1. 1.0.1

    Reordered the code for the player & partner graphics so it no longer jumps. Video updated to...

Latest reviews

This is pretty cool, I won't be using this myself as I'm not working on any fan game these days but I'm sure many people will like it. I saw some posts about this in the servers and it really turned out amazing. Great job!
Back
Top