Advertisement
TechSkylander1518

Shapeshifting Calls v18

Oct 21st, 2021
482
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.70 KB | None | 0 0
  1. #This one's just to save space lol
  2. def pbSetRunningShoes(status)
  3.   $PokemonGlobal.runningShoes = status
  4. end
  5.  
  6. #Code to turn stop animation on/off.
  7. #This is largely just for scripts; if you're doing this with an event,
  8. #using Set Move Route would be easier.
  9. def pbSetStopAnime(event,status)
  10.   if event == "player" || event == "Player"
  11.     if status == true
  12.       pbMoveRoute($game_player,[PBMoveRoute::StepAnimeOn])
  13.     else
  14.       pbMoveRoute($game_player,[PBMoveRoute::StepAnimeOff])
  15.     end
  16.   else
  17.     event = @event_id if event == "self" || event == "Self"
  18.     if status == true
  19.       pbMoveRoute($game_map.events[event],[PBMoveRoute::StepAnimeOn])
  20.     else
  21.       pbMoveRoute($game_map.events[event],[PBMoveRoute::StepAnimeOff])
  22.     end
  23.   end
  24. end
  25.  
  26. #Returns the filename of an event's current graphic
  27. def pbGetCharSet(event)
  28.   if event == "player" || event == "Player"
  29.     return $game_player.character_name
  30.   else
  31.     event = @event_id if event == "self" || event == "Self"
  32.     return $game_map.events[event].character_name
  33.   end
  34. end
  35.  
  36.  
  37. #Returns the normal walksprite for the player character
  38. def pbGetNormalChar
  39.     meta=pbGetMetadata(0,MetadataPlayerA+$PokemonGlobal.playerID)
  40.     graphic=pbGetPlayerCharset(meta,1,nil,true)
  41.    return graphic
  42. end
  43.  
  44. #Sets an event to the given charset
  45. def pbSetCharSet(event,charset)
  46.   if event == "player" || event == "Player"
  47.     $game_player.character_name = charset
  48.   else
  49.     event = @event_id if event == "self" || event == "Self"
  50.     $game_map.events[event].character_name = charset
  51.   end
  52. end
  53.  
  54.  
  55. #A little "animation", event pictured turns into a puff of smoke
  56. def pbPoof(event)
  57.   Audio.se_stop
  58.   pbSEPlay("battle recall",80,125)
  59.   if event == "player" || event == "Player"
  60.     pbMoveRoute($game_player,[PBMoveRoute::Graphic,"Cloud",0,$game_player.direction,0])
  61.   else
  62.     pbMoveRoute($game_map.events[event],[PBMoveRoute::Graphic,"Cloud",0,$game_map.events[event].direction,0])
  63.   end
  64. end
  65.  
  66.  
  67. #Switches the player's location with another event (uses the event's ID number)
  68. def pbSwapPos(event,poof=true)
  69.   px=$game_player.x
  70.   py=$game_player.y
  71.   pd=$game_player.direction
  72.   pc=pbGetCharSet("player")
  73.   if event == "self" || event == "Self"
  74.     event = @event_id
  75.   end
  76.   ex=$game_map.events[event].x
  77.   ey=$game_map.events[event].y
  78.   ed=$game_map.events[event].direction
  79.   ec=pbGetCharSet(event)
  80.   if poof==true
  81.     pbPoof(event)
  82.     pbPoof("player")
  83.     pbWait(10)
  84.   end
  85.   $game_map.events[event].moveto(px,py)
  86.   $game_player.moveto(ex,ey)
  87.   $game_player.direction = ed
  88.   $game_map.events[event].direction = pd
  89.   pbSetCharSet("player",pc)
  90.   pbSetCharSet(event,ec)
  91. end
  92.  
  93. #Switches the player's current graphic with the current graphic of an event.
  94. #Running shoes will undo the transformation, so turns them off, unless
  95. #the player is turning back to their original graphic
  96. def pbSwapGraphic(event,poof=true)
  97.   pbSetRunningShoes(false)
  98.   event = @event_id if event == "self" || event == "Self"
  99.   eventchar =  pbGetCharSet(event)
  100.   playerchar = pbGetCharSet("player")
  101.   if poof==true
  102.     pbPoof(event)
  103.     pbPoof("player")
  104.     pbWait(10)
  105.   end
  106.   pbSetCharSet(event,playerchar)
  107.   pbSetCharSet("player",eventchar)
  108.   if eventchar == pbGetNormalChar
  109.     pbSetRunningShoes(true)
  110.   end
  111. end
  112.  
  113.  
  114. #Returns true if the event is using the current graphic, and false if they're not
  115. def pbWearing?(event,graphic)
  116.   if event == "player" || event == "Player"
  117.     if $game_player.character_name == graphic
  118.       return true
  119.     else
  120.       return false
  121.     end
  122.   else
  123.   event = @event_id if event == "self" || event == "Self"
  124.     if $game_map.events[event].character_name == graphic
  125.       return true
  126.     else
  127.       return false
  128.     end
  129.   end
  130. end
  131.  
  132.  
  133. #Switches both location and charset
  134. def pbFullSwap(event,poof=false)
  135.   pbSwapGraphic(event,poof)
  136.   pbSwapPos(event,poof)
  137. end
  138.  
  139. #Changes the event's graphic to the given charset.
  140. #Set stopanime=true if they should move in place as well.
  141. #Running shoes will undo the transformation, so turns them off.
  142. def pbTransform(event,graphic,stopanime = false,poof=true)
  143.   if event == "player" || event == "Player"
  144.     pbSetRunningShoes(false)
  145.   end
  146.   if poof==true
  147.     pbPoof(event)
  148.     pbWait(10)
  149.   end
  150.   event = @event_id if event == "self" || event == "Self"
  151.   pbSetCharSet(event,graphic)
  152.   pbSetStopAnime(event,stopanime)
  153. end
  154.  
  155. #Returns the player to their default charset, and gives back running shoes
  156. def pbDetransform(poof=true)
  157.   graphic = pbGetNormalChar
  158.   pbTransform("player",graphic,poof)
  159.   pbSetRunningShoes(true)
  160.   pbSetStopAnime("player",false)
  161. end
  162.  
  163. #Changes the player into a Pokemon's overworld sprite.
  164. #Can be given a specific Pokemon or just the symbol for the species.
  165. #Can account for form and shininess as well.
  166. def pbTransformPoke(pokemon,form = 0, shiny = false, gender = nil)
  167.   if !pokemon.is_a?(Symbol)
  168.     shiny = pokemon.shiny?
  169.     form = pokemon.form
  170.     gender = pokemon.gender
  171.     pokemon = pokemon.species
  172.   end
  173.   no =PBSpecies.getName(pokemon).upcase
  174.     graphic = _INTL("Followers")
  175.     if shiny == true
  176.       graphic+= _INTL(" shiny")
  177.     end
  178.     graphic+=_INTL("/{1}",no)
  179.   if form > 0
  180.     graphic+=_INTL("_{1}",form)
  181.   end
  182.   if safeExists?("Graphics/Characters/{#graphic}")
  183.     case gender
  184.       when 0
  185.         gender = "female"
  186.       when 1, nil
  187.         gender = "male"
  188.     end
  189.       graphic+=_INTL("_{1}",gender)
  190.   end
  191.     pbTransform("player",graphic,stopanime = true)
  192. end
  193.  
  194.  
  195. #Lets the player select a Pokemon from their party, and turns them into the
  196. #matching overworld sprite
  197. def pbSelectPokeTransform
  198.   pbChoosePokemon(1,3)
  199.   if $game_variables[1] >= 0
  200.     pokemon=$Trainer.party[$game_variables[1]]
  201.     pbTransformPoke(pokemon)
  202.   end
  203. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement