• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Plug-and-play Delta Pokemon/Alolan Forms script

81
Posts
8
Years
  • Age 22
  • Seen Sep 7, 2019
Ok, here's my fix to make it work just add or edit the links in red! All of this is in PSystem_Utilities The only problem with this fix is that Shadow Pokemon's Icons and sprites won't load thats the only fix everything else from Delta/Alolan icons and so on will load.

1) Search for # Loads Pokémon/item/trainer graphics

After than Search for def pbLoadPokemonBitmapSpecies(pokemon, species, back=false)

then replace it with this pastebin all the way to def pbPokemonFootprintFile(species) BUT DONT REPLACE THE FOOTPRINT Script just everything from the pbLoadPokemonBitmapSpecies and everything between those 2. Dont forget to copy raw of the pastebin: http://pastebin.com/Q4DPb57W
 
824
Posts
8
Years
Ok, here's my fix to make it work just add or edit the links in red! All of this is in PSystem_Utilities The only problem with this fix is that Shadow Pokemon's Icons and sprites won't load thats the only fix everything else from Delta/Alolan icons and so on will load.

1) Search for # Loads Pokémon/item/trainer graphics

After than Search for def pbLoadPokemonBitmapSpecies(pokemon, species, back=false)

then replace it with this pastebin all the way to def pbPokemonFootprintFile(species) BUT DONT REPLACE THE FOOTPRINT Script just everything from the pbLoadPokemonBitmapSpecies and everything between those 2. Dont forget to copy raw of the pastebin: http://pastebin.com/Q4DPb57W

So I'm looking at the code for the EBS and even of vanilla Essentials v16.2 And I'm not seeing either of them mention anything about sorting the Pokemon sprites into separate folders based on shininess and gender. That might be something you yourself added.

The issue I noticed, which does coincide with the error message originally posted (4 arguments in a function designed to take in at most 3), is that the EBS has a way to handle the scale of sprites whereas default Essentials doesn't.

Somehow, though (don't ask me how), you reminded me that I need to add compatibility for the Following Pokemon script.
 
81
Posts
8
Years
  • Age 22
  • Seen Sep 7, 2019
Oh EBS I'm using BW Essentials edited by Klien xD. That's a fix for people who use BW essentials. version 3.1.1
 
824
Posts
8
Years
Oh EBS I'm using BW Essentials edited by Klien xD. That's a fix for people who use BW essentials. version 3.1.1

That's good to know. That's the only thing that makes this incompatible with BW Essentials?

I'll have to figure out how to detect if someone is using BW essentials. Detecting the EBS is as simple as checking if the class DynamicPokemonSprite exists, according to other things Luka's made.

Which leads to my next point: the first post now contains code that makes it compatible with the EBS and Following Pokemon.
 
Last edited:
81
Posts
8
Years
  • Age 22
  • Seen Sep 7, 2019
It works now I re-added you script to my game and as well as the EliteBattle_BitmapWrappers but got another issue It won't load the right image like it would still be the regular pokemon instead of the alolan pokemon when I look at it in battle or Party. but the Icon loads perfectly fine. and the type change and moves work too.
 
81
Posts
8
Years
  • Age 22
  • Seen Sep 7, 2019
Fixed it again by changing the directory from "Graphics/Battlers/%03d%s%s%s%s%s%s" to "Graphics/Battlers#{folder}%03d%s%s%s%s%s%s" for bw essentials
 
824
Posts
8
Years
Spoiler:
 
Last edited:

Zeak6464

Zeak #3205 - Discord
1,101
Posts
11
Years
  • Age 31
  • USA
  • Seen Oct 9, 2023
This script allows players to make Delta Pokemon (as fans have called them for a while) or Alolan Forms (as they are now officially known) without making them unique species or numbered forms.

To use, put this code in a script section above Main, but below PSystem_Utilities. If using the EBS and/or Following Pokemon, place it below those scripts but above Main. If using KleinStudio's BW Essentials kit, paste it in a script section directly above Main.

Code:
#########################################################################
# Delta Pokemon/Alolan Form code
# This is compatible with Essentials v16.2
# Also compatible with Luka's Elite Battle System (EBS),
#     Klien's BW Essentials kit,
#     and mej's Following Pokemon script
# Note that this code adds the Alolan forms as code within the game
# It does not automatically create the Alolan forms as possible
#     encounters.
# You as the game developer need to decide how you want players to
#     encounter the Alolan Pokemon.
#########################################################################
# To use
# 1.) place in a new script section below "PSystem_Utilities" but
#     above "Main"
#  - if using the EBS or Following Pokemon scripts, place below those
#      scripts as well as "PSystem_Utilities"
#  - if using the BW Essentials kit, paste directly above "Main"
# 2.) Decide how you want the player to encounter Delta/Alolan Pokemon
#  - see the bottom of this script for an example that makes Alolan
#      Exeggutor appear on a certain map
#########################################################################

# Battlers

class PokeBattle_Battler
  def isDelta?
    return (@pokemon) ? @pokemon.isDelta? : false
  end
  
  def isAlolan?
    return (@pokemon) ? @pokemon.isDelta? : false
  end
  
  def isAlolaForm?
    return (@pokemon) ? @pokemon.isDelta? : false
  end
end

class PokeBattle_FakeBattler
  def isDelta?; return @pokemon.isDelta?; end
  def isAlolan?; return @pokemon.isDelta?; end
  def isAlolaForm?; return @pokemon.isDelta?; end
end

# Pokemon

class PokeBattle_Pokemon
  attr_accessor(:deltaflag)   # Forces the deltaness (true/false)
  
  def isDelta?
    return @deltaflag if @deltaflag != nil
  end
  
  def isAlolan?
    return @deltaflag if @deltaflag != nil
  end
  
  def isAlolaForm?
    return @deltaflag if @deltaflag != nil
  end
end

##############################################################
# Appearance change
##############################################################
class PokemonSprite < SpriteWrapper
  def setSpeciesBitmap(species,female=false,form=0,shiny=false,shadow=false,back=false,egg=false,delta=false)
    @_iconbitmap.dispose if @_iconbitmap
    @_iconbitmap=species>0 ? pbLoadSpeciesBitmap(species,female,form,shiny,shadow,back,egg,delta) : nil
    self.bitmap=@_iconbitmap ? @_iconbitmap.bitmap : nil
  end
end

class PokemonEggHatchScene
  def pbStartScene(pokemon)
    @sprites={}
    @pokemon=pokemon
    @nicknamed=false
    @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
    @viewport.z=99999
    addBackgroundOrColoredPlane(@sprites,"background","hatchbg",
       Color.new(248,248,248),@viewport)
    @sprites["pokemon"]=PokemonSprite.new(@viewport)
    @sprites["pokemon"].setSpeciesBitmap(@pokemon.species,@pokemon.isFemale?,
                                         (@pokemon.form rescue 0),@pokemon.isShiny?,
                                         false,false,true,(@pokemon.isDelta? rescue false)) # Egg sprite
    @sprites["pokemon"].x=Graphics.width/2-@sprites["pokemon"].bitmap.width/2
    @sprites["pokemon"].y=48+(Graphics.height-@sprites["pokemon"].bitmap.height)/2
    @sprites["hatch"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    @sprites["overlay"].z=200
    @sprites["overlay"].bitmap=Bitmap.new(Graphics.width,Graphics.height)
    @sprites["overlay"].bitmap.fill_rect(0,0,Graphics.width,Graphics.height,
        Color.new(255,255,255))
    @sprites["overlay"].opacity=0
    pbFadeInAndShow(@sprites)
  end
end

def pbLoadPokemonBitmap(pokemon, back=false, scale=nil)
  return pbLoadPokemonBitmapSpecies(pokemon,pokemon.species,back,scale)
end

# Note: Returns an AnimatedBitmap, not a Bitmap
def pbLoadPokemonBitmapSpecies(pokemon, species, back=false, scale=nil)
  ret=nil
  if scale==nil
    scale=1
    scale=POKEMONSPRITESCALE if POKEMONSPRITESCALE != nil
  end
  if pokemon.isEgg?
    bitmapFileName=sprintf("Graphics/Battlers/%segg",getConstantName(PBSpecies,species)) rescue nil
    if !pbResolveBitmap(bitmapFileName)
      bitmapFileName=sprintf("Graphics/Battlers/%03degg",species)
      if !pbResolveBitmap(bitmapFileName)
        bitmapFileName=sprintf("Graphics/Battlers/egg")
      end
    end
    bitmapFileName=pbResolveBitmap(bitmapFileName)
  else
    bitmapFileName=pbCheckPokemonBitmapFiles([species,back,
                                              (pokemon.isFemale?),
                                              pokemon.isShiny?,
                                              (pokemon.form rescue 0),
                                              (pokemon.isShadow? rescue false),
                                              (pokemon.isDelta? rescue false)])
    # Alter bitmap if supported
    alterBitmap=(MultipleForms.getFunction(species,"alterBitmap") rescue nil)
  end
  if bitmapFileName && alterBitmap
    animatedBitmap=AnimatedBitmap.new(bitmapFileName)
    copiedBitmap=animatedBitmap.copy
    animatedBitmap.dispose
    copiedBitmap.each {|bitmap|
       alterBitmap.call(pokemon,bitmap)
    }
    ret=copiedBitmap
    if defined?(DynamicPokemonSprite) # if EBS code exists
      animatedBitmap=AnimatedBitmapWrapper.new(bitmapFileName,scale)
      animatedBitmap.prepareStrip
      for i in 0...animatedBitmap.totalFrames
        alterBitmap.call(pokemon,animatedBitmap.alterBitmap(i))
      end
      animatedBitmap.compileStrip
      ret=animatedBitmap
    end
  elsif bitmapFileName
    ret=AnimatedBitmap.new(bitmapFileName)
    ret=AnimatedBitmapWrapper.new(bitmapFileName,scale) if defined?(DynamicPokemonSprite) # if EBS code exists
  end
  return ret
end

# Note: Returns an AnimatedBitmap, not a Bitmap
def pbLoadSpeciesBitmap(species,female=false,form=0,shiny=false,shadow=false,back=false,egg=false,delta=false)
  ret=nil
  if egg
    bitmapFileName=sprintf("Graphics/Battlers/%segg",getConstantName(PBSpecies,species)) rescue nil
    if !pbResolveBitmap(bitmapFileName)
      bitmapFileName=sprintf("Graphics/Battlers/%03degg",species)
      if !pbResolveBitmap(bitmapFileName)
        bitmapFileName=sprintf("Graphics/Battlers/egg")
      end
    end
    bitmapFileName=pbResolveBitmap(bitmapFileName)
  else
    bitmapFileName=pbCheckPokemonBitmapFiles([species,back,female,shiny,form,shadow,delta])
  end
  if bitmapFileName
    ret=AnimatedBitmap.new(bitmapFileName)
  end
  return ret
end

def pbCheckPokemonBitmapFiles(params)
  species=params[0]
  back=params[1]
  factors=[]
  factors.push([5,params[5],false]) if params[5] && params[5]!=false     # shadow
  factors.push([2,params[2],false]) if params[2] && params[2]!=false     # gender
  factors.push([3,params[3],false]) if params[3] && params[3]!=false     # shiny
  factors.push([4,params[4].to_s,""]) if params[4] && params[4].to_s!="" &&
                                                      params[4].to_s!="0" # form
  factors.push([6,params[6],false]) if params[6] && params[6]!=false     # shiny
  tshadow=false
  tgender=false
  tshiny=false
  tdelta=false
  tform=""
  for i in 0...2**factors.length
    for j in 0...factors.length
      case factors[j][0]
      when 2   # gender
        tgender=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 3   # shiny
        tshiny=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 4   # form
        tform=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 5   # shadow
        tshadow=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 6   # delta
        tdelta=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      end
    end
    folder=""
    if defined?(GetKeyItemScene) # if BW data exists
      folder="Front/"  
      folder="Back/" if back
      folder="FrontShiny/" if tshiny
      folder="BackShiny/" if back && tshiny    
      folder+="Female/" if tgender
    end
    bitmapFileName=sprintf("Graphics/Battlers/%s%s%s%s%s%s%s%s",
       folder,
       getConstantName(PBSpecies,species),
       tgender ? "f" : "",
       tshiny ? "s" : "",
       tdelta ? "d" : "",
       back ? "b" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "") rescue nil
    ret=pbResolveBitmap(bitmapFileName)
    return ret if ret
    bitmapFileName=sprintf("Graphics/Battlers/%s%03d%s%s%s%s%s%s",
       folder, species,
       tgender ? "f" : "",
       tshiny ? "s" : "",
       tdelta ? "d" : "",
       back ? "b" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "")
    ret=pbResolveBitmap(bitmapFileName)
    return ret if ret
  end
  return nil
end

def pbPokemonIconFile(pokemon)
  bitmapFileName=nil
  bitmapFileName=pbCheckPokemonIconFiles([pokemon.species,
                                          (pokemon.isFemale?),
                                          pokemon.isShiny?,
                                          (pokemon.form rescue 0),
                                          (pokemon.isShadow? rescue false),
                                          pokemon.isDelta?],
                                          pokemon.isEgg?)
  return bitmapFileName
end

def pbCheckPokemonIconFiles(params,egg=false)
  species=params[0]
  if egg
    bitmapFileName=sprintf("Graphics/Icons/icon%segg",getConstantName(PBSpecies,species)) rescue nil
    if !pbResolveBitmap(bitmapFileName)
      bitmapFileName=sprintf("Graphics/Icons/icon%03degg",species) 
      if !pbResolveBitmap(bitmapFileName)
        bitmapFileName=sprintf("Graphics/Icons/iconEgg")
      end
    end
    return pbResolveBitmap(bitmapFileName)
  else
    factors=[]
    factors.push([4,params[4],false]) if params[4] && params[4]!=false     # shadow
    factors.push([1,params[1],false]) if params[1] && params[1]!=false     # gender
    factors.push([2,params[2],false]) if params[2] && params[2]!=false     # shiny
    factors.push([5,params[5],false]) if params[5] && params[5]!=false     # delta
    factors.push([3,params[3].to_s,""]) if params[3] && params[3].to_s!="" &&
                                                        params[3].to_s!="0" # form
    tshadow=false
    tgender=false
    tshiny=false
    tdelta=false
    tform=""
    for i in 0...2**factors.length
      for j in 0...factors.length
        case factors[j][0]
        when 1   # gender
          tgender=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
        when 2   # shiny
          tshiny=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
        when 3   # form
          tform=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
        when 4   # shadow
          tshadow=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
        when 5   # delta
          tdelta=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
        end
      end
      bitmapFileName=sprintf("Graphics/Icons/icon%s%s%s%s%s%s",
         getConstantName(PBSpecies,species),
         tgender ? "f" : "",
         tshiny ? "s" : "",
         tdelta ? "d" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "") rescue nil
      ret=pbResolveBitmap(bitmapFileName)
      return ret if ret
      bitmapFileName=sprintf("Graphics/Icons/icon%03d%s%s%s%s%s",
         species,
         tgender ? "f" : "",
         tshiny ? "s" : "",
         tdelta ? "d" : "",
         (tform!="" ? "_"+tform : ""),
         tshadow ? "_shadow" : "")
      ret=pbResolveBitmap(bitmapFileName)
      return ret if ret
    end
  end
  return nil
end

#########################################################################
# Following Pokemon compatibility
#########################################################################
class DependentEvents
  def change_sprite(id, shiny=nil, animation=nil, form=nil, gender=nil, shadow=false, delta=nil)
    events=$PokemonGlobal.dependentEvents
    for i in 0...events.length
      if events[i] && events[i][8]=="Dependent"
        file=FOLLOWER_FILE_DIR+pbCheckPokemonFollowerFiles([id,gender,shiny,delta,form,shadow])
        events[i][6]=file
        @realEvents[i].character_name=file
        if animation
          $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
        end
        $game_variables[Walking_Time_Variable]=0
      end
    end
  end
  
  def refresh_sprite(animation=true)
    if $game_variables[Current_Following_Variable]!=0
      return unless $game_switches[Toggle_Following_Switch]
      return if $PokemonGlobal.bicycle
      if $Trainer.party[0].isShiny?
        shiny=true
      else
        shiny=false
      end
      if defined?($Trainer.party[0].isDelta?)
        delta = $Trainer.party[0].isDelta?
      else
        delta = false
      end
      if $Trainer.party[0].form>0
        form=$Trainer.party[0].form
      else
        form=nil
      end
      if defined?($Trainer.party[0].isShadow?)
        shadow = $Trainer.party[0].isShadow?
      else
        shadow = false
      end
      if $PokemonGlobal.surfing
        if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $Trainer.party[0].hasType?(:WATER) 
          events=$PokemonGlobal.dependentEvents
          if animation
            for i in 0...events.length
              $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
              pbWait(10)
            end
          end
          change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow, delta)
        elsif ALWAYS_ANIMATED_CAN_SURF && ($Trainer.party[0].hasType?(:FLYING) || 
          isConst?($Trainer.party[0].ability,PBAbilities,:LEVITATE) ||
          ALWAYS_ANIMATED_FOLLOWERS.include?($Trainer.party[0].species)) &&
          !(ALWAYS_ANIMATED_EXCEPTION.include?($Trainer.party[0].species)) &&
          $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? 
          events=$PokemonGlobal.dependentEvents
          if animation
            for i in 0...events.length
              $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
              pbWait(10)
            end
          end
          change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow, delta)
        else
          remove_sprite(false)
        end  
      elsif $PokemonGlobal.diving
        if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $Trainer.party[0].hasType?(:WATER) && WATERPOKEMONCANDIVE
          events=$PokemonGlobal.dependentEvents
          if animation
            for i in 0...events.length
              $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
              pbWait(10)
            end
          end
          change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow, delta)
        else
          remove_sprite(false)
        end  
      else
        if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg? && $scene.is_a?(Scene_Map)
          events=$PokemonGlobal.dependentEvents
          if animation
            for i in 0...events.length
              $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
              pbWait(10)
            end
          end
          change_sprite($Trainer.party[0].species, shiny, false, form, $Trainer.party[0].gender, shadow, delta)
        elsif $Trainer.party[0].hp<=0 || $Trainer.party[0].isEgg?
          remove_sprite(animation)
        end
      end
    else
      check_faint
    end
  end
  
  def Come_back(shiny=nil, animation=nil, delta=nil)
    return if !$game_variables[Following_Activated_Switch]
    return if $Trainer.party.length==0
    $PokemonTemp.dependentEvents.pbMoveDependentEvents
    events=$PokemonGlobal.dependentEvents
    if $game_variables[Current_Following_Variable]==$Trainer.party[0]
      remove_sprite(false)
      if $scene.is_a?(Scene_Map)
        for i in 0...events.length 
          $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
        end
      end
    end
    if $Trainer.party[0].hp>0 && !$Trainer.party[0].isEgg?
      $game_variables[Current_Following_Variable]=$Trainer.party[0]
      refresh_sprite(animation)
    end
    for i in 0...events.length 
      if events[i] && events[i][8]=="Dependent"
        file=FOLLOWER_FILE_DIR+pbCheckPokemonFollowerFiles([id,gender,shiny,delta,form,shadow])
        events[i][6]=file
        @realEvents[i].character_name=file
        if animation
          $scene.spriteset.addUserAnimation(Animation_Come_Out,@realEvents[i].x,@realEvents[i].y)
        end
      end 
    end 
  end
