• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Shapeshifting Calls

v19 Shapeshifting Calls N/A

This resource pertains to version 19 of Pokémon Essentials.
Pokémon Essentials Version
v19.1 ➖
party ow.gif

doormansdayout.gif


I was touching up a mechanic I made for The Chakra Clinic and had a few more ideas to throw in! These are some easy script calls you can use to make some puzzles around changing the player's appearance!

Foreword
A few things to note!

These calls only change the player's overworld sprite, and so other sprites that depend on their trainer class (backsprite during battles, front sprite on the trainer card, etc.) won't be affected. It's designed more for brief puzzles, not a long-running mechanic. (If you're looking for something in that department, you might be interested in NettoHikari's Multiple Protagonists Script!)

The download link is just for that little cloud graphic- if you're looking for overworld Pokemon, you'll want to check out Golisopod User's Gen 8 Project! Right now, any Poke-transforming uses that naming system to check for overworld sprites, so be sure yours match his format!

Code
Paste in a new script section above Main!

Ruby:
#This one's just to save space lol
def pbSetRunningShoes(status)
  $Trainer.has_running_shoes = status
end

#Code to turn stop animation on/off.
#This is largely just for scripts; if you're doing this with an event,
#using Set Move Route would be easier.
def pbSetStopAnime(event,status)
  if event == "player" || event == "Player"
    $game_player.step_anime = status
  else
    event = @event_id if event == "self" || event == "Self"
    $game_map.events[event].step_anime = status
  end
end
 
#Returns the filename of an event's current graphic
def pbGetCharSet(event)
  if event == "player" || event == "Player"
    return $game_player.character_name
  else
    event = @event_id if event == "self" || event == "Self"
    return $game_map.events[event].character_name
  end
end
 

#Returns the normal walksprite for the player character
def pbGetNormalChar
  meta = GameData::Metadata.get_player($Trainer.character_ID)
  graphic = pbGetPlayerCharset(meta,1,nil,true)
  return graphic
end

#Sets an event to the given charset
def pbSetCharSet(event,charset)
  if event == "player" || event == "Player"
    $game_player.character_name = charset
  else
    event = @event_id if event == "self" || event == "Self"
    $game_map.events[event].character_name = charset
  end
end


#A little "animation", event pictured turns into a puff of smoke
def pbPoof(event)
  Audio.se_stop
  pbSEPlay("battle recall",80,125)
  if event == "player" || event == "Player"
    pbMoveRoute($game_player,[PBMoveRoute::Graphic,"Cloud",0,$game_player.direction,0])
  else
    pbMoveRoute($game_map.events[event],[PBMoveRoute::Graphic,"Cloud",0,$game_map.events[event].direction,0])
  end
end


#Switches the player's location with another event (uses the event's ID number)
def pbSwapPos(event,poof=true)
  px=$game_player.x
  py=$game_player.y
  pd=$game_player.direction
  pc=pbGetCharSet("player")
  if event == "self" || event == "Self"
    event = @event_id
  end
  ex=$game_map.events[event].x
  ey=$game_map.events[event].y
  ed=$game_map.events[event].direction
  ec=pbGetCharSet(event)
  if poof==true
    pbPoof(event)
    pbPoof("player")
    pbWait(10)
  end
  $game_map.events[event].moveto(px,py)
  $game_player.moveto(ex,ey)
  $game_player.direction = ed
  $game_map.events[event].direction = pd
  pbSetCharSet("player",pc)
  pbSetCharSet(event,ec)
end

#Switches the player's current graphic with the current graphic of an event.
#Running shoes will undo the transformation, so turns them off, unless
#the player is turning back to their original graphic
def pbSwapGraphic(event,poof=true)
  pbSetRunningShoes(false)
  event = @event_id if event == "self" || event == "Self"
  eventchar =  pbGetCharSet(event)
  playerchar = pbGetCharSet("player")
  if poof==true
    pbPoof(event)
    pbPoof("player")
    pbWait(10)
  end
  pbSetCharSet(event,playerchar)
  pbSetCharSet("player",eventchar)
  if eventchar == pbGetNormalChar
    pbSetRunningShoes(true)
  end
end


