< >
Hello, guest! Please log in or register.

The PokéCommunity

Go Back     The PokéCommunity Forums > Create & Discover > Game Development > Scripts & Tutorials Essentials script One screen Day-Care Checker item

Notices

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.

Reply Post Reply
 
Thread Tools
  #1    
Old April 14th, 2012 (12:01 PM). Edited December 20th, 2015 by FL.
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,579
Code:
#===============================================================================
# * One screen Day-Care Checker item - by FL (Credits will be apreciated)
#===============================================================================
#
# This script is for Pokémon Essentials. It makes a One screen Day-Care Checker
# (like in DPP) activated by item. This display the pokémon sprite, names,
# levels, genders and if them generate an egg.
#
#===============================================================================
#
# To this script works, put it above main, put a 480x320 background in 
# DCCBACKPATH location and, like any item, you need to add in the "items.txt"
# and in the script. There an example below using the name DAYCARESIGHT, but
# you can use any other name changing the DCCITEM and the item that be added in
# txt. You can change the internal number too:
#
# 631,DAYCARESIGHT,DayCare Sight,DayCare Sight,8,0,"A visor that can be use for see certains Pokémon in Day-Care to monitor their growth.",2,0,6
# 
#===============================================================================

DCCITEM=:DAYCARESIGHT # Change this and the item.txt if you wish another name
DCCBACKPATH= "Graphics/Pictures/dccbackground" # You can change if you wish 
# If you wish that the pokémon is positioned like in battle (have the distance
# defined in metadata, even the BattlerAltitude) change the below line to true
DCCBATTLEPOSITION = false

class DayCareCheckerScene  

def startScene
  @sprites={}
  @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  @viewport.z=99999
  @pkmn1=$PokemonGlobal.daycare[0][0]
  @pkmn2=$PokemonGlobal.daycare[1][0]
  # If you wish that if there only one pokémon, it became right 
  # positioned, them uncomment the four below lines
  #if [email protected] && @pkmn2
  #  @[email protected]
  #  @pkmn2=nil
  #end  
  textPositions=[]
  baseColor=Color.new(12*8,12*8,12*8)
  shadowColor=Color.new(26*8,26*8,25*8)
  @sprites["background"]=IconSprite.new(0,0,@viewport)
  @sprites["background"].setBitmap(DCCBACKPATH)
  pokemony=Graphics.height/2-32
  pokemonyadjust=pokemony-32 
  if @pkmn1
    @sprites["pokemon1"]=PokemonSprite.new(@viewport)
    @sprites["pokemon1"].setPokemonBitmap(@pkmn1)
    @sprites["pokemon1"].mirror=true
   pbPositionPokemonSprite(@sprites["pokemon1"],32,pokemony)
    @sprites["pokemon1"].y=pokemonyadjust + adjustBattleSpriteY(
        @sprites["pokemon1"],@pkmn1.species,1) if DCCBATTLEPOSITION
    textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn1.name,@pkmn1.level.to_s,
        genderString(@pkmn1.gender)),32,44,false,baseColor,shadowColor])
  end
  if @pkmn2
    @sprites["pokemon2"]=PokemonSprite.new(@viewport)
    @sprites["pokemon2"].setPokemonBitmap(@pkmn2)
   pbPositionPokemonSprite(@sprites["pokemon2"],Graphics.width-168,pokemony)
    @sprites["pokemon2"].y=pokemonyadjust + adjustBattleSpriteY(
        @sprites["pokemon2"],@pkmn2.species,1) if DCCBATTLEPOSITION
    textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn2.name,@pkmn2.level.to_s,
        genderString(@pkmn2.gender)),Graphics.width-16,44,true,baseColor,
        shadowColor])
  end
  if Kernel.pbEggGenerated?
    @sprites["egg"]=IconSprite.new(Graphics.width/2-68,pokemony+32,@viewport)
    @sprites["egg"].setBitmap("Graphics/Battlers/egg")
    # To works with different egg sprite sizes
    @sprites["egg"].x-=(@sprites["egg"].bitmap.width/8-16)*3
    # Uncomment the below line to only a egg shadow be show
    [email protected]["egg"].color=Color.new(0,0,0,255)    
  end
  @sprites["overlay"]=Sprite.new(@viewport)
  @sprites["overlay"].bitmap=BitmapWrapper.new(Graphics.width,Graphics.height)
  pbSetSystemFont(@sprites["overlay"].bitmap)
  if !textPositions.empty?
    pbDrawTextPositions(@sprites["overlay"].bitmap,textPositions)
  end
  pbFadeInAndShow(@sprites) { update }
