Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Custom Evolution Scene

Hello everyone I am creating a game where an evolution process occurs every few levels. Normally I wouldn't have a problem figuring this out, but I am using Legacy's Custom Menu. So...

I need help writing a script that, after a battle where a character levels up to a certain level, he or she will evolve. No problem right? Well I want it to be animated. Actually I want the status screen to come up and then their picture to fade out and then the new pic fade in, then I want the graphic and stats to change two, but kinda slowly so the user can see them change better. Please if you are a scripter and think I am bonkers becasue I don't know how to explain iut then I will try my best to go further into detail. Also I searched the formus with no avail on finding what I want.

Thanks to all in advance.
 
Do you mean something like in the Pokemon games?  I can't help you with scripting but I can help you look for it though (since I am still trying to learn how to script myself).  If it is similar with Pokemon, have you tried looking at Pokemon Starter Kits? They may have one...
 
That is almost exactly what I want except I cannot download that 10MB file because I am overseas. I am in the US Navy and don't have the bandwidth to download the whole file. If there is a way that someone could extract the Evolution script from there I would be extremely greatful.

Now for the difference between the Poke'Evolution and mine.

1st: I want the status screen to come up with all the stats of the previous character, then to evolve that character and show the stats changing while the status screen is still up.

2nd: I would also like to have a common event that can call this script so when the conditions are met the character will evlove except in a battle sequence of course.

I haven't worked on RMXP for a while so my RGSS is pretty sloppy, and I wasn't really good at it before that anyway. XD

Sakura: Thanks for the reply and maybe if I figure it out we can start learning some scripting together. Or if you ever need help scowering the net for a script.
 
I have that pokemon script, but it might be harder to implement (I just copied it out of a project I had sitting around accumulating dust...sorta). It came from some Pokemon Starter Kit that is less than half a megabyte (I think I found it here as well)...If you can't find that starter kit here then I will post a link on where to download it provided I get permission to do so.
 
Twin Matrix":6ov0col5 said:
^

Or you have the illegal version of RMXP and can't get the demo opened? :P

I don't have a cracked version, if that's what you mean. I bought my copy a year ago when I was in the US. I'll be able to download it when I get back home though. If I can just get some help writing the code then that would be awesome too.

@Sakura Thanks. I found it it's just too big.
 
Oh well, I don't know if this is still around here but this it the Pokemon Evolution script that I was talking about.
Code:
begin
class SpriteMetafile < Sprite
 VIEWPORT=0
 TONE=1
 SRC_RECT=2
 VISIBLE=3
 X=4
 Y=5
 Z=6
 OX=7
 OY=8
 ZOOM_X=9
 ZOOM_Y=10
 ANGLE=11
 MIRROR=12
 BUSH_DEPTH=13
 OPACITY=14
 BLEND_TYPE=15
 COLOR=16
 FLASHCOLOR=17
 FLASHDURATION=18
 BITMAP=19
 def length
  return @metafile.length
 end
 def [](i)
  return @metafile[i]
 end
 def initialize(viewport=nil)
  @metafile=[]
  @values=[
    viewport,
    Tone.new(0,0,0,0),
    Rect.new(0,0,0,0),
    true,
    0,0,0,0,0,100,100,
    0,false,0,255,0,
    Color.new(0,0,0,0),
    Color.new(0,0,0,0),
    0
  ]
  @clonedValues=cloneValues
 end
 def disposed?
  return false
 end
 def dispose
 end
 def flash(color,duration)
  if duration>0
   @values[FLASHCOLOR]=color.clone
   @values[FLASHDURATION]=duration
  end
 end
 def x
  return @values[X]
 end
 def x=(value)
  @values[X]=value
 end
 def y
  return @values[Y]
 end
 def y=(value)
  @values[Y]=value
 end
 def bitmap
  return nil
 end
 def bitmap=(value)
  if value && !value.disposed?
   @values[SRC_RECT].set(0,0,value.width,value.height)
  end
 end
 def src_rect
  return @values[SRC_RECT]
 end
 def src_rect=(value)
  @values[SRC_RECT]=value
 end
 def visible
  return @values[VISIBLE]
 end
 def visible=(value)
  @values[VISIBLE]=value
 end
 def z
  return @values[Z]
 end
 def z=(value)
  @values[Z]=value
 end
 def ox
  return @values[OX]
 end
 def ox=(value)
  @values[OX]=value
 end
 def oy
  return @values[OY]
 end
 def oy=(value)
  @values[OY]=value
 end
 def zoom_x
  return @values[ZOOM_X]
 end
 def zoom_x=(value)
  @values[ZOOM_X]=value
 end
 def zoom_y
  return @values[ZOOM_Y]
 end
 def zoom_y=(value)
  @values[ZOOM_Y]=value
 end
 def angle
  return @values[ANGLE]
 end
 def angle=(value)
  @values[ANGLE]=value
 end
 def mirror
  return @values[MIRROR]
 end
 def mirror=(value)
  @values[MIRROR]=value
 end
 def bush_depth
  return @values[BUSH_DEPTH]
 end
 def bush_depth=(value)
  @values[BUSH_DEPTH]=value
 end
 def opacity
  return @values[OPACITY]
 end
 def opacity=(value)
  @values[OPACITY]=value
 end
 def blend_type
  return @values[BLEND_TYPE]
 end
 def blend_type=(value)
  @values[BLEND_TYPE]=value
 end
 def color
  return @values[COLOR]
 end
 def color=(value)
  @values[COLOR]=value.clone
 end
 def tone
  return @values[TONE]
 end
 def tone=(value)
  @values[TONE]=value.clone
 end
 def cloneValues
  vals=[]
  for i in 0...@values.length
   begin
    vals[i]=@values[i].clone
   rescue TypeError
    vals[i]=@values[i]
   end
  end
  return vals
 end
 def update
  for i in 0...@values.length
   if @values[i]!=@clonedValues[i]
    @metafile.push([i,@values[i]])
   end
  end
  @metafile.push([-1,nil])
  @clonedValues=cloneValues
 end