end

# this is an entirely new function, not found in the official release of Following Pokemon
# it searches for Follower sprites the same way base Essentials searches for battlers and icons
# rather than a series of "if-than" events
def pbCheckPokemonFollowerFiles(params)
  species=params[0]
  factors=[]
  factors.push([1,params[1],false]) if params[1] && params[1]!=false     # gender
  factors.push([2,params[2],false]) if params[2] && params[2]!=false     # shiny
  factors.push([3,params[3],false]) if params[3] && params[3]!=false     # delta
  factors.push([4,params[4].to_s,""]) if params[4] && params[4].to_s!="" # form
  factors.push([5,params[5],false]) if params[5] && params[5]!=false     # shadow
  tshadow=false
  tgender=false
  tshiny=false
  tdelta=false
  tform=""
  for i in 0...2**factors.length
    for j in 0...factors.length
      case factors[j][0]
      when 1   # gender
        tgender=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 2   # shiny
        tshiny=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 3   # delta
        tdelta=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 4   # form
        tform=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      when 5   # shadow
        tshadow=((i/(2**j))%2==0) ? factors[j][1] : factors[j][2]
      end
    end
    bitmapFileName=sprintf("%s%s%s%s%s%s",
       getConstantName(PBSpecies,species),
       tgender ? "f" : "",
       tshiny ? "s" : "",
       tdelta ? "d" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "") rescue nil
    ret=pbResolveBitmap(sprintf("%s%s%s",FOLLOWER_FILE_PATH,FOLLOWER_FILE_DIR,bitmapFileName))
    return bitmapFileName if ret
    bitmapFileName=sprintf("%03d%s%s%s%s%s",
       species,
       tgender ? "f" : "",
       tshiny ? "s" : "",
       tdelta ? "d" : "",
       (tform!="" ? "_"+tform : ""),
       tshadow ? "_shadow" : "")
    ret=pbResolveBitmap(sprintf("%s%s%s",FOLLOWER_FILE_PATH,FOLLOWER_FILE_DIR,bitmapFileName))
    return bitmapFileName if ret
  end