end

def genderString(gender)
  ret="  "
  if gender==0
    ret=" ♂"
  elsif gender==1
    ret=" ♀"
  end 
  return ret
end  

def middleScene
  loop do
    Graphics.update
    Input.update
    self.update
    if Input.trigger?(Input::B) || Input.trigger?(Input::C)
      break
    end
  end 
end

def update
  pbUpdateSpriteHash(@sprites)
end

def endScene
  pbFadeOutAndHide(@sprites) { update }
  pbDisposeSpriteHash(@sprites)
  @viewport.dispose
end
end

class DayCareChecker

def initialize(scene)
  @scene=scene
end

def startScreen
  @scene.startScene
  @scene.middleScene
  @scene.endScene
end
end

# Item handlers 

ItemHandlers.addUseFromBag(DCCITEM, proc {|item|
   pbFadeOutIn(99999){ 
     scene=DayCareCheckerScene.new
     screen=DayCareChecker.new(scene)
     screen.startScreen
   }
   next 1 # Continue
})

ItemHandlers.addUseInField(DCCITEM, proc {|item|
   pbFadeOutIn(99999){ 
     scene=DayCareCheckerScene.new
     screen=DayCareChecker.new(scene)
     screen.startScreen
   }
   next 1 # Continue
})
Attached Thumbnails
ddcscreen.png‎   dccbackground.png‎   ddcscreen2.png‎   dccbackground512x384.png‎  
Attached Images
 
Reply With Quote

Relevant Advertising!

  #2    
Old April 15th, 2012 (8:25 AM).
tylerab01's Avatar
tylerab01 tylerab01 is offline
Pokemon AquaHarmony
 
Join Date: Apr 2009
Location: France
Gender: Male
Nature: Bold
Posts: 165
This is gnarly. It is like the PokeTech with the DayCare App, but better!

Reply With Quote
  #3    
Old May 7th, 2012 (6:29 AM).
Abnegation's Avatar
Abnegation Abnegation is offline
ATTACKonTITAN
Platinum Tier
 
Join Date: Apr 2009
Location: Ireland
Posts: 10,774
Seriously, how have I not seen this. Fantastic addition. Certainly a wonderful idea. I'm going to try out the script a little later on, but definitely something well needed. Great work.

abnegation

paired to adventure
there's always something
worth waiting for
Reply With Quote
  #4    
Old May 7th, 2012 (8:03 AM).
SytheXP's Avatar
SytheXP SytheXP is offline
Net Labs/UG Founder
 
Join Date: May 2007
Location: Zombieville South Carolina
Age: 25
Gender: Male
Nature: Calm
Posts: 387
Nice job FL. I briefly skimmed your post, and you said its activated via Item, is there a way to change it to activate it via button? I was and still against having a DS screen but I like the idea of a side screen so I am planning to implement that and this would be a nice additions.
My Threads:
Phantom Dusk Plot and Story: http://www.pokecommunity.com/showthr...23#post4678023


My Sprite Thread:http://www.pokecommunity.com/showthread.php?t=179083

Phantom Dusk is back in production with loads of modifications. Will be updating soon! -2012

I Support:
Reply With Quote
  #5    