end

class SpriteMetafilePlayer
 def initialize(metafile,sprite=nil)
  @metafile=metafile
  @sprites=[]
  @playing=false
  @index=0
  @sprites.push(sprite) if sprite
 end
 def add(sprite)
  @sprites.push(sprite)
 end
 def playing?
  return @playing
 end
 def play
  @playing=true
  @index=0
 end
 def update
  if @playing
   for j in @index...@metafile.length
    @index=j+1
    break if @metafile[j][0]<0
    code=@metafile[j][0]
    value=@metafile[j][1]
    for sprite in @sprites
     sprite.x=value if code==SpriteMetafile::X
     sprite.y=value if code==SpriteMetafile::Y
     sprite.src_rect=value if code==SpriteMetafile::SRC_RECT
     sprite.visible=value if code==SpriteMetafile::VISIBLE
     sprite.z=value if code==SpriteMetafile::Z
     sprite.ox=value if code==SpriteMetafile::OX
     sprite.oy=value if code==SpriteMetafile::OY
     sprite.zoom_x=value if code==SpriteMetafile::ZOOM_X
     sprite.zoom_y=value if code==SpriteMetafile::ZOOM_Y
     sprite.angle=value if code==SpriteMetafile::ANGLE
     sprite.mirror=value if code==SpriteMetafile::MIRROR
     sprite.bush_depth=value if code==SpriteMetafile::BUSH_DEPTH
     sprite.opacity=value if code==SpriteMetafile::OPACITY
     sprite.blend_type=value if code==SpriteMetafile::BLEND_TYPE
     sprite.color=value if code==SpriteMetafile::COLOR
     sprite.tone=value if code==SpriteMetafile::TONE
    end
   end
   @playing=false if @index==@metafile.length
  end
 end
end

def pbSaveSpriteState(sprite)
 state=[]
 return state if !sprite||sprite.disposed?
 state[SpriteMetafile::BITMAP]=sprite.x
 state[SpriteMetafile::X]=sprite.x
 state[SpriteMetafile::Y]=sprite.y
 state[SpriteMetafile::SRC_RECT]=sprite.src_rect.clone
 state[SpriteMetafile::VISIBLE]=sprite.visible
 state[SpriteMetafile::Z]=sprite.z
 state[SpriteMetafile::OX]=sprite.ox
 state[SpriteMetafile::OY]=sprite.oy
 state[SpriteMetafile::ZOOM_X]=sprite.zoom_x
 state[SpriteMetafile::ZOOM_Y]=sprite.zoom_y
 state[SpriteMetafile::ANGLE]=sprite.angle
 state[SpriteMetafile::MIRROR]=sprite.mirror
 state[SpriteMetafile::BUSH_DEPTH]=sprite.bush_depth
 state[SpriteMetafile::OPACITY]=sprite.opacity
 state[SpriteMetafile::BLEND_TYPE]=sprite.blend_type
 state[SpriteMetafile::COLOR]=sprite.color.clone
 state[SpriteMetafile::TONE]=sprite.tone.clone
 return state