end

##############################################################
# Hybrid AnimatedBitmapWrapper class to encompass both the
#     EBS version's inputs and the BW version's ones
##############################################################
class AnimatedBitmapWrapper
  attr_reader :width
  attr_reader :height
  attr_reader :totalFrames
  attr_reader :animationFrames
  attr_reader :currentIndex
  attr_accessor :scale
  
  def initialize(file,twoframe_scale=2)
    raise "filename is nil" if file==nil
    if scale.is_a?(Numeric) # EBS version
      @scale = twoframe_scale
      @twoframe = false
    elsif !!scale == scale # BW version
      @scale = 2
      @twoframe = twoframe_scale
    end
    @width = 0
    @height = 0
    @frame = 0
    @frames = 2
    @direction = +1
    @animationFinish = false
    @totalFrames = 0
    @currentIndex = 0
    @speed = 1
      # 0 - not moving at all
      # 1 - normal speed
      # 2 - medium speed
      # 3 - slow speed
    bmp = BitmapCache.load_bitmap(file)
    #bmp = Bitmap.new(file)
    @bitmapFile=Bitmap.new(bmp.width,bmp.height); @bitmapFile.blt(0,0,bmp,Rect.new(0,0,bmp.width,bmp.height))
    # initializes full Pokemon bitmap
    @bitmap=Bitmap.new(@bitmapFile.width,@bitmapFile.height)
    @bitmap.blt(0,0,@bitmapFile,Rect.new(0,0,@bitmapFile.width,@bitmapFile.height))
    @[email protected]*@scale
    @[email protected]*@scale
    
    @[email protected]/@bitmap.height
    @animationFrames=@totalFrames*@frames
    # calculates total number of frames
    @loop_points=[0,@totalFrames]
    # first value is start, second is end
    
    @actualBitmap=Bitmap.new(@width,@height)
    @actualBitmap.clear
    @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))
  end
  alias initialize_elite initialize
    
  def length; @totalFrames; end
  def disposed?; @actualBitmap.disposed?; end
  def dispose; @actualBitmap.dispose; end
  def copy; @actualBitmap.clone; end
  def bitmap; @actualBitmap; end
  def bitmap=(val); @actualBitmap=val; end
  def each; end
  def alterBitmap(index); return @strip[index]; end
    
  def prepareStrip
    @strip=[]
    for i in 0...@totalFrames
      bitmap=Bitmap.new(@width,@height)
      bitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmapFile,Rect.new((@width/@scale)*i,0,@width/@scale,@height/@scale))
      @strip.push(bitmap)
    end
  end
  def compileStrip
    @bitmap.clear
    for i in [email protected]
      @bitmap.stretch_blt(Rect.new((@width/@scale)*i,0,@width/@scale,@height/@scale),@strip[i],Rect.new(0,0,@width,@height))
    end
  end
  
  def reverse
    if @direction  >  0
      @direction=-1
    elsif @direction < 0
      @direction=+1
    end
  end
  
  def setLoop(start, finish)
    @loop_points=[start,finish]
  end
  
  def setSpeed(value)
    @speed=value
  end
  
  def toFrame(frame)
    if frame.is_a?(String)
      if frame=="last"
        frame=@totalFrames-1
      else
        frame=0
      end
    end
    frame=@totalFrames if frame > @totalFrames
    frame=0 if frame < 0
    @currentIndex=frame
    @actualBitmap.clear
    @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))
  end
  
  def play
    return if @currentIndex >= @loop_points[1]-1
    self.update
  end
  
  def finished?
    return (@currentIndex==@totalFrames-1)
  end
  
  def update
    return false if @actualBitmap.disposed?
    return false if @speed < 1
    case @speed
    # frame skip
    when 1
      @frames=2
    when 2
      @frames=4
    when 3
      @frames=5
    end
    @frame+=1
    
    if @frame >=@frames
      # processes animation speed
      @currentIndex+=@direction
      @currentIndex=@loop_points[0] if @currentIndex >=@loop_points[1]
      @currentIndex=@loop_points[1]-1 if @currentIndex < @loop_points[0]
      @frame=0
    end
    @actualBitmap.clear
    @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))
    # updates the actual bitmap
  end
  alias update_elite update
    
  # returns bitmap to original state
  def deanimate
    @frame=0
    @currentIndex=0
    @actualBitmap.clear
    @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))
  end
end

##############################################################
# Alolan Form differences
##############################################################

MultipleForms.register(:RAICHU,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:PSYCHIC) if pokemon.isDelta?
   next
},
"height"=>proc{|pokemon|
   next 0.7 if pokemon.isDelta?
   next
},
"weight"=>proc{|pokemon|
   next 21.0 if pokemon.isDelta?
   next
},
"getAbilityList"=>proc{|pokemon|
   if pokemon.isDelta?
     next [[getID(PBAbilities,:SURGESURFER),0],
	         [getID(PBAbilities,:SURGESURFER),2]]
   end
   next
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

MultipleForms.register(:MEOWTH,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type1"=>proc{|pokemon|
   next getID(PBTypes,:DARK) if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:DARK) if pokemon.isDelta?
   next
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

MultipleForms.register(:MAROWAK,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type1"=>proc{|pokemon|
   next getID(PBTypes,:FIRE) if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:GHOST) if pokemon.isDelta?
   next
},
"weight"=>proc{|pokemon|
   next 34.0 if pokemon.isDelta?
   next
},
"getAbilityList"=>proc{|pokemon|
   if pokemon.isDelta?
     next [[getID(PBAbilities,:CURSEDBODY),0],
	         [getID(PBAbilities,:LIGHTNINGROD),1]]
   end
   next
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

MultipleForms.register(:VULPIX,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type1"=>proc{|pokemon|
   next getID(PBTypes,:ICE) if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:ICE) if pokemon.isDelta?
   next
},
"getMoveList"=>proc{|pokemon|
   next if !pokemon.isDelta?
   movelist=[]
   if pokemon.isDelta?
     movelist=[[1,:POWDERSNOW],[4,:TAILWHIP],[7,:ROAR],[9,:BABYDOLLEYES],
	           [10,:QUICKATTACK],[12,:CONFUSERAY],[15,:BLIZZARD],
			   [18,:PAYBACK],[20,:ICEPUNCH],[23,:FEINTATTACK],[26,:HEX],
			   [28,:ICEBEAM],[31,:EXTRASENSORY],[34,:SAFEGUARD],
			   [36,:FROSTBREATH],[39,:IMPRISON],[44,:GRUDGE],[47,:CAPTIVATE]]
   end
   for i in movelist
     i[1]=getConst(PBMoves,i[1])
   end
   next movelist
},
"getAbilityList"=>proc{|pokemon|
   if pokemon.isDelta?
     next [[getID(PBAbilities,:SNOWCLOAK),0],
	       [getID(PBAbilities,:SNOWCLOAK),2]]
   end
   next
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

MultipleForms.register(:NINETAILS,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type1"=>proc{|pokemon|
   next getID(PBTypes,:ICE) if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:FAIRY) if pokemon.isDelta?
   next
},
"getMoveList"=>proc{|pokemon|
   next if pokemon.form==0
   movelist=[]
   if pokemon.isDelta?
     movelist=[[1,:IMPRISON],[1,:NASTYPLOT],[1,:ICEBEAM],[1,:QUICKATTACK],
	           [1,:CONFUSERAY],[1,:SAFEGUARD]]
   end
   for i in movelist
     i[1]=getConst(PBMoves,i[1])
   end
   next movelist
},
"getAbilityList"=>proc{|pokemon|
   if pokemon.isDelta?
     next [[getID(PBAbilities,:SNOWCLOAK),0],
	       [getID(PBAbilities,:SNOWCLOAK),2]]
   end
   next
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

MultipleForms.register(:SANDSHREW,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type1"=>proc{|pokemon|
   next getID(PBTypes,:ICE) if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:STEEL) if pokemon.isDelta?
   next
},
"height"=>proc{|pokemon|
   next 0.6 if pokemon.isDelta?
   next
},
"weight"=>proc{|pokemon|
   next 40.0 if pokemon.isDelta?
   next
},
"getMoveList"=>proc{|pokemon|
   next if pokemon.form==0
   movelist=[]
   if pokemon.isDelta?
     movelist=[[1,:SCRATCH],[1,:DEFENSECURL],[3,:HAIL],[5,:ICEPUNCH],
	           [7,:ROLLOUT],[9,:RAPIDSPIN],[11,:CUT],[14,:SHEERCOLD],
			   [17,:SWIFT],[20,:FURYSWIPES],[23,:HAIL],[26,:SLASH],
			   [30,:DIG],[34,:GYROBALL],[38,:SWORDSDANCE],[42,:HAIL],]
   end
   for i in movelist
     i[1]=getConst(PBMoves,i[1])
   end
   next movelist
},
"getAbilityList"=>proc{|pokemon|
   if pokemon.isDelta?
     next [[getID(PBAbilities,:SNOWCLOAK),0],
	       [getID(PBAbilities,:SNOWCLOAK),2]]
   end
   next
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

MultipleForms.register(:SANDSLASH,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type1"=>proc{|pokemon|
   next getID(PBTypes,:ICE) if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:STEEL) if pokemon.isDelta?
   next
},
"height"=>proc{|pokemon|
   next 1.2 if pokemon.isDelta?
   next
},
"weight"=>proc{|pokemon|
   next 55.0 if pokemon.isDelta?
   next
},
"getMoveList"=>proc{|pokemon|
   next if pokemon.form==0
   movelist=[]
   if pokemon.isDelta?
     movelist=[[1,:SCRATCH],[1,:DEFENSECURL],[3,:HAIL],[5,:ICEPUNCH],
	           [7,:ROLLOUT],[9,:RAPIDSPIN],[11,:CUT],[14,:SHEERCOLD],
			   [17,:SWIFT],[20,:FURYSWIPES],[23,:HAIL],[26,:SLASH],
			   [30,:DIG],[34,:GYROBALL],[38,:SWORDSDANCE],[42,:HAIL],]
   end
   for i in movelist
     i[1]=getConst(PBMoves,i[1])
   end
   next movelist
},
"getAbilityList"=>proc{|pokemon|
   if pokemon.isDelta?
     next [[getID(PBAbilities,:SNOWCLOAK),0],
	       [getID(PBAbilities,:SNOWCLOAK),2]]
   end
   next
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

MultipleForms.register(:EXEGGUTOR,{
"getFormName"=>proc{|pokemon|
   next _INTL("Alola Form") if pokemon.isDelta?
   next
},
"type2"=>proc{|pokemon|
   next getID(PBTypes,:DRAGON) if pokemon.isDelta?
   next
},
"height"=>proc{|pokemon|
   next 10.9 if pokemon.isDelta?
   next
},
"weight"=>proc{|pokemon|
   next 415.6 if pokemon.isDelta?
   next
},
"getAbilityList"=>proc{|pokemon|
   if pokemon.isDelta?
     next [[getID(PBAbilities,:FRISK),0],
	       [getID(PBAbilities,:FRISK),2]]
   end
   next
},
"getMoveList"=>proc{|pokemon|
   next if pokemon.form==0
   movelist=[]
   if pokemon.isDelta?
     movelist=[[1,:SEEDBOMB],[1,:BARRAGE],[1,:HYPNOSIS],[1,:CONFUSION],
	           [1,:STOMP],[17,:PSYSHOCK],[27,:EGGBOMB],[37,:WOODHAMMER],
			   [47,:LEAFSTORM]]
   end
   for i in movelist
     i[1]=getConst(PBMoves,i[1])
   end
   next movelist
},
"onSetForm"=>proc{|pokemon,form|
   pbSeenForm(pokemon)
}
})

###################################################################
# EXAMPLE ENCOUNTER MODIFIER
# "pokemon.deltaflag=true" is how to make the Pokemon a Delta/Alolan
###################################################################
# Events.onWildPokemonCreate+=proc {|sender,e|
#    pokemon=e[0]
#    if $game_map.map_id==51 && isConst?(pokemon.species,PBSpecies,:EXEGGUTOR)
#      pokemon.deltaflag=true
#    end
# }

In order to make a sprite for an Alolan Pokemon, name the sprite "###d.png", where the ### is replaced with the National Pokedex number of the species. For example, Alolan Ninetails's sprite would be named "038d.png". This can be combined with the existing modifiers - "###sd.png" for a Shiny Alolan Pokemon, "###db.png" for the backsprite of an Alolan Pokemon, "##fd.png" for a female Alolan Pokemon, "###d_1.png" for the (numbered) alternate form of an Alolan Pokemon, etc. (In order to do the backsprite for a female Shiny Alolan Pokemon in a numbered alternate form, the proper syntax is "###fsdb_1.png")

The movesets listed here are temporary movesets crated by changing old STAB to new STAB. They are by no means the final movesets. Otherwise, this is everything we know about Alola Forms.

This script breaks "Title Screen" if title screen is set to 5
 

Zeak6464

Zeak #3205 - Discord
1,101
Posts
11
Years
  • Age 31
  • USA
  • Seen Oct 9, 2023
Can you please explain farther, Zeak? What's the error you get?

ea7ac154197d4b4f9ecfd6e27e0c2528.png


22f12f9cddc748729da6b0d001331f8a.png
 
Last edited:
824
Posts
8
Years
Okay, it looks like both those errors are being caused by "ghost Pokemon". I do remember having to edit my version of the Gen V title screen to allow for Delta Pokemon.

Looking at the title screen resource that exists now, I'm wondering if it has to do with the spoofForm function. Otherwise, any possible errors are beyond me.



EDIT: Okay, I've got a possible fix for the error with the Title Screen. Unfortunately, the problem having to do with the Starter Selection thing seems to be something that can only be fixed on their end - by generating the Pokemon before the sprites and then rendering the Pokemon's appearance, rather than searching for the sprite directly.
 
Last edited:
15
Posts
8
Years
  • Age 22
  • Seen Apr 11, 2024
Just so you know, Delta Species weren't invented by the fans. They were introduced in the TCG. I am SICK and TIRED of this misconception.

Otherwise, nice work. Just don't get too ahead of yourself in implementing the official Alolan Forms, we already know that at least Sandslash and Sandshrew have different stats and we don't fully know their movepools.
 
824
Posts
8
Years
Just so you know, Delta Species weren't invented by the fans. They were introduced in the TCG. I am SICK and TIRED of this misconception.

When did I say that Deltas were invented by the fans? I said that we've been calling them Deltas, but now they're officially called Alolan Forms.

I'm aware that they originated in the TCG. The lore of the particular pack they were introduced in, is the reason that Insurgence - the game that sort of popularized the concept of Deltas - calls the portion of their website about Deltas the Honlon Dex.

Otherwise, nice work. Just don't get too ahead of yourself in implementing the official Alolan Forms, we already know that at least Sandslash and Sandshrew have different stats and we don't fully know their movepools.

I've been updating this every time we learn new information about the Alolan Forms. That said, we don't technically know Snowshrew and Snowslash have different stats from Sandshrew and Sandslash. The website mentions that they move slower than their non-Alolan counterparts, but that could just be flavor text. Until we see the official base stats, we can't say for sure if that'll be reflected in their actual battle prowess.

However, if we do learn that the base stats are different, I can add that capability fairly easily, since the MultipleForms code already allows for that.
 
25
Posts
7
Years
  • Age 29
  • Seen Sep 3, 2022
is there a way to set a different y altitude for the delta sprite?
 
81
Posts
8
Years
  • Age 22
  • Seen Sep 7, 2019
The abilities won't change for the delta Pokemon. I don't know again if this is because of BW essentials but, that's my guess with the issue.
 
824
Posts
8
Years
The abilities won't change for the delta Pokemon. I don't know again if this is because of BW essentials but, that's my guess with the issue.

Probably because the BW kit is based on v15 or lower, and the getAbilityList function of multiple forms was added in version 16.

Try adding this somewhere above the Alolan Forms script:

Code:
class PokeBattle_Pokemon
  alias __mf_getAbilityList getAbilityList
  def getAbilityList
    v=MultipleForms.call("getAbilityList",self)
    return v if v!=nil && v.length>0
    return self.__mf_getAbilityList
  end
end
 
Back
Top