Old May 12th, 2012 (11:55 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,579
Quote:
Originally Posted by SytheXP View Post
Nice job FL. I briefly skimmed your post, and you said its activated via Item, is there a way to change it to activate it via button? I was and still against having a DS screen but I like the idea of a side screen so I am planning to implement that and this would be a nice additions.
Yes! In Scene_Map, before 'Scene_Map' add

Code:
   if Input.trigger?(Input::A)
      unless pbMapInterpreterRunning? # Only works if none event command is running
        pbFadeOutIn(99999){ 
          scene=DayCareCheckerScene.new
          screen=DayCareChecker.new(scene)
          screen.startScreen
        }
      end
    end
The 'Input::A' activates when "Z" key is press. You can change it to other key.

You can also change the
Code:
pbFadeOutIn(99999){ 
          scene=DayCareCheckerScene.new
          screen=DayCareChecker.new(scene)
          screen.startScreen
}
to a function/scene if you want to a function/scene be called in game map when some key is pressed.
Reply With Quote
  #6    
Old May 27th, 2012 (5:22 PM).
Gostaras Gostaras is offline
 
Join Date: May 2012
Gender: Male
Posts: 4
It's an awesome script :D

However, when I try to test my game, it says that "Theres no value in line 216 for ItemHandlers"
How could I fix it ?
Reply With Quote
  #7    
Old June 2nd, 2012 (2:26 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,579
Quote:
Originally Posted by Gostaras View Post
It's an awesome script :D

However, when I try to test my game, it says that "Theres no value in line 216 for ItemHandlers"
How could I fix it ?
I remove a extra ',' in '# 631,DAYCARESIGHT' line, maybe is it. Besides this, it is working on newer versions.
Reply With Quote
  #8    
Old June 2nd, 2012 (3:22 PM).
Gostaras Gostaras is offline
 
Join Date: May 2012
Gender: Male
Posts: 4
Quote:
Originally Posted by FL . View Post
I remove a extra ',' in '# 631,DAYCARESIGHT' line, maybe is it. Besides this, it is working on newer versions.
Thanks, It works perfectly now!
Reply With Quote
  #9    
Old June 12th, 2012 (7:27 AM).
p.claydon p.claydon is offline
 
Join Date: Jan 2011
Gender:
Posts: 315
thank you for this managed to get it working as an app for my pokégear
Reply With Quote
  #10    
Old August 4th, 2012 (6:15 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,579
I updated the topic with new script that works in different screens resolutions, plus male/female symbols.

Quote:
Originally Posted by p.claydon View Post
thank you for this managed to get it working as an app for my pokégear
Neat idea!
Reply With Quote
  #11    
Old December 16th, 2015 (12:58 PM).
chrono9665 chrono9665 is offline
 
Join Date: Jul 2015
Gender: Male
Posts: 29
Hi Everyone,

I decided to incorporate this amazing script into my game. I had to make a few adjustments because of the updates since it was written. It seems to be all correct but when I open it in the bag there is no "use" function. So in other words there is no way to actually use the item. The code is below along with the modified Item handles. Any Help would be wonderful. Thank You.

Code:
#===============================================================================
# * One screen Day-Care Checker item - by FL (Credits will be apreciated)
#===============================================================================
#
# This script is for Pokémon Essentials. It makes a One screen Day-Care Checker
# (like in DPP) activated by item. This display the pokémon sprite, names,
# levels, genders and if them generate an egg.
#
#===============================================================================
#
# To this script works, put it above main, put a 480x320 background in 
# DCCBACKPATH location and, like any item, you need to add in the "items.txt"
# and in the script. There an example below using the name DAYCARESIGHT, but
# you can use any other name changing the DCCITEM and the item that be added in
# txt. You can change the internal number too:
#
# 631,DAYCARESIGHT,DayCare Sight,8,0,"A visor that can be use for see certains Pokémon in Day-Care to monitor their growth.",2,0,6
# 
#===============================================================================

DCCITEM=:DAYCARECHECKER # Change this and the item.txt if you wish another name
DCCBACKPATH= "Graphics/Pictures/dccbackground" # You can change if you wish 
# If you wish that the pokémon is positioned like in battle (have the distance
# defined in metadata, even the BattlerAltitude) change the below line to true
DCCBATTLEPOSITION = false

class DayCareCheckerScene  

def startScene
  @sprites={}
  @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  @viewport.z=99999
  @pkmn1=$PokemonGlobal.daycare[0][0]
  @pkmn2=$PokemonGlobal.daycare[1][0]
  # If you wish that if there only one pokémon, it became right 
  # positioned, them uncomment the four below lines
  #if [email protected] && @pkmn2
  #  @[email protected]
  #  @pkmn2=nil
  #end  
  textPositions=[]
  baseColor=Color.new(12*8,12*8,12*8)
  shadowColor=Color.new(26*8,26*8,25*8)
  @sprites["background"]=IconSprite.new(0,0,@viewport)
  @sprites["background"].setBitmap(DCCBACKPATH)
  pokemony=Graphics.height/2-32
  pokemonyadjust=pokemony-32 
  if @pkmn1
    @sprites["pokemon1"]=PokemonSprite.new(@viewport)
    @sprites["pokemon1"].setPokemonBitmap(@pkmn1)
    @sprites["pokemon1"].mirror=true
   pbPositionPokemonSprite(@sprites["pokemon1"],32,pokemony)
    @sprites["pokemon1"].y=pokemonyadjust + adjustBattleSpriteY(
        @sprites["pokemon1"],@pkmn1.species,1) if DCCBATTLEPOSITION
    textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn1.name,@pkmn1.level.to_s,
        genderString(@pkmn1.gender)),32,44,false,baseColor,shadowColor])
  end
  if @pkmn2
    @sprites["pokemon2"]=PokemonSprite.new(@viewport)
    @sprites["pokemon2"].setPokemonBitmap(@pkmn2)
   pbPositionPokemonSprite(@sprites["pokemon2"],Graphics.width-168,pokemony)
    @sprites["pokemon2"].y=pokemonyadjust + adjustBattleSpriteY(
        @sprites["pokemon2"],@pkmn2.species,1) if DCCBATTLEPOSITION
    textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn2.name,@pkmn2.level.to_s,
        genderString(@pkmn2.gender)),Graphics.width-16,44,true,baseColor,
        shadowColor])
  end
  if Kernel.pbEggGenerated?
    @sprites["egg"]=IconSprite.new(Graphics.width/2-68,pokemony+32,@viewport)
    @sprites["egg"].setBitmap("Graphics/Battlers/egg")
    # To works with different egg sprite sizes
    @sprites["egg"].x-=(@sprites["egg"].bitmap.width/8-16)*3
    # Uncomment the below line to only a egg shadow be show
    [email protected]["egg"].color=Color.new(0,0,0,255)    
  end
  @sprites["overlay"]=Sprite.new(@viewport)
  @sprites["overlay"].bitmap=BitmapWrapper.new(Graphics.width,Graphics.height)
  pbSetSystemFont(@sprites["overlay"].bitmap)
  if !textPositions.empty?
    pbDrawTextPositions(@sprites["overlay"].bitmap,textPositions)
  end
  pbFadeInAndShow(@sprites) { update }
end

def genderString(gender)
  ret="  "
  if gender==0
    ret=" ♂"
  elsif gender==1
    ret=" ♀"
  end 
  return ret
end  

def middleScene
  loop do
    Graphics.update
    Input.update
    self.update
    if Input.trigger?(Input::B) || Input.trigger?(Input::C)
      break
    end
  end 
end

def update
  pbUpdateSpriteHash(@sprites)
end

def endScene
  pbFadeOutAndHide(@sprites) { update }
  pbDisposeSpriteHash(@sprites)
  @viewport.dispose
end
end

class DayCareChecker

def initialize(scene)
  @scene=scene
end

def startScreen
  @scene.startScene
  @scene.middleScene
  @scene.endScene
end
end
Item Handles
Code:
ItemHandlers::UseFromBag.add(:DCCITEM, proc {|item|
   pbFadeOutIn(99999){ 
     scene=DayCareCheckerScene.new
     screen=DayCareChecker.new(scene)
     screen.startScreen
   }
   next 1 # Continue
})
Code:
ItemHandlers::UseInField.add(:DCCITEM, proc {|item|
   pbFadeOutIn(99999){ 
     scene=DayCareCheckerScene.new
     screen=DayCareChecker.new(scene)
     screen.startScreen
   }
   next 1 # Continue
})
Reply With Quote
  #12    