end

def pbRestoreSpriteState(sprite,state)
 return if !state||!sprite||sprite.disposed?
 sprite.x=state[SpriteMetafile::X]
 sprite.y=state[SpriteMetafile::Y]
 sprite.src_rect=state[SpriteMetafile::SRC_RECT]
 sprite.visible=state[SpriteMetafile::VISIBLE]
 sprite.z=state[SpriteMetafile::Z]
 sprite.ox=state[SpriteMetafile::OX]
 sprite.oy=state[SpriteMetafile::OY]
 sprite.zoom_x=state[SpriteMetafile::ZOOM_X]
 sprite.zoom_y=state[SpriteMetafile::ZOOM_Y]
 sprite.angle=state[SpriteMetafile::ANGLE]
 sprite.mirror=state[SpriteMetafile::MIRROR]
 sprite.bush_depth=state[SpriteMetafile::BUSH_DEPTH]
 sprite.opacity=state[SpriteMetafile::OPACITY]
 sprite.blend_type=state[SpriteMetafile::BLEND_TYPE]
 sprite.color=state[SpriteMetafile::COLOR]
 sprite.tone=state[SpriteMetafile::TONE]
end

def pbSaveSpriteStateAndBitmap(sprite)
 return [] if !sprite||sprite.disposed?
 state=pbSaveSpriteState(sprite)
 state[SpriteMetafile::BITMAP]=sprite.bitmap
 return state
end
def pbRestoreSpriteStateAndBitmap(sprite,state)
 return if !state||!sprite||sprite.disposed?
 sprite.bitmap=state[SpriteMetafile::BITMAP]
 pbRestoreSpriteState(sprite,state)
 return state
end

#####################

class PokemonEvolutionScene

def pbGenerateMetafiles
sprite=SpriteMetafile.new
sprite2=SpriteMetafile.new
sprite.opacity=255
sprite2.opacity=0
sprite.ox=64
sprite.oy=64
sprite2.ox=64
sprite2.oy=64
for j in 0...26
 sprite.color.red=100
 sprite.color.green=0 
 sprite.color.blue=0
 sprite.color.alpha=j*10
 sprite.color=sprite.color
 sprite2.color=sprite.color
 sprite.update
 sprite2.update
end
anglechange=0
sevenseconds=40*7
for j in 0...sevenseconds
 sprite.angle+=anglechange
 sprite.angle%=360
 anglechange+=1 if j%2==0
 if j>=sevenseconds-10
  sprite2.angle=sprite.angle
  sprite2.opacity+=26
 end
 sprite.update
 sprite2.update
end
sprite.angle=360-sprite.angle
sprite2.angle=360-sprite2.angle
for j in 0...sevenseconds
 sprite2.angle+=anglechange
 sprite2.angle%=360
 anglechange-=1 if j%2==0
 if j<10
  sprite.angle=sprite2.angle
  sprite.opacity-=26
 end
 sprite.update
 sprite2.update
end
for j in 0...26
 sprite2.color.red=100
 sprite2.color.green=0 
 sprite2.color.blue=0
 sprite2.color.alpha=(26-j)*10
 sprite2.color=sprite2.color
 sprite.color=sprite2.color
 sprite.update
 sprite2.update
end
@metafile1=sprite
@metafile2=sprite2
end