#Returns true if the event is using the current graphic, and false if they're not
def pbWearing?(event,graphic)
  if event == "player" || event == "Player"
    if $game_player.character_name == graphic
      return true
    else
      return false
    end
  else
  event = @event_id if event == "self" || event == "Self"
    if $game_map.events[event].character_name == graphic
      return true
    else
      return false
    end
  end
end


#Switches both location and charset
def pbFullSwap(event,poof=false)
  pbSwapGraphic(event,poof)
  pbSwapPos(event,poof)
end

#Changes the event's graphic to the given charset.
#Set stopanime=true if they should move in place as well.
#Running shoes will undo the transformation, so turns them off.
def pbTransform(event,graphic,stopanime = false,poof=true)
  if event == "player" || event == "Player"
    pbSetRunningShoes(false)
  end
  if poof==true
    pbPoof(event)
    pbWait(10)
  end
  event = @event_id if event == "self" || event == "Self"
  pbSetCharSet(event,graphic)
  pbSetStopAnime(event,stopanime)
end

#Returns the player to their default charset, and gives back running shoes
def pbDetransform(poof=true)
  graphic = pbGetNormalChar
  pbTransform("player",graphic,poof)
  pbSetRunningShoes(true)
  pbSetStopAnime("player",false)
end

#Changes the player into a Pokemon's overworld sprite.
#Can be given a specific Pokemon or just the symbol for the species.
#Can account for form and shininess as well.
def pbTransformPoke(pokemon,form = 0, shiny = false, gender = nil)
  if !pokemon.is_a?(Symbol)
    shiny = pokemon.shiny?
    form = pokemon.form
    gender = pokemon.gender
    pokemon = pokemon.species
  end
  no = GameData::Species.get(pokemon).id_number
    graphic = _INTL("Followers")
    if shiny == true
      graphic+= _INTL(" shiny")
    end
    graphic+=_INTL("/{1}",pokemon)
  if form > 0
    graphic+=_INTL("_{1}",form)
  end
  if !safeExists?("Graphics/Characters/{#graphic}")
    case gender
      when 0
        gender = "female"
      when 1, nil
        gender = "male"
    end
      graphic+=_INTL("_{1}",gender)
  end
    pbTransform("player",graphic,stopanime = true)
end
 

#Lets the player select a Pokemon from their party, and turns them into the
#matching overworld sprite
def pbSelectPokeTransform
  pbChoosePokemon(1,3)
  if $game_variables[1] >= 0
    pokemon=$Trainer.party[$game_variables[1]]
    pbTransformPoke(pokemon)
  end
end

For v18-
Ruby:
#This one's just to save space lol
def pbSetRunningShoes(status)
  $PokemonGlobal.runningShoes = status
end

#Code to turn stop animation on/off.
#This is largely just for scripts; if you're doing this with an event,
#using Set Move Route would be easier.
def pbSetStopAnime(event,status)
  if event == "player" || event == "Player"
    if status == true
      pbMoveRoute($game_player,[PBMoveRoute::StepAnimeOn])
    else
      pbMoveRoute($game_player,[PBMoveRoute::StepAnimeOff])
    end
  else
    event = @event_id if event == "self" || event == "Self"
    if status == true
      pbMoveRoute($game_map.events[event],[PBMoveRoute::StepAnimeOn])
    else
      pbMoveRoute($game_map.events[event],[PBMoveRoute::StepAnimeOff])
    end
  end
end
 
#Returns the filename of an event's current graphic
def pbGetCharSet(event)
  if event == "player" || event == "Player"
    return $game_player.character_name
  else
    event = @event_id if event == "self" || event == "Self"
    return $game_map.events[event].character_name
  end
end
 

#Returns the normal walksprite for the player character
def pbGetNormalChar
    meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
    graphic=pbGetPlayerCharset(meta,1,nil,true)
   return graphic
end

#Sets an event to the given charset
def pbSetCharSet(event,charset)
  if event == "player" || event == "Player"
    $game_player.character_name = charset
  else
    event = @event_id if event == "self" || event == "Self"
    $game_map.events[event].character_name = charset
  end
end