Old December 19th, 2015 (4:19 PM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,579
Quote:
Originally Posted by chrono9665 View Post
Hi Everyone,

I decided to incorporate this amazing script into my game. I had to make a few adjustments because of the updates since it was written. It seems to be all correct but when I open it in the bag there is no "use" function. So in other words there is no way to actually use the item. The code is below along with the modified Item handles. Any Help would be wonderful. Thank You.

Code:
#===============================================================================
# * One screen Day-Care Checker item - by FL (Credits will be apreciated)
#===============================================================================
#
# This script is for Pokémon Essentials. It makes a One screen Day-Care Checker
# (like in DPP) activated by item. This display the pokémon sprite, names,
# levels, genders and if them generate an egg.
#
#===============================================================================
#
# To this script works, put it above main, put a 480x320 background in 
# DCCBACKPATH location and, like any item, you need to add in the "items.txt"
# and in the script. There an example below using the name DAYCARESIGHT, but
# you can use any other name changing the DCCITEM and the item that be added in
# txt. You can change the internal number too:
#
# 631,DAYCARESIGHT,DayCare Sight,8,0,"A visor that can be use for see certains Pokémon in Day-Care to monitor their growth.",2,0,6
# 
#===============================================================================

DCCITEM=:DAYCARECHECKER # Change this and the item.txt if you wish another name
DCCBACKPATH= "Graphics/Pictures/dccbackground" # You can change if you wish 
# If you wish that the pokémon is positioned like in battle (have the distance
# defined in metadata, even the BattlerAltitude) change the below line to true
DCCBATTLEPOSITION = false

class DayCareCheckerScene  

def startScene
  @sprites={}
  @viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
  @viewport.z=99999
  @pkmn1=$PokemonGlobal.daycare[0][0]
  @pkmn2=$PokemonGlobal.daycare[1][0]
  # If you wish that if there only one pokémon, it became right 
  # positioned, them uncomment the four below lines
  #if [email protected] && @pkmn2
  #  @[email protected]
  #  @pkmn2=nil
  #end  
  textPositions=[]
  baseColor=Color.new(12*8,12*8,12*8)
  shadowColor=Color.new(26*8,26*8,25*8)
  @sprites["background"]=IconSprite.new(0,0,@viewport)
  @sprites["background"].setBitmap(DCCBACKPATH)
  pokemony=Graphics.height/2-32
  pokemonyadjust=pokemony-32 
  if @pkmn1
    @sprites["pokemon1"]=PokemonSprite.new(@viewport)
    @sprites["pokemon1"].setPokemonBitmap(@pkmn1)
    @sprites["pokemon1"].mirror=true
   pbPositionPokemonSprite(@sprites["pokemon1"],32,pokemony)
    @sprites["pokemon1"].y=pokemonyadjust + adjustBattleSpriteY(
        @sprites["pokemon1"],@pkmn1.species,1) if DCCBATTLEPOSITION
    textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn1.name,@pkmn1.level.to_s,
        genderString(@pkmn1.gender)),32,44,false,baseColor,shadowColor])
  end
  if @pkmn2
    @sprites["pokemon2"]=PokemonSprite.new(@viewport)
    @sprites["pokemon2"].setPokemonBitmap(@pkmn2)
   pbPositionPokemonSprite(@sprites["pokemon2"],Graphics.width-168,pokemony)
    @sprites["pokemon2"].y=pokemonyadjust + adjustBattleSpriteY(
        @sprites["pokemon2"],@pkmn2.species,1) if DCCBATTLEPOSITION
    textPositions.push([_INTL("{1} Lv{2}{3}",@pkmn2.name,@pkmn2.level.to_s,
        genderString(@pkmn2.gender)),Graphics.width-16,44,true,baseColor,
        shadowColor])
  end
  if Kernel.pbEggGenerated?
    @sprites["egg"]=IconSprite.new(Graphics.width/2-68,pokemony+32,@viewport)
    @sprites["egg"].setBitmap("Graphics/Battlers/egg")
    # To works with different egg sprite sizes
    @sprites["egg"].x-=(@sprites["egg"].bitmap.width/8-16)*3
    # Uncomment the below line to only a egg shadow be show
    [email protected]["egg"].color=Color.new(0,0,0,255)    
  end
  @sprites["overlay"]=Sprite.new(@viewport)
  @sprites["overlay"].bitmap=BitmapWrapper.new(Graphics.width,Graphics.height)
  pbSetSystemFont(@sprites["overlay"].bitmap)
  if !textPositions.empty?
    pbDrawTextPositions(@sprites["overlay"].bitmap,textPositions)
  end
  pbFadeInAndShow(@sprites) { update }
end

def genderString(gender)
  ret="  "
  if gender==0
    ret=" ♂"
  elsif gender==1
    ret=" ♀"
  end 
  return ret