def pbStartScreen(pokemon,newspecies)
 @sprites={}
 @viewport=Viewport.new(0,0,480,320)
 @viewport.z=99999
 @pokemon=pokemon
 @newspecies=newspecies
 @sprites["background"]=ColoredPlane.new(Color.new(248,248,248),@viewport)
 rsprite1=Sprite.new(@viewport)
 rsprite2=Sprite.new(@viewport)
 rsprite1.bitmap=pbLoadPokemonBitmap(@pokemon,false)
 rsprite2.bitmap=pbLoadPokemonBitmapSpecies(@pokemon,@newspecies,false)
 rsprite1.ox=rsprite1.bitmap.width/2
 rsprite1.oy=rsprite1.bitmap.height/2
 rsprite2.ox=rsprite2.bitmap.width/2
 rsprite2.oy=rsprite2.bitmap.height/2
 rsprite1.x=240
 rsprite1.y=120
 rsprite2.x=240
 rsprite2.y=120
 rsprite2.opacity=0
 @sprites["rsprite1"]=rsprite1
 @sprites["rsprite2"]=rsprite2
 pbGenerateMetafiles
 @sprites["msgwindow"]=Kernel.pbCreateMessageWindow(@viewport)
 pbFadeInAndShow(@sprites)
end

def pbEndScreen
 Kernel.pbDisposeMessageWindow(@sprites["msgwindow"])
 pbFadeOutAndHide(@sprites)
 pbDisposeSpriteHash(@sprites)
 @viewport.dispose
end

def pbEvolution(cancancel=true)
 metaplayer1=SpriteMetafilePlayer.new(@metafile1,@sprites["rsprite1"])
 metaplayer2=SpriteMetafilePlayer.new(@metafile2,@sprites["rsprite2"])
 metaplayer1.play
 metaplayer2.play
 Audio.bgm_stop
 Audio.se_play("Audio/SE/Choose.wav")
 Kernel.pbDisplayMessageFancy(@sprites["msgwindow"],
   _INTL("What?\r\n{1} is evolving!",@pokemon.name),-1,100)
 Audio.se_play("Audio/SE/Choose.wav")
 oldstate=pbSaveSpriteState(@sprites["rsprite1"])
 oldstate2=pbSaveSpriteState(@sprites["rsprite2"])
 Audio.bgm_play("Audio/BGM/evolv.mid")
 canceled=false
 begin
  metaplayer1.update
  metaplayer2.update 
  Graphics.update
  Input.update
  if Input.trigger?(Input::B) && cancancel
   canceled=true
   pbRestoreSpriteState(@sprites["rsprite1"],oldstate)
   pbRestoreSpriteState(@sprites["rsprite2"],oldstate2)
   Graphics.update 
   break
  end
 end while metaplayer1.playing? && metaplayer2.playing?
 if canceled
   Audio.bgm_stop
   Audio.se_play("Audio/SE/Choose.wav")
   Kernel.pbDisplayMessageFancy(@sprites["msgwindow"],
     _INTL("Huh?\r\n{1} stopped evolving!",@pokemon.name))
 else
   Audio.me_play("Audio/ME/004-Victory04")
   newspeciesname=PBSpecies.getName(@newspecies)
   oldspeciesname=PBSpecies.getName(@pokemon.species)
   Kernel.pbDisplayMessageFancy(@sprites["msgwindow"],
     _INTL("Congratulations!  Your {1} evolved into {2}!",@pokemon.name,newspeciesname),-1,160)
   @sprites["msgwindow"].text=""
   createSpecies=pbCheckEvolutionEx(@pokemon){|pokemon,evonib,level,poke|
    if evonib==14
     next poke
    else
     next -1
    end
   }
   @pokemon.species=@newspecies
   $Trainer.seen[@newspecies]=true
   $Trainer.owned[@newspecies]=true
   @pokemon.name=newspeciesname if @pokemon.name==oldspeciesname
   @pokemon.calcStats
   # Check moves for new species
   atkdata=File.open("PBS/attacksRS.dat","rb")
   offset=atkdata.getOffset(@pokemon.species-1)
   length=atkdata.getLength(@pokemon.species-1)>>1
   atkdata.pos=offset
   for k in 0..length-1
    level=atkdata.fgetw
    move=atkdata.fgetw
    if level==@pokemon.level
     # Learned a new move
     pbLearnMove(@pokemon,move,true)
    end
   end
   if createSpecies>0 && $Trainer.party.length<6
    newpokemon=@pokemon.clone
    newpokemon.species=createSpecies
    newpokemon.name=PBSpecies.getName(createSpecies)
    newpokemon.calcStats
    $Trainer.party.push(newpokemon)
    $Trainer.seen[createSpecies]=true
    $Trainer.owned[createSpecies]=true
   end
   atkdata.close
 end
