• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
Shapeshifting Calls

Resource Shapeshifting Calls N/A

TechSkylander1518 submitted a new resource:

Shapeshifting Calls - A few script calls to have some fun with changing the player into another spritesheet!



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...

Read more about this resource...
 

Hellfire

Novice
Member
Joined
Dec 25, 2020
Posts
13
Do this work on v18? Because id tried by every way but always i got a error
 
Do this work on v18? Because id tried by every way but always i got a error
Not as it currently is, but it only takes a couple changes to make it work with v18!

At the top of the script, find this-
Ruby:
Expand Collapse Copy
def pbSetRunningShoes(status)
  $Trainer.has_running_shoes = status
#v18  $PokemonGlobal.runningShoes = status
end
Delete "#v18" and delete the line above it.


Then, further down, find this:
Ruby:
Expand Collapse Copy
def pbGetNormalChar
  meta = GameData::Metadata.get_player($Trainer.character_ID)
  graphic = pbGetPlayerCharset(meta,1,nil,true)
  return graphic
end

Change it to:
Ruby:
Expand Collapse Copy
def pbGetNormalChar
    meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
    graphic=pbGetPlayerCharset(meta,1,nil,true)
   return graphic
end
 

Hellfire

Novice
Member
Joined
Dec 25, 2020
Posts
13
Now i can swap char with another event, but i cant transform the player into a poke with the command pbSelectPokeTransform. I got this error:

---------------------------
Error
---------------------------
Script '[Interpreter]' line 246: RuntimeError occurred.

Script error within event 26 (coords 14,7), map 21 (Intersección #1):

Exception: NameError

Message: shape:165:in `pbTransformPoke'uninitialized constant GameData



***Full script:

pbSelectPokeTransform
pbTransformPoke!




Backtrace:

Interpreter:197:in `pbExecuteScript'

shape:193:in `pbSelectPokeTransform'

(eval):1:in `pbExecuteScript'

Interpreter:1458:in `eval'

Interpreter:197:in `pbExecuteScript'

Interpreter:1458:in `command_355'

Interpreter:359:in `execute_command'

Interpreter:155:in `update'

Interpreter:102:in `loop'

Interpreter:158:in `update'


---------------------------
Aceptar
---------------------------
 
Oh, whoops, forgot about that part! Find this section-
Ruby:
Expand Collapse Copy
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
Change no = GameData::Species.get(pokemon).id_number to no = pokemon, and it should be good!
 

Hellfire

Novice
Member
Joined
Dec 25, 2020
Posts
13
I now get this:

---------------------------
Error
---------------------------
Script '[Interpreter]' line 246: RuntimeError occurred.

Script error within event 26 (coords 14,7), map 21 (Intersección #1):

Exception: NoMethodError

Message: shape:11:in `pbSetStopAnime'undefined method `step_anime=' for #<Game_Player:0xc5525b0>



***Full script:

pbSelectPokeTransform
pbTransformPoke!




Backtrace:

Interpreter:197:in `pbExecuteScript'

shape:144:in `pbTransform'

shape:183:in `pbTransformPoke'

shape:193:in `pbSelectPokeTransform'

(eval):1:in `pbExecuteScript'

Interpreter:1458:in `eval'

Interpreter:197:in `pbExecuteScript'

Interpreter:1458:in `command_355'

Interpreter:359:in `execute_command'

Interpreter:155:in `update'


---------------------------
Aceptar
---------------------------
 
Ah, didn't realize that call was for MKXP, I thought it was native. Try changing
Ruby:
Expand Collapse Copy
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

to

Ruby:
Expand Collapse Copy
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
 

Hellfire

Novice
Member
Joined
Dec 25, 2020
Posts
13
Im still without make the pbSelectPokeTransform command work. Well, at least, i could make the normal command (pbTransformPoke(86), using the number of pokemon because if i type the name, the game throw a error), but the char goes invisible. I tried by changing the charset into names or numbers, but nothing of that seems to work. The error i got now with pbselectpoketransform is this (im using just rpgmxp, not mk):

---------------------------
Error
---------------------------
Script '[Interpreter]' line 246: RuntimeError occurred.

Script error within event 26 (coords 14,7), map 21 (Intersección #1):

Exception: NoMethodError

Message: (eval):2:in `pbExecuteScript'undefined method `pbTransformPoke!' for #<Interpreter:0xc406550>



***Full script:

pbSelectPokeTransform
pbTransformPoke!




Backtrace:

Interpreter:197:in `pbExecuteScript'

Interpreter:1458:in `eval'

Interpreter:197:in `pbExecuteScript'

Interpreter:1458:in `command_355'

Interpreter:359:in `execute_command'

Interpreter:155:in `update'

Interpreter:102:in `loop'

Interpreter:158:in `update'

Scene_Map:162:in `update'

Scene_Map:160:in `loop'


---------------------------
Aceptar
---------------------------
 
Message: (eval):2:in `pbExecuteScript'undefined method `pbTransformPoke!' for #<Interpreter:0xc406550>



***Full script:

pbSelectPokeTransform
pbTransformPoke!
It looks like this specific error is because an exclamation point got its way into your code somehow. I'm not sure how that happened, but it's not in my original script. I have a working v18.1 version in the original post now if you want to try just copying that?
 

Hellfire

Novice
Member
Joined
Dec 25, 2020
Posts
13
It looks like this specific error is because an exclamation point got its way into your code somehow. I'm not sure how that happened, but it's not in my original script. I have a working v18.1 version in the original post now if you want to try just copying that?
Please, if you dont mind. It makes a lot of illusiom to me to make mechanics with this script
 
Please, if you dont mind. It makes a lot of illusiom to me to make mechanics with this script
Yay, I'm glad you're getting good use out of it!

I... don't know how I missed putting the script in the main post, because I could have sworn I did that before posting here lol. But here it is!

Ruby:
Expand Collapse Copy
#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
 
Back
Top