#A little "animation", event pictured turns into a puff of smoke
def pbPoof(event)
  Audio.se_stop
  pbSEPlay("battle recall",80,125)
  if event == "player" || event == "Player"
    pbMoveRoute($game_player,[PBMoveRoute::Graphic,"Cloud",0,$game_player.direction,0])
  else
    pbMoveRoute($game_map.events[event],[PBMoveRoute::Graphic,"Cloud",0,$game_map.events[event].direction,0])
  end
end


#Switches the player's location with another event (uses the event's ID number)
def pbSwapPos(event,poof=true)
  px=$game_player.x
  py=$game_player.y
  pd=$game_player.direction
  pc=pbGetCharSet("player")
  if event == "self" || event == "Self"
    event = @event_id
  end
  ex=$game_map.events[event].x
  ey=$game_map.events[event].y
  ed=$game_map.events[event].direction
  ec=pbGetCharSet(event)
  if poof==true
    pbPoof(event)
    pbPoof("player")
    pbWait(10)
  end
  $game_map.events[event].moveto(px,py)
  $game_player.moveto(ex,ey)
  $game_player.direction = ed
  $game_map.events[event].direction = pd
  pbSetCharSet("player",pc)
  pbSetCharSet(event,ec)
end

#Switches the player's current graphic with the current graphic of an event.
#Running shoes will undo the transformation, so turns them off, unless
#the player is turning back to their original graphic
def pbSwapGraphic(event,poof=true)
  pbSetRunningShoes(false)
  event = @event_id if event == "self" || event == "Self"
  eventchar =  pbGetCharSet(event)
  playerchar = pbGetCharSet("player")
  if poof==true
    pbPoof(event)
    pbPoof("player")
    pbWait(10)
  end
  pbSetCharSet(event,playerchar)
  pbSetCharSet("player",eventchar)
  if eventchar == pbGetNormalChar
    pbSetRunningShoes(true)
  end
end


#Returns true if the event is using the current graphic, and false if they're not
def pbWearing?(event,graphic)
  if event == "player" || event == "Player"
    if $game_player.character_name == graphic
      return true
    else
      return false
    end
  else
  event = @event_id if event == "self" || event == "Self"
    if $game_map.events[event].character_name == graphic
      return true
    else
      return false
    end
  end
end


#Switches both location and charset
def pbFullSwap(event,poof=false)
  pbSwapGraphic(event,poof)
  pbSwapPos(event,poof)
end

#Changes the event's graphic to the given charset.
#Set stopanime=true if they should move in place as well.
#Running shoes will undo the transformation, so turns them off.
def pbTransform(event,graphic,stopanime = false,poof=true)
  if event == "player" || event == "Player"
    pbSetRunningShoes(false)
  end
  if poof==true
    pbPoof(event)
    pbWait(10)
  end
  event = @event_id if event == "self" || event == "Self"
  pbSetCharSet(event,graphic)
  pbSetStopAnime(event,stopanime)
end

#Returns the player to their default charset, and gives back running shoes
def pbDetransform(poof=true)
  graphic = pbGetNormalChar
  pbTransform("player",graphic,poof)
  pbSetRunningShoes(true)
  pbSetStopAnime("player",false)
end

#Changes the player into a Pokemon's overworld sprite.
#Can be given a specific Pokemon or just the symbol for the species.
#Can account for form and shininess as well.
def pbTransformPoke(pokemon,form = 0, shiny = false, gender = nil)
  if !pokemon.is_a?(Symbol)
    shiny = pokemon.shiny?
    form = pokemon.form
    gender = pokemon.gender
    pokemon = pokemon.species
  end
  no =PBSpecies.getName(pokemon).upcase
    graphic = _INTL("Followers")
    if shiny == true
      graphic+= _INTL(" shiny")
    end
    graphic+=_INTL("/{1}",no)
  if form > 0
    graphic+=_INTL("_{1}",form)
  end
  if safeExists?("Graphics/Characters/{#graphic}")
    case gender
      when 0
        gender = "female"
      when 1, nil
        gender = "male"
    end
      graphic+=_INTL("_{1}",gender)
  end
    pbTransform("player",graphic,stopanime = true)
end
 

#Lets the player select a Pokemon from their party, and turns them into the
#matching overworld sprite
def pbSelectPokeTransform
  pbChoosePokemon(1,3)
  if $game_variables[1] >= 0
    pokemon=$Trainer.party[$game_variables[1]]
    pbTransformPoke(pokemon)
  end
end
Calls
Anywhere a call asks for event, you'll either put in:
  • The ID number of the event you want (top left corner in the event window)
  • "Self" or "self" if you want the event you're using (quotes included)
  • "Player or "player" if you want the player (quotes included)

Anywhere an event asks for a graphic, you'll put the file name in quotes- for example, "trainer_POKEMONTRAINER_Red". (Don't worry about putting Graphics/Characters)

For any event with the poofing animation, you can put in poof=false to skip it.

pbSwapPos(event) switches the player's position with another event, but doesn't change the graphics of either one.

pbSwapGraphic(event) switches the player's graphics with the events, like in that GIF with the door explainer.

pbFullSwap(event) does both of these- switches their locations and graphics.

pbWearing?(event,graphic) checks if the event is using the given graphic. It returns true if it is, and false if it isn't. (For example, pbWearing?("player","trainer_POKEMONTRAINER_Red") is the check I used in the GIF above) You'll want to use this as a conditional script branch.

pbTransform(event,graphic) sets the event's charset to the given graphic. If it's being used on the player, it also disables running shoes, because running changes the spritesheet as well and would mess things up here. If you want to turn on Stop Animation (like what's often done for overworld Pokemon), you would do it as pbTransform(event,graphic,stopanime = true)

pbDetransform is just a quick and easy way of getting the player back to normal. Original graphic, running shoes are on, stop animation is off.

pbTransformPoke pulls the relevant overworld file for you! You can make it check an actual Pokemon, using just pbTransformPoke(pokemon), and it'll pull species, form, gender, and shininess from the given mon! Or you could put that all in yourself, by filling out pbTransformPoke(pokemon,form = 0, shiny = false, gender = nil)

pbSelectPokeTransform asks the player to pick a Pokemon from their party, and, if they do, uses them in pbTransformPoke!

These next calls are more for internal use:

pbPoof(event) is for that little puff of smoke animation- plays a sound effect, turns the event into a cloud.

pbGetCharSet(event) returns the file name of the event's current charset. It relies on the event's ID number, but you can also set it to "player" to get the player's, or "self" to have an event reference itself. It's mostly in here to tidy the code, but you could also use it to save a charset to a Global Variable to refer to later!

pbGetNormalChar works the same as pbGetCharSet(event), but instead of looking at what's currently displayed, it goes into the metadata and gets the overworld sprite that the player would normally have.

pbSetCharSet(event, charset) sets the event's charset to the one given, but doesn't do any of the special stuff pbTransform does. It's mostly just used to tidy up code, since you could do something similar with Set Move Route, but you might find it useful if you have other scripts changing the appearance of events.

pbSetRunningShoes(status) and pbSetStopAnime(event,status) are mostly just there to tidy the code. You could use pbSetRunningShoes(true) to give the running shoes if that made things easier for you. I don't recommend using pbSetStopAnime in an event, though, using Set Move Route would be easier.

Other Notes

The player's graphic will stay whatever you set it at, even if you reload the game after saving.

Events can keep their graphic if the player moves maps, but only if the player moves to a directly connected map (for example, Lappet Town to Route 1), and only within a certain tile range. (I'm afraid I don't know the exact number right now, but it's decently far, maybe twenty or so tiles?)

If you want the player to switch their graphic with a dependent event, you'll want to use pbSetCharSet, not pbSwapGraphic- pbSwapGraphic will look at the original event (which is now invisible) and not the follower.


Future Goals
  • Add speed changing options
  • Add some checks for other naming styles for overworld Pokemon, like Neospriteman's pack
  • Checks for Pokemon type, so puzzles can be built with more options (for example, letting the player pass over a gap if their sprite was of any Flying-type)
  • Code to let the player choose to pilot their Pokemon from the party
  • Fix up the dependent event effects
  • It shouldn't be hard to make this compatible with earlier versions of Essentials, there's only a few differences
Credits
Credit to TechSkylander1518, please!
Cloud graphic was ripped by RedBlueYellow of SpritersResource
Author
TechSkylander1518
Downloads
623
Views
2,120
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from TechSkylander1518

Back
Top