end

end

def pbMiniCheckEvolution(pokemon,evonib,level,poke)
     case evonib
      when 1 # Evolves if loyal enough
       return poke if pokemon.happiness>=200
      when 2 # Evolves during the day if loyal enough
       time=Time.now
       return poke if pokemon.happiness>=200 && (time.hour<20 && time.hour>=6)
      when 3 # Evolves at night if loyal enough
       time=Time.now
       return poke if pokemon.happiness>=200 && (time.hour>=20 && time.hour<6)
      when 4
       return poke if pokemon.level>=level
      when 5, 6 # Evolves if traded
      when 7 # Evolves with item
      when 8
       return poke if pokemon.level>=level && pokemon.attack>pokemon.defense
      when 9
       return poke if pokemon.level>=level && pokemon.attack==pokemon.defense
      when 10
       return poke if pokemon.level>=level && pokemon.attack<pokemon.defense
      when 11 # Silcoon
       return poke if pokemon.level>=level && (pokemon.personalID%10)<5
      when 12 # Cascoon
       return poke if pokemon.level>=level && (pokemon.personalID%10)>=5
      when 13 # Ninjask
       return poke if pokemon.level>=level
      when 14 # Shedinja
      when 15 # Feebas, TODO
     end
     return -1
end


def pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item)
     case evonib
      when 7 # Evolves with item
       return poke if level==item
     end
     return -1
end


EVOTYPEMASK=0x0F
EVODATAMASK=0x30
EVONEXTFORM=0x00
EVOPREVFORM=0x10

def pbCheckEvolutionEx(pokemon)
 return -1 if pokemon.item==PBItems::EVERSTONE
 return -1 if pokemon.species<=0 || pokemon.eggsteps>0
 ret=-1
 File.open("PBS/evolutions.dat","rb"){|f|
  f.pos=(pokemon.species-1)*8
  offset=f.fgetdw
  length=f.fgetdw
  if length>0
   f.pos=offset
   i=0; loop do break unless i<length
    evo=f.fgetb
    evonib=evo&EVOTYPEMASK
    level=f.fgetw
    poke=f.fgetw
    if poke<=PBSpecies.getCount && (evo&EVODATAMASK)==EVONEXTFORM
     ret=yield pokemon,evonib,level,poke
     break if ret>0
    end
    i+=5
   end
  end
 }
 return ret
end

def pbCheckEvolution(pokemon,item=0)
 if item==0
  return pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
   next pbMiniCheckEvolution(pokemon,evonib,level,poke)
  }
 else
  return pbCheckEvolutionEx(pokemon){|pokemon,evonib,level,poke|
   next pbMiniCheckEvolutionItem(pokemon,evonib,level,poke,item)
  }
 end
end










rescue Exception
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
raise $!
else
end
end

It was among all other Pokemon scripts so I don't know if it would work by itself.  You can try though it is not exactly what you were looking for.
 
Well thank you for the code, but it's all system dependent on his pokemon script. I'll just wait until I am in port and download the whole thing. I wish I could use a download accellerator or a manager of some sort. Oh well. Thank you Sakura for everything, you've been awesome. Are you looking for a evolution script too? I am going to pay someone $10 bucks through paypal to make me one, I'll give it to you and some other people too if they would like it.

Anyone interested in making me an evolution script to my specs? Please email me or PM me for your $10 American.
 
Sakura Martinez":24ff4270 said:
Well, thanks as well.  I'm actually trying to make one as I have said, but who knows if I can actually do my own version of an evolution script since I am only just a beginner in scripting

Well if I get this Common Events thing to work I will make a scene. I don't have a problem with that part. It's just getting it to work. I need to know how to use the Event Command "Script". To run a scene I just type the following right?

Code:
$scene = Scene_Evolution.new

Isn't that right?
 
Sakura Martinez":1109onx9 said:
pretty much as long as that is the name defined in the script as the name of the scene

So that works with the Event command "Script"? I tried and it gives me errors. It's probably just errors of mine. I will tinker and then find out for sure.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top