Advertisement
TechSkylander1518

Shapeshifting Calls v19

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