end  

def middleScene
  loop do
    Graphics.update
    Input.update
    self.update
    if Input.trigger?(Input::B) || Input.trigger?(Input::C)
      break
    end
  end 
end

def update
  pbUpdateSpriteHash(@sprites)
end

def endScene
  pbFadeOutAndHide(@sprites) { update }
  pbDisposeSpriteHash(@sprites)
  @viewport.dispose
end
end

class DayCareChecker

def initialize(scene)
  @scene=scene
end

def startScreen
  @scene.startScene
  @scene.middleScene
  @scene.endScene
end
end
Item Handles
Code:
ItemHandlers::UseFromBag.add(:DCCITEM, proc {|item|
   pbFadeOutIn(99999){ 
     scene=DayCareCheckerScene.new
     screen=DayCareChecker.new(scene)
     screen.startScreen
   }
   next 1 # Continue
})
Code:
ItemHandlers::UseInField.add(:DCCITEM, proc {|item|
   pbFadeOutIn(99999){ 
     scene=DayCareCheckerScene.new
     screen=DayCareChecker.new(scene)
     screen.startScreen
   }
   next 1 # Continue
})
I tested my script right now on V16 and the only thing that need adjust is item, change '631,DAYCARESIGHT,DayCare Sight,8,0,"A visor that can be use for see certains Pokémon in Day-Care to monitor their growth.",2,0,6' to '631,DAYCARESIGHT,DayCare Sight,DayCare Sight,8,0,"A visor that can be use for see certains Pokémon in Day-Care to monitor their growth.",2,0,6'. I updated this thread.
Reply With Quote
  #13    
Old December 19th, 2015 (11:45 PM).
chrono9665 chrono9665 is offline
 
Join Date: Jul 2015
Gender: Male
Posts: 29
Okay I tried changing back to the orginal script and changing the items.txt. It doesnt work at all. The item handles had to be rejiggered and there is several inconsistencies in the naming. In some places its DDC and in others it DCC. I was able to get it back to the Bag but when you try to us it from the bag there is still no "use" function. so how exactly is this supposed to be activated???
Reply With Quote
  #14    
Old December 20th, 2015 (12:15 AM).
chrono9665 chrono9665 is offline
 
Join Date: Jul 2015
Gender: Male
Posts: 29
Never mind I got it working. I changed DCCITEM in the handles to the actual internal name of the item and it worked.
Reply With Quote
  #15    
Old December 20th, 2015 (11:41 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,579
Quote:
Originally Posted by chrono9665 View Post
and there is several inconsistencies in the naming. In some places its DDC and in others it DCC.
I never noticed this. Fixed.
Reply With Quote
  #16    
Old 4 Weeks Ago (2:13 AM).
monkeyboy6's Avatar
monkeyboy6 monkeyboy6 is offline
 
Join Date: Feb 2013
Gender: Male
Posts: 9
Hey FL. In my game, I have a custom egg sprite that is unique to each Pokemon species. How would I need to change this script to make it so that my custom egg sprite is what shows up as the graphic instead of the default egg sprite?
Reply With Quote
  #17    
Old 4 Weeks Ago (10:15 AM).
FL's Avatar
FL FL is offline
Pokémon Island Creator
 
Join Date: Sep 2010
Gender: Male
Posts: 1,579
Quote:
Originally Posted by monkeyboy6 View Post
Hey FL. In my game, I have a custom egg sprite that is unique to each Pokemon species. How would I need to change this script to make it so that my custom egg sprite is what shows up as the graphic instead of the default egg sprite?
Change line [email protected]["egg"].setBitmap("Graphics/Battlers/egg")' into [email protected]["egg"].setBitmap(getEggBitmap(getBabySpecies))'. Before line 'def genderString(gender)' add:

Code:
def getEggBitmap(species)
  bitmapFileName=sprintf("Graphics/Battlers/%segg",getConstantName(PBSpecies,species)) rescue nil
  bitmapFileName=sprintf("Graphics/Battlers/%03degg",species) if !pbResolveBitmap(bitmapFileName)
  bitmapFileName=sprintf("Graphics/Battlers/egg") if !pbResolveBitmap(bitmapFileName)
  bitmapFileName=pbResolveBitmap(bitmapFileName)
  return bitmapFileName
end

def getBabySpecies
  pokemon0=$PokemonGlobal.daycare[0][0]
  pokemon1=$PokemonGlobal.daycare[1][0]
  mother=nil
  father=nil
  babyspecies=0
  ditto0=pbIsDitto?(pokemon0)
  ditto1=pbIsDitto?(pokemon1)
  if (pokemon0.gender==1 || ditto0)
    babyspecies=(ditto0) ? pokemon1.species : pokemon0.species
    mother=pokemon0
    father=pokemon1
  else
    babyspecies=(ditto1) ? pokemon0.species : pokemon1.species
    mother=pokemon1
    father=pokemon0
  end
  babyspecies=pbGetBabySpecies(babyspecies)
  if isConst?(babyspecies,PBSpecies,:MANAPHY) && hasConst?(PBSpecies,:PHIONE)
    babyspecies=getConst(PBSpecies,:PHIONE)
  end
  if isConst?(babyspecies,PBSpecies,:NIDORANfE) && hasConst?(PBSpecies,:NIDORANmA)
    babyspecies=[getConst(PBSpecies,:NIDORANmA),
                 getConst(PBSpecies,:NIDORANfE)][rand(2)]
  elsif isConst?(babyspecies,PBSpecies,:NIDORANmA) && hasConst?(PBSpecies,:NIDORANfE)
    babyspecies=[getConst(PBSpecies,:NIDORANmA),
                 getConst(PBSpecies,:NIDORANfE)][rand(2)]
  elsif isConst?(babyspecies,PBSpecies,:VOLBEAT) && hasConst?(PBSpecies,:ILLUMISE)
    babyspecies=[getConst(PBSpecies,:VOLBEAT),
                 getConst(PBSpecies,:ILLUMISE)][rand(2)]
  elsif isConst?(babyspecies,PBSpecies,:ILLUMISE) && hasConst?(PBSpecies,:VOLBEAT)
    babyspecies=[getConst(PBSpecies,:VOLBEAT),
                 getConst(PBSpecies,:ILLUMISE)][rand(2)]
  elsif isConst?(babyspecies,PBSpecies,:MUNCHLAX) &&
        !isConst?(mother.item,PBItems,:FULLINCENSE) &&
        !isConst?(father.item,PBItems,:FULLINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:WYNAUT) &&
        !isConst?(mother.item,PBItems,:LAXINCENSE) &&
        !isConst?(father.item,PBItems,:LAXINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:HAPPINY) &&
        !isConst?(mother.item,PBItems,:LUCKINCENSE) &&
        !isConst?(father.item,PBItems,:LUCKINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:MIMEJR) &&
        !isConst?(mother.item,PBItems,:ODDINCENSE) &&
        !isConst?(father.item,PBItems,:ODDINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:CHINGLING) &&
        !isConst?(mother.item,PBItems,:PUREINCENSE) &&
        !isConst?(father.item,PBItems,:PUREINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:BONSLY) &&
        !isConst?(mother.item,PBItems,:ROCKINCENSE) &&
        !isConst?(father.item,PBItems,:ROCKINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:BUDEW) &&
        !isConst?(mother.item,PBItems,:ROSEINCENSE) &&
        !isConst?(father.item,PBItems,:ROSEINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:AZURILL) &&
        !isConst?(mother.item,PBItems,:SEAINCENSE) &&
        !isConst?(father.item,PBItems,:SEAINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  elsif isConst?(babyspecies,PBSpecies,:MANTYKE) &&
        !isConst?(mother.item,PBItems,:WAVEINCENSE) &&
        !isConst?(father.item,PBItems,:WAVEINCENSE)
    babyspecies=pbGetNonIncenseLowestSpecies(babyspecies)
  end
  return babyspecies
end
Reply With Quote
  #18    
Old 4 Weeks Ago (12:56 PM).
monkeyboy6's Avatar
monkeyboy6 monkeyboy6 is offline
 
Join Date: Feb 2013
Gender: Male
Posts: 9
Works perfectly. Thank you.
Reply With Quote
Reply Post Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


  All times are GMT -8. The time now is 3:43 AM.


Contact Us Archive Privacy Statement Terms of Service Top