Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Deep Marsh Tiles - By Vendily [v17]
- #===============================================================================
- # This script adds in Deep Marsh tiles, the annoying classic from DPPt, which
- # cause the player to sink in and get stuck until they wiggle free.
- #===============================================================================
- # To use it, you must create a new tile with terrain tag MarshDeep.
- # Remember to change the number if you are already using the default 17
- # There's also one other edit to "def bush_depth" in Game_Character.
- # This line :
- # return 12 if self.map.bush?(@x,@y) and !moving?
- # Becomes this line :
- # return 12 if (self.map.bush?(@x,@y) and !moving?) || (self==$game_player && $PokemonGlobal.stuck)
- # You could instead edit the line above in it in the same manner if you want the
- # player to sink more into the mud. Or even just make the stuck condition on
- # its own line to have it sink a different amount.
- # Not gonna explain that though, it's beyond the scope of the script.
- #===============================================================================
- # * The number of times the player must turn before becoming freed (Default 5)
- # * The sound the player makes on freeing themselves (Default "Player jump")
- #===============================================================================
- MARSHTILES_TURN_TIMES = 5
- MARSHTILES_JUMP_SOUND = "Player jump"
- module PBTerrain
- MarshDeep = 17
- end
- class PokemonGlobalMetadata
- attr_accessor :stuck
- attr_accessor :mudfree
- def stuck
- @stuck=false if !@stuck
- return @stuck
- end
- end
- Events.onStepTakenFieldMovement+=proc {|sender,e|
- event = e[0] # Get the event affected by field movement
- if $scene.is_a?(Scene_Map)
- currentTag = pbGetTerrainTag(event)
- if event==$game_player && currentTag==PBTerrain::MarshDeep && !$PokemonGlobal.mudfree
- Kernel.pbStuckTile(event)
- end
- end
- }
- def Kernel.pbStuckTile(event=nil)
- event = $game_player if !event
- return if !event
- $PokemonGlobal.stuck=true
- event.straighten
- olddir=event.direction
- dir=olddir
- turntimes=0
- loop do
- break if turntimes>=MARSHTILES_TURN_TIMES
- Graphics.update
- Input.update
- pbUpdateSceneMap
- key=Input.dir4
- dir=key if key>0
- if dir!=olddir
- case dir
- when 2; event.turn_down
- when 4; event.turn_left
- when 6; event.turn_right
- when 8; event.turn_up
- end
- olddir=dir
- turntimes+=1
- end
- end
- event.center(event.x,event.y)
- event.straighten
- $PokemonGlobal.stuck=false
- $PokemonGlobal.mudfree=true
- event.jump(0,0)
- pbSEPlay(MARSHTILES_JUMP_SOUND)
- 20.times do
- Graphics.update
- Input.update
- pbUpdateSceneMap
- end
- $PokemonGlobal.mudfree